pkcs7.unpad.js 1.2 KB

1234567891011121314151617181920212223242526272829
  1. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. (function (global){
  3. global.window.pkcs7 = {
  4. unpad: require('./unpad')
  5. };
  6. }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  7. },{"./unpad":2}],2:[function(require,module,exports){
  8. /*
  9. * pkcs7.unpad
  10. * https://github.com/brightcove/pkcs7
  11. *
  12. * Copyright (c) 2014 Brightcove
  13. * Licensed under the apache2 license.
  14. */
  15. 'use strict';
  16. /**
  17. * Returns the subarray of a Uint8Array without PKCS#7 padding.
  18. * @param padded {Uint8Array} unencrypted bytes that have been padded
  19. * @return {Uint8Array} the unpadded bytes
  20. * @see http://tools.ietf.org/html/rfc5652
  21. */
  22. module.exports = function unpad(padded) {
  23. return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
  24. };
  25. },{}]},{},[1]);