Blame view

node_modules/pkcs7/lib/unpad.js 505 Bytes
2a09d1a4   liuqimichale   添加宜春 天水 宣化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  /*
   * pkcs7.unpad
   * https://github.com/brightcove/pkcs7
   *
   * Copyright (c) 2014 Brightcove
   * Licensed under the apache2 license.
   */
  
  'use strict';
  
  /**
   * Returns the subarray of a Uint8Array without PKCS#7 padding.
   * @param padded {Uint8Array} unencrypted bytes that have been padded
   * @return {Uint8Array} the unpadded bytes
   * @see http://tools.ietf.org/html/rfc5652
   */
  module.exports = function unpad(padded) {
    return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
  };