Release new version
This commit is contained in:
parent
dc9660f2ae
commit
93c5bed64b
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "openpgp",
|
"name": "openpgp",
|
||||||
"version": "4.8.1",
|
"version": "4.9.0",
|
||||||
"license": "LGPL-3.0+",
|
"license": "LGPL-3.0+",
|
||||||
"homepage": "https://openpgpjs.org/",
|
"homepage": "https://openpgpjs.org/",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
119
dist/compat/openpgp.js
vendored
119
dist/compat/openpgp.js
vendored
|
@ -31491,7 +31491,7 @@ exports.default = {
|
||||||
* @memberof module:config
|
* @memberof module:config
|
||||||
* @property {String} versionstring A version string to be included in armored messages
|
* @property {String} versionstring A version string to be included in armored messages
|
||||||
*/
|
*/
|
||||||
versionstring: "OpenPGP.js v4.8.1",
|
versionstring: "OpenPGP.js v4.9.0",
|
||||||
/**
|
/**
|
||||||
* @memberof module:config
|
* @memberof module:config
|
||||||
* @property {String} commentstring A comment string to be included in armored messages
|
* @property {String} commentstring A comment string to be included in armored messages
|
||||||
|
@ -31856,8 +31856,25 @@ var webCrypto = _util2.default.getWebCrypto(); // Modified by ProtonTech AG
|
||||||
var nodeCrypto = _util2.default.getNodeCrypto();
|
var nodeCrypto = _util2.default.getNodeCrypto();
|
||||||
var Buffer = _util2.default.getNodeBuffer();
|
var Buffer = _util2.default.getNodeBuffer();
|
||||||
|
|
||||||
|
var knownAlgos = nodeCrypto ? nodeCrypto.getCiphers() : [];
|
||||||
|
var nodeAlgos = {
|
||||||
|
idea: knownAlgos.includes('idea-cfb') ? 'idea-cfb' : undefined, /* Unused, not implemented */
|
||||||
|
'3des': knownAlgos.includes('des-ede3-cfb') ? 'des-ede3-cfb' : undefined,
|
||||||
|
tripledes: knownAlgos.includes('des-ede3-cfb') ? 'des-ede3-cfb' : undefined,
|
||||||
|
cast5: knownAlgos.includes('cast5-cfb') ? 'cast5-cfb' : undefined,
|
||||||
|
blowfish: knownAlgos.includes('bf-cfb') ? 'bf-cfb' : undefined,
|
||||||
|
aes128: knownAlgos.includes('aes-128-cfb') ? 'aes-128-cfb' : undefined,
|
||||||
|
aes192: knownAlgos.includes('aes-192-cfb') ? 'aes-192-cfb' : undefined,
|
||||||
|
aes256: knownAlgos.includes('aes-256-cfb') ? 'aes-256-cfb' : undefined
|
||||||
|
/* twofish is not implemented in OpenSSL */
|
||||||
|
};
|
||||||
|
|
||||||
exports.default = {
|
exports.default = {
|
||||||
encrypt: function encrypt(algo, key, plaintext, iv) {
|
encrypt: function encrypt(algo, key, plaintext, iv) {
|
||||||
|
if (_util2.default.getNodeCrypto() && nodeAlgos[algo]) {
|
||||||
|
// Node crypto library.
|
||||||
|
return nodeEncrypt(algo, key, plaintext, iv);
|
||||||
|
}
|
||||||
if (algo.substr(0, 3) === 'aes') {
|
if (algo.substr(0, 3) === 'aes') {
|
||||||
return aesEncrypt(algo, key, plaintext, iv);
|
return aesEncrypt(algo, key, plaintext, iv);
|
||||||
}
|
}
|
||||||
|
@ -31865,68 +31882,77 @@ exports.default = {
|
||||||
var cipherfn = new _cipher2.default[algo](key);
|
var cipherfn = new _cipher2.default[algo](key);
|
||||||
var block_size = cipherfn.blockSize;
|
var block_size = cipherfn.blockSize;
|
||||||
|
|
||||||
var blocki = new Uint8Array(block_size);
|
|
||||||
var blockc = iv.slice();
|
var blockc = iv.slice();
|
||||||
var pos = 0;
|
var pt = new Uint8Array();
|
||||||
var ciphertext = new Uint8Array(plaintext.length);
|
var process = function process(chunk) {
|
||||||
|
if (chunk) {
|
||||||
|
pt = _util2.default.concatUint8Array([pt, chunk]);
|
||||||
|
}
|
||||||
|
var ciphertext = new Uint8Array(pt.length);
|
||||||
var i = void 0;
|
var i = void 0;
|
||||||
var j = 0;
|
var j = 0;
|
||||||
|
while (chunk ? pt.length >= block_size : pt.length) {
|
||||||
while (plaintext.length > block_size * pos) {
|
|
||||||
var encblock = cipherfn.encrypt(blockc);
|
var encblock = cipherfn.encrypt(blockc);
|
||||||
blocki = plaintext.subarray(pos * block_size, pos * block_size + block_size);
|
for (i = 0; i < block_size; i++) {
|
||||||
for (i = 0; i < blocki.length; i++) {
|
blockc[i] = pt[i] ^ encblock[i];
|
||||||
blockc[i] = blocki[i] ^ encblock[i];
|
|
||||||
ciphertext[j++] = blockc[i];
|
ciphertext[j++] = blockc[i];
|
||||||
}
|
}
|
||||||
pos++;
|
pt = pt.subarray(block_size);
|
||||||
}
|
}
|
||||||
return ciphertext;
|
return ciphertext.subarray(0, j);
|
||||||
|
};
|
||||||
|
return _webStreamTools2.default.transform(plaintext, process, process);
|
||||||
},
|
},
|
||||||
|
|
||||||
decrypt: function () {
|
decrypt: function () {
|
||||||
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(algo, key, ciphertext, iv) {
|
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(algo, key, ciphertext, iv) {
|
||||||
var cipherfn, block_size, blockp, pos, plaintext, offset, i, j, decblock;
|
var cipherfn, block_size, blockp, ct, process;
|
||||||
return _regenerator2.default.wrap(function _callee$(_context) {
|
return _regenerator2.default.wrap(function _callee$(_context) {
|
||||||
while (1) {
|
while (1) {
|
||||||
switch (_context.prev = _context.next) {
|
switch (_context.prev = _context.next) {
|
||||||
case 0:
|
case 0:
|
||||||
if (!(algo.substr(0, 3) === 'aes')) {
|
if (!(_util2.default.getNodeCrypto() && nodeAlgos[algo])) {
|
||||||
_context.next = 2;
|
_context.next = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return _context.abrupt('return', nodeDecrypt(algo, key, ciphertext, iv));
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
if (!(algo.substr(0, 3) === 'aes')) {
|
||||||
|
_context.next = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return _context.abrupt('return', aesDecrypt(algo, key, ciphertext, iv));
|
return _context.abrupt('return', aesDecrypt(algo, key, ciphertext, iv));
|
||||||
|
|
||||||
case 2:
|
|
||||||
_context.next = 4;
|
|
||||||
return _webStreamTools2.default.readToEnd(ciphertext);
|
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
ciphertext = _context.sent;
|
|
||||||
cipherfn = new _cipher2.default[algo](key);
|
cipherfn = new _cipher2.default[algo](key);
|
||||||
block_size = cipherfn.blockSize;
|
block_size = cipherfn.blockSize;
|
||||||
blockp = iv;
|
blockp = iv;
|
||||||
pos = 0;
|
ct = new Uint8Array();
|
||||||
plaintext = new Uint8Array(ciphertext.length);
|
|
||||||
offset = 0;
|
|
||||||
i = void 0;
|
|
||||||
j = 0;
|
|
||||||
|
|
||||||
|
process = function process(chunk) {
|
||||||
while (ciphertext.length > block_size * pos) {
|
if (chunk) {
|
||||||
decblock = cipherfn.encrypt(blockp);
|
ct = _util2.default.concatUint8Array([ct, chunk]);
|
||||||
|
}
|
||||||
blockp = ciphertext.subarray(pos * block_size + offset, pos * block_size + block_size + offset);
|
var plaintext = new Uint8Array(ct.length);
|
||||||
for (i = 0; i < blockp.length; i++) {
|
var i = void 0;
|
||||||
|
var j = 0;
|
||||||
|
while (chunk ? ct.length >= block_size : ct.length) {
|
||||||
|
var decblock = cipherfn.encrypt(blockp);
|
||||||
|
blockp = ct;
|
||||||
|
for (i = 0; i < block_size; i++) {
|
||||||
plaintext[j++] = blockp[i] ^ decblock[i];
|
plaintext[j++] = blockp[i] ^ decblock[i];
|
||||||
}
|
}
|
||||||
pos++;
|
ct = ct.subarray(block_size);
|
||||||
}
|
}
|
||||||
|
return plaintext.subarray(0, j);
|
||||||
|
};
|
||||||
|
|
||||||
return _context.abrupt('return', plaintext);
|
return _context.abrupt('return', _webStreamTools2.default.transform(ciphertext, process, process));
|
||||||
|
|
||||||
case 15:
|
case 10:
|
||||||
case 'end':
|
case 'end':
|
||||||
return _context.stop();
|
return _context.stop();
|
||||||
}
|
}
|
||||||
|
@ -31950,10 +31976,7 @@ function aesEncrypt(algo, key, pt, iv) {
|
||||||
// Web Crypto
|
// Web Crypto
|
||||||
return webEncrypt(algo, key, pt, iv);
|
return webEncrypt(algo, key, pt, iv);
|
||||||
}
|
}
|
||||||
if (nodeCrypto) {
|
// asm.js fallback
|
||||||
// Node crypto library.
|
|
||||||
return nodeEncrypt(algo, key, pt, iv);
|
|
||||||
} // asm.js fallback
|
|
||||||
var cfb = new _cfb.AES_CFB(key, iv);
|
var cfb = new _cfb.AES_CFB(key, iv);
|
||||||
return _webStreamTools2.default.transform(pt, function (value) {
|
return _webStreamTools2.default.transform(pt, function (value) {
|
||||||
return cfb.AES_Encrypt_process(value);
|
return cfb.AES_Encrypt_process(value);
|
||||||
|
@ -31963,10 +31986,6 @@ function aesEncrypt(algo, key, pt, iv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function aesDecrypt(algo, key, ct, iv) {
|
function aesDecrypt(algo, key, ct, iv) {
|
||||||
if (nodeCrypto) {
|
|
||||||
// Node crypto library.
|
|
||||||
return nodeDecrypt(algo, key, ct, iv);
|
|
||||||
}
|
|
||||||
if (_util2.default.isStream(ct)) {
|
if (_util2.default.isStream(ct)) {
|
||||||
var cfb = new _cfb.AES_CFB(key, iv);
|
var cfb = new _cfb.AES_CFB(key, iv);
|
||||||
return _webStreamTools2.default.transform(ct, function (value) {
|
return _webStreamTools2.default.transform(ct, function (value) {
|
||||||
|
@ -31987,7 +32006,7 @@ function xorMut(a, b) {
|
||||||
function nodeEncrypt(algo, key, pt, iv) {
|
function nodeEncrypt(algo, key, pt, iv) {
|
||||||
key = Buffer.from(key);
|
key = Buffer.from(key);
|
||||||
iv = Buffer.from(iv);
|
iv = Buffer.from(iv);
|
||||||
var cipherObj = new nodeCrypto.createCipheriv('aes-' + algo.substr(3, 3) + '-cfb', key, iv);
|
var cipherObj = new nodeCrypto.createCipheriv(nodeAlgos[algo], key, iv);
|
||||||
return _webStreamTools2.default.transform(pt, function (value) {
|
return _webStreamTools2.default.transform(pt, function (value) {
|
||||||
return new Uint8Array(cipherObj.update(Buffer.from(value)));
|
return new Uint8Array(cipherObj.update(Buffer.from(value)));
|
||||||
});
|
});
|
||||||
|
@ -31996,7 +32015,7 @@ function nodeEncrypt(algo, key, pt, iv) {
|
||||||
function nodeDecrypt(algo, key, ct, iv) {
|
function nodeDecrypt(algo, key, ct, iv) {
|
||||||
key = Buffer.from(key);
|
key = Buffer.from(key);
|
||||||
iv = Buffer.from(iv);
|
iv = Buffer.from(iv);
|
||||||
var decipherObj = new nodeCrypto.createDecipheriv('aes-' + algo.substr(3, 3) + '-cfb', key, iv);
|
var decipherObj = new nodeCrypto.createDecipheriv(nodeAlgos[algo], key, iv);
|
||||||
return _webStreamTools2.default.transform(ct, function (value) {
|
return _webStreamTools2.default.transform(ct, function (value) {
|
||||||
return new Uint8Array(decipherObj.update(Buffer.from(value)));
|
return new Uint8Array(decipherObj.update(Buffer.from(value)));
|
||||||
});
|
});
|
||||||
|
@ -32251,7 +32270,7 @@ function BF(key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BF.keySize = BF.prototype.keySize = 16;
|
BF.keySize = BF.prototype.keySize = 16;
|
||||||
BF.blockSize = BF.prototype.blockSize = 16;
|
BF.blockSize = BF.prototype.blockSize = 8;
|
||||||
|
|
||||||
exports.default = BF;
|
exports.default = BF;
|
||||||
|
|
||||||
|
@ -54536,7 +54555,7 @@ SecretKey.prototype.encrypt = function () {
|
||||||
|
|
||||||
case 33:
|
case 33:
|
||||||
this.keyMaterial = _context.sent;
|
this.keyMaterial = _context.sent;
|
||||||
_context.next = 49;
|
_context.next = 51;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 36:
|
case 36:
|
||||||
|
@ -54554,12 +54573,16 @@ SecretKey.prototype.encrypt = function () {
|
||||||
_context.t6 = [_context.t4, _context.t5];
|
_context.t6 = [_context.t4, _context.t5];
|
||||||
_context.t7 = _context.t3.concatUint8Array.call(_context.t3, _context.t6);
|
_context.t7 = _context.t3.concatUint8Array.call(_context.t3, _context.t6);
|
||||||
_context.t8 = this.iv;
|
_context.t8 = this.iv;
|
||||||
this.keyMaterial = _context.t0.encrypt.call(_context.t0, _context.t1, _context.t2, _context.t7, _context.t8);
|
_context.next = 50;
|
||||||
|
return _context.t0.encrypt.call(_context.t0, _context.t1, _context.t2, _context.t7, _context.t8);
|
||||||
case 49:
|
|
||||||
return _context.abrupt('return', true);
|
|
||||||
|
|
||||||
case 50:
|
case 50:
|
||||||
|
this.keyMaterial = _context.sent;
|
||||||
|
|
||||||
|
case 51:
|
||||||
|
return _context.abrupt('return', true);
|
||||||
|
|
||||||
|
case 52:
|
||||||
case 'end':
|
case 'end':
|
||||||
return _context.stop();
|
return _context.stop();
|
||||||
}
|
}
|
||||||
|
|
4
dist/compat/openpgp.min.js
vendored
4
dist/compat/openpgp.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/compat/openpgp.worker.min.js
vendored
2
dist/compat/openpgp.worker.min.js
vendored
|
@ -1,2 +1,2 @@
|
||||||
/*! OpenPGP.js v4.8.1 - 2020-01-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
|
/*! OpenPGP.js v4.9.0 - 2020-02-02 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
|
||||||
!function(){return function e(n,t,r){function o(i,s){if(!t[i]){if(!n[i]){var u="function"==typeof require&&require;if(!s&&u)return u(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var f=t[i]={exports:{}};n[i][0].call(f.exports,function(e){return o(n[i][1][e]||e)},f,f.exports,e,n,t,r)}return t[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}}()({1:[function(e,n,t){(function(e){importScripts("openpgp.min.js");var n=e.openpgp,t=[],r=6e4;n.crypto.random.randomBuffer.init(r,function(){return t.length||self.postMessage({event:"request-seed",amount:r}),new Promise(function(e){t.push(e)})}),self.onmessage=function(e){var r,s=e.data||{};switch(s.event){case"configure":r=s.config,Object.keys(r).forEach(function(e){n.config[e]=r[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));n.crypto.random.randomBuffer.set(e)}(s.buf);var u=t;t=[];for(var c=0;c<u.length;c++)u[c]();break;default:!function(e,t,r){if("clear-key-cache"===t)return Array.from(o.values()).forEach(e=>{e.isPrivate()&&e.clearPrivateParams()}),o.clear(),void i({id:e,event:"method-return"});if("function"!=typeof n[t])return void i({id:e,event:"method-return",err:"Unknown Worker Event"});n.util.restoreStreams(r),(r=n.packet.clone.parseClonedPackets(r,t)).publicKeys&&(r.publicKeys=r.publicKeys.map(a));r.privateKeys&&(r.privateKeys=r.privateKeys.map(a));n[t](r).then(function(t){i({id:e,event:"method-return",data:n.packet.clone.clonePackets(t)})}).catch(function(t){n.util.print_debug_error(t),i({id:e,event:"method-return",err:t.message,stack:t.stack})})}(s.id,s.event,s.options||{})}};const o=new Map;function a(e){const n=e.armor();return o.has(n)?o.get(n):(o.set(n,e),e)}function i(e){self.postMessage(e,n.util.getTransferables(e.data,!0))}postMessage({event:"loaded"})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
|
!function(){return function e(n,t,r){function o(i,s){if(!t[i]){if(!n[i]){var u="function"==typeof require&&require;if(!s&&u)return u(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var f=t[i]={exports:{}};n[i][0].call(f.exports,function(e){return o(n[i][1][e]||e)},f,f.exports,e,n,t,r)}return t[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}}()({1:[function(e,n,t){(function(e){importScripts("openpgp.min.js");var n=e.openpgp,t=[],r=6e4;n.crypto.random.randomBuffer.init(r,function(){return t.length||self.postMessage({event:"request-seed",amount:r}),new Promise(function(e){t.push(e)})}),self.onmessage=function(e){var r,s=e.data||{};switch(s.event){case"configure":r=s.config,Object.keys(r).forEach(function(e){n.config[e]=r[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));n.crypto.random.randomBuffer.set(e)}(s.buf);var u=t;t=[];for(var c=0;c<u.length;c++)u[c]();break;default:!function(e,t,r){if("clear-key-cache"===t)return Array.from(o.values()).forEach(e=>{e.isPrivate()&&e.clearPrivateParams()}),o.clear(),void i({id:e,event:"method-return"});if("function"!=typeof n[t])return void i({id:e,event:"method-return",err:"Unknown Worker Event"});n.util.restoreStreams(r),(r=n.packet.clone.parseClonedPackets(r,t)).publicKeys&&(r.publicKeys=r.publicKeys.map(a));r.privateKeys&&(r.privateKeys=r.privateKeys.map(a));n[t](r).then(function(t){i({id:e,event:"method-return",data:n.packet.clone.clonePackets(t)})}).catch(function(t){n.util.print_debug_error(t),i({id:e,event:"method-return",err:t.message,stack:t.stack})})}(s.id,s.event,s.options||{})}};const o=new Map;function a(e){const n=e.armor();return o.has(n)?o.get(n):(o.set(n,e),e)}function i(e){self.postMessage(e,n.util.getTransferables(e.data,!0))}postMessage({event:"loaded"})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
|
88
dist/lightweight/openpgp.js
vendored
88
dist/lightweight/openpgp.js
vendored
|
@ -20663,7 +20663,7 @@ exports.default = {
|
||||||
* @memberof module:config
|
* @memberof module:config
|
||||||
* @property {String} versionstring A version string to be included in armored messages
|
* @property {String} versionstring A version string to be included in armored messages
|
||||||
*/
|
*/
|
||||||
versionstring: "OpenPGP.js v4.8.1",
|
versionstring: "OpenPGP.js v4.9.0",
|
||||||
/**
|
/**
|
||||||
* @memberof module:config
|
* @memberof module:config
|
||||||
* @property {String} commentstring A comment string to be included in armored messages
|
* @property {String} commentstring A comment string to be included in armored messages
|
||||||
|
@ -20979,8 +20979,25 @@ const webCrypto = _util2.default.getWebCrypto(); // Modified by ProtonTech AG
|
||||||
const nodeCrypto = _util2.default.getNodeCrypto();
|
const nodeCrypto = _util2.default.getNodeCrypto();
|
||||||
const Buffer = _util2.default.getNodeBuffer();
|
const Buffer = _util2.default.getNodeBuffer();
|
||||||
|
|
||||||
|
const knownAlgos = nodeCrypto ? nodeCrypto.getCiphers() : [];
|
||||||
|
const nodeAlgos = {
|
||||||
|
idea: knownAlgos.includes('idea-cfb') ? 'idea-cfb' : undefined, /* Unused, not implemented */
|
||||||
|
'3des': knownAlgos.includes('des-ede3-cfb') ? 'des-ede3-cfb' : undefined,
|
||||||
|
tripledes: knownAlgos.includes('des-ede3-cfb') ? 'des-ede3-cfb' : undefined,
|
||||||
|
cast5: knownAlgos.includes('cast5-cfb') ? 'cast5-cfb' : undefined,
|
||||||
|
blowfish: knownAlgos.includes('bf-cfb') ? 'bf-cfb' : undefined,
|
||||||
|
aes128: knownAlgos.includes('aes-128-cfb') ? 'aes-128-cfb' : undefined,
|
||||||
|
aes192: knownAlgos.includes('aes-192-cfb') ? 'aes-192-cfb' : undefined,
|
||||||
|
aes256: knownAlgos.includes('aes-256-cfb') ? 'aes-256-cfb' : undefined
|
||||||
|
/* twofish is not implemented in OpenSSL */
|
||||||
|
};
|
||||||
|
|
||||||
exports.default = {
|
exports.default = {
|
||||||
encrypt: function encrypt(algo, key, plaintext, iv) {
|
encrypt: function encrypt(algo, key, plaintext, iv) {
|
||||||
|
if (_util2.default.getNodeCrypto() && nodeAlgos[algo]) {
|
||||||
|
// Node crypto library.
|
||||||
|
return nodeEncrypt(algo, key, plaintext, iv);
|
||||||
|
}
|
||||||
if (algo.substr(0, 3) === 'aes') {
|
if (algo.substr(0, 3) === 'aes') {
|
||||||
return aesEncrypt(algo, key, plaintext, iv);
|
return aesEncrypt(algo, key, plaintext, iv);
|
||||||
}
|
}
|
||||||
|
@ -20988,52 +21005,60 @@ exports.default = {
|
||||||
const cipherfn = new _cipher2.default[algo](key);
|
const cipherfn = new _cipher2.default[algo](key);
|
||||||
const block_size = cipherfn.blockSize;
|
const block_size = cipherfn.blockSize;
|
||||||
|
|
||||||
let blocki = new Uint8Array(block_size);
|
|
||||||
const blockc = iv.slice();
|
const blockc = iv.slice();
|
||||||
let pos = 0;
|
let pt = new Uint8Array();
|
||||||
const ciphertext = new Uint8Array(plaintext.length);
|
const process = chunk => {
|
||||||
|
if (chunk) {
|
||||||
|
pt = _util2.default.concatUint8Array([pt, chunk]);
|
||||||
|
}
|
||||||
|
const ciphertext = new Uint8Array(pt.length);
|
||||||
let i;
|
let i;
|
||||||
let j = 0;
|
let j = 0;
|
||||||
|
while (chunk ? pt.length >= block_size : pt.length) {
|
||||||
while (plaintext.length > block_size * pos) {
|
|
||||||
const encblock = cipherfn.encrypt(blockc);
|
const encblock = cipherfn.encrypt(blockc);
|
||||||
blocki = plaintext.subarray(pos * block_size, pos * block_size + block_size);
|
for (i = 0; i < block_size; i++) {
|
||||||
for (i = 0; i < blocki.length; i++) {
|
blockc[i] = pt[i] ^ encblock[i];
|
||||||
blockc[i] = blocki[i] ^ encblock[i];
|
|
||||||
ciphertext[j++] = blockc[i];
|
ciphertext[j++] = blockc[i];
|
||||||
}
|
}
|
||||||
pos++;
|
pt = pt.subarray(block_size);
|
||||||
}
|
}
|
||||||
return ciphertext;
|
return ciphertext.subarray(0, j);
|
||||||
|
};
|
||||||
|
return _webStreamTools2.default.transform(plaintext, process, process);
|
||||||
},
|
},
|
||||||
|
|
||||||
decrypt: async function decrypt(algo, key, ciphertext, iv) {
|
decrypt: async function decrypt(algo, key, ciphertext, iv) {
|
||||||
|
if (_util2.default.getNodeCrypto() && nodeAlgos[algo]) {
|
||||||
|
// Node crypto library.
|
||||||
|
return nodeDecrypt(algo, key, ciphertext, iv);
|
||||||
|
}
|
||||||
if (algo.substr(0, 3) === 'aes') {
|
if (algo.substr(0, 3) === 'aes') {
|
||||||
return aesDecrypt(algo, key, ciphertext, iv);
|
return aesDecrypt(algo, key, ciphertext, iv);
|
||||||
}
|
}
|
||||||
|
|
||||||
ciphertext = await _webStreamTools2.default.readToEnd(ciphertext);
|
|
||||||
|
|
||||||
const cipherfn = new _cipher2.default[algo](key);
|
const cipherfn = new _cipher2.default[algo](key);
|
||||||
const block_size = cipherfn.blockSize;
|
const block_size = cipherfn.blockSize;
|
||||||
|
|
||||||
let blockp = iv;
|
let blockp = iv;
|
||||||
let pos = 0;
|
let ct = new Uint8Array();
|
||||||
const plaintext = new Uint8Array(ciphertext.length);
|
const process = chunk => {
|
||||||
const offset = 0;
|
if (chunk) {
|
||||||
|
ct = _util2.default.concatUint8Array([ct, chunk]);
|
||||||
|
}
|
||||||
|
const plaintext = new Uint8Array(ct.length);
|
||||||
let i;
|
let i;
|
||||||
let j = 0;
|
let j = 0;
|
||||||
|
while (chunk ? ct.length >= block_size : ct.length) {
|
||||||
while (ciphertext.length > block_size * pos) {
|
|
||||||
const decblock = cipherfn.encrypt(blockp);
|
const decblock = cipherfn.encrypt(blockp);
|
||||||
blockp = ciphertext.subarray(pos * block_size + offset, pos * block_size + block_size + offset);
|
blockp = ct;
|
||||||
for (i = 0; i < blockp.length; i++) {
|
for (i = 0; i < block_size; i++) {
|
||||||
plaintext[j++] = blockp[i] ^ decblock[i];
|
plaintext[j++] = blockp[i] ^ decblock[i];
|
||||||
}
|
}
|
||||||
pos++;
|
ct = ct.subarray(block_size);
|
||||||
}
|
}
|
||||||
|
return plaintext.subarray(0, j);
|
||||||
return plaintext;
|
};
|
||||||
|
return _webStreamTools2.default.transform(ciphertext, process, process);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21045,19 +21070,12 @@ function aesEncrypt(algo, key, pt, iv) {
|
||||||
// Web Crypto
|
// Web Crypto
|
||||||
return webEncrypt(algo, key, pt, iv);
|
return webEncrypt(algo, key, pt, iv);
|
||||||
}
|
}
|
||||||
if (nodeCrypto) {
|
// asm.js fallback
|
||||||
// Node crypto library.
|
|
||||||
return nodeEncrypt(algo, key, pt, iv);
|
|
||||||
} // asm.js fallback
|
|
||||||
const cfb = new _cfb.AES_CFB(key, iv);
|
const cfb = new _cfb.AES_CFB(key, iv);
|
||||||
return _webStreamTools2.default.transform(pt, value => cfb.AES_Encrypt_process(value), () => cfb.AES_Encrypt_finish());
|
return _webStreamTools2.default.transform(pt, value => cfb.AES_Encrypt_process(value), () => cfb.AES_Encrypt_finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
function aesDecrypt(algo, key, ct, iv) {
|
function aesDecrypt(algo, key, ct, iv) {
|
||||||
if (nodeCrypto) {
|
|
||||||
// Node crypto library.
|
|
||||||
return nodeDecrypt(algo, key, ct, iv);
|
|
||||||
}
|
|
||||||
if (_util2.default.isStream(ct)) {
|
if (_util2.default.isStream(ct)) {
|
||||||
const cfb = new _cfb.AES_CFB(key, iv);
|
const cfb = new _cfb.AES_CFB(key, iv);
|
||||||
return _webStreamTools2.default.transform(ct, value => cfb.AES_Decrypt_process(value), () => cfb.AES_Decrypt_finish());
|
return _webStreamTools2.default.transform(ct, value => cfb.AES_Decrypt_process(value), () => cfb.AES_Decrypt_finish());
|
||||||
|
@ -21085,14 +21103,14 @@ async function webEncrypt(algo, key, pt, iv) {
|
||||||
function nodeEncrypt(algo, key, pt, iv) {
|
function nodeEncrypt(algo, key, pt, iv) {
|
||||||
key = Buffer.from(key);
|
key = Buffer.from(key);
|
||||||
iv = Buffer.from(iv);
|
iv = Buffer.from(iv);
|
||||||
const cipherObj = new nodeCrypto.createCipheriv('aes-' + algo.substr(3, 3) + '-cfb', key, iv);
|
const cipherObj = new nodeCrypto.createCipheriv(nodeAlgos[algo], key, iv);
|
||||||
return _webStreamTools2.default.transform(pt, value => new Uint8Array(cipherObj.update(Buffer.from(value))));
|
return _webStreamTools2.default.transform(pt, value => new Uint8Array(cipherObj.update(Buffer.from(value))));
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodeDecrypt(algo, key, ct, iv) {
|
function nodeDecrypt(algo, key, ct, iv) {
|
||||||
key = Buffer.from(key);
|
key = Buffer.from(key);
|
||||||
iv = Buffer.from(iv);
|
iv = Buffer.from(iv);
|
||||||
const decipherObj = new nodeCrypto.createDecipheriv('aes-' + algo.substr(3, 3) + '-cfb', key, iv);
|
const decipherObj = new nodeCrypto.createDecipheriv(nodeAlgos[algo], key, iv);
|
||||||
return _webStreamTools2.default.transform(ct, value => new Uint8Array(decipherObj.update(Buffer.from(value))));
|
return _webStreamTools2.default.transform(ct, value => new Uint8Array(decipherObj.update(Buffer.from(value))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21345,7 +21363,7 @@ function BF(key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BF.keySize = BF.prototype.keySize = 16;
|
BF.keySize = BF.prototype.keySize = 16;
|
||||||
BF.blockSize = BF.prototype.blockSize = 16;
|
BF.blockSize = BF.prototype.blockSize = 8;
|
||||||
|
|
||||||
exports.default = BF;
|
exports.default = BF;
|
||||||
|
|
||||||
|
@ -35207,7 +35225,7 @@ SecretKey.prototype.encrypt = async function (passphrase) {
|
||||||
this.keyMaterial = await modeInstance.encrypt(cleartext, this.iv.subarray(0, mode.ivLength), new Uint8Array());
|
this.keyMaterial = await modeInstance.encrypt(cleartext, this.iv.subarray(0, mode.ivLength), new Uint8Array());
|
||||||
} else {
|
} else {
|
||||||
this.s2k_usage = 254;
|
this.s2k_usage = 254;
|
||||||
this.keyMaterial = _crypto2.default.cfb.encrypt(this.symmetric, key, _util2.default.concatUint8Array([cleartext, await _crypto2.default.hash.sha1(cleartext)]), this.iv);
|
this.keyMaterial = await _crypto2.default.cfb.encrypt(this.symmetric, key, _util2.default.concatUint8Array([cleartext, await _crypto2.default.hash.sha1(cleartext)]), this.iv);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
4
dist/lightweight/openpgp.min.js
vendored
4
dist/lightweight/openpgp.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/lightweight/openpgp.worker.min.js
vendored
2
dist/lightweight/openpgp.worker.min.js
vendored
|
@ -1,2 +1,2 @@
|
||||||
/*! OpenPGP.js v4.8.1 - 2020-01-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
|
/*! OpenPGP.js v4.9.0 - 2020-02-02 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
|
||||||
!function(){return function e(n,t,r){function o(i,s){if(!t[i]){if(!n[i]){var u="function"==typeof require&&require;if(!s&&u)return u(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var f=t[i]={exports:{}};n[i][0].call(f.exports,function(e){return o(n[i][1][e]||e)},f,f.exports,e,n,t,r)}return t[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}}()({1:[function(e,n,t){(function(e){importScripts("openpgp.min.js");var n=e.openpgp,t=[],r=6e4;n.crypto.random.randomBuffer.init(r,function(){return t.length||self.postMessage({event:"request-seed",amount:r}),new Promise(function(e){t.push(e)})}),self.onmessage=function(e){var r,s=e.data||{};switch(s.event){case"configure":r=s.config,Object.keys(r).forEach(function(e){n.config[e]=r[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));n.crypto.random.randomBuffer.set(e)}(s.buf);var u=t;t=[];for(var c=0;c<u.length;c++)u[c]();break;default:!function(e,t,r){if("clear-key-cache"===t)return Array.from(o.values()).forEach(e=>{e.isPrivate()&&e.clearPrivateParams()}),o.clear(),void i({id:e,event:"method-return"});if("function"!=typeof n[t])return void i({id:e,event:"method-return",err:"Unknown Worker Event"});n.util.restoreStreams(r),(r=n.packet.clone.parseClonedPackets(r,t)).publicKeys&&(r.publicKeys=r.publicKeys.map(a));r.privateKeys&&(r.privateKeys=r.privateKeys.map(a));n[t](r).then(function(t){i({id:e,event:"method-return",data:n.packet.clone.clonePackets(t)})}).catch(function(t){n.util.print_debug_error(t),i({id:e,event:"method-return",err:t.message,stack:t.stack})})}(s.id,s.event,s.options||{})}};const o=new Map;function a(e){const n=e.armor();return o.has(n)?o.get(n):(o.set(n,e),e)}function i(e){self.postMessage(e,n.util.getTransferables(e.data,!0))}postMessage({event:"loaded"})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
|
!function(){return function e(n,t,r){function o(i,s){if(!t[i]){if(!n[i]){var u="function"==typeof require&&require;if(!s&&u)return u(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var f=t[i]={exports:{}};n[i][0].call(f.exports,function(e){return o(n[i][1][e]||e)},f,f.exports,e,n,t,r)}return t[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}}()({1:[function(e,n,t){(function(e){importScripts("openpgp.min.js");var n=e.openpgp,t=[],r=6e4;n.crypto.random.randomBuffer.init(r,function(){return t.length||self.postMessage({event:"request-seed",amount:r}),new Promise(function(e){t.push(e)})}),self.onmessage=function(e){var r,s=e.data||{};switch(s.event){case"configure":r=s.config,Object.keys(r).forEach(function(e){n.config[e]=r[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));n.crypto.random.randomBuffer.set(e)}(s.buf);var u=t;t=[];for(var c=0;c<u.length;c++)u[c]();break;default:!function(e,t,r){if("clear-key-cache"===t)return Array.from(o.values()).forEach(e=>{e.isPrivate()&&e.clearPrivateParams()}),o.clear(),void i({id:e,event:"method-return"});if("function"!=typeof n[t])return void i({id:e,event:"method-return",err:"Unknown Worker Event"});n.util.restoreStreams(r),(r=n.packet.clone.parseClonedPackets(r,t)).publicKeys&&(r.publicKeys=r.publicKeys.map(a));r.privateKeys&&(r.privateKeys=r.privateKeys.map(a));n[t](r).then(function(t){i({id:e,event:"method-return",data:n.packet.clone.clonePackets(t)})}).catch(function(t){n.util.print_debug_error(t),i({id:e,event:"method-return",err:t.message,stack:t.stack})})}(s.id,s.event,s.options||{})}};const o=new Map;function a(e){const n=e.armor();return o.has(n)?o.get(n):(o.set(n,e),e)}function i(e){self.postMessage(e,n.util.getTransferables(e.data,!0))}postMessage({event:"loaded"})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
|
88
dist/openpgp.js
vendored
88
dist/openpgp.js
vendored
|
@ -25050,7 +25050,7 @@ exports.default = {
|
||||||
* @memberof module:config
|
* @memberof module:config
|
||||||
* @property {String} versionstring A version string to be included in armored messages
|
* @property {String} versionstring A version string to be included in armored messages
|
||||||
*/
|
*/
|
||||||
versionstring: "OpenPGP.js v4.8.1",
|
versionstring: "OpenPGP.js v4.9.0",
|
||||||
/**
|
/**
|
||||||
* @memberof module:config
|
* @memberof module:config
|
||||||
* @property {String} commentstring A comment string to be included in armored messages
|
* @property {String} commentstring A comment string to be included in armored messages
|
||||||
|
@ -25366,8 +25366,25 @@ const webCrypto = _util2.default.getWebCrypto(); // Modified by ProtonTech AG
|
||||||
const nodeCrypto = _util2.default.getNodeCrypto();
|
const nodeCrypto = _util2.default.getNodeCrypto();
|
||||||
const Buffer = _util2.default.getNodeBuffer();
|
const Buffer = _util2.default.getNodeBuffer();
|
||||||
|
|
||||||
|
const knownAlgos = nodeCrypto ? nodeCrypto.getCiphers() : [];
|
||||||
|
const nodeAlgos = {
|
||||||
|
idea: knownAlgos.includes('idea-cfb') ? 'idea-cfb' : undefined, /* Unused, not implemented */
|
||||||
|
'3des': knownAlgos.includes('des-ede3-cfb') ? 'des-ede3-cfb' : undefined,
|
||||||
|
tripledes: knownAlgos.includes('des-ede3-cfb') ? 'des-ede3-cfb' : undefined,
|
||||||
|
cast5: knownAlgos.includes('cast5-cfb') ? 'cast5-cfb' : undefined,
|
||||||
|
blowfish: knownAlgos.includes('bf-cfb') ? 'bf-cfb' : undefined,
|
||||||
|
aes128: knownAlgos.includes('aes-128-cfb') ? 'aes-128-cfb' : undefined,
|
||||||
|
aes192: knownAlgos.includes('aes-192-cfb') ? 'aes-192-cfb' : undefined,
|
||||||
|
aes256: knownAlgos.includes('aes-256-cfb') ? 'aes-256-cfb' : undefined
|
||||||
|
/* twofish is not implemented in OpenSSL */
|
||||||
|
};
|
||||||
|
|
||||||
exports.default = {
|
exports.default = {
|
||||||
encrypt: function encrypt(algo, key, plaintext, iv) {
|
encrypt: function encrypt(algo, key, plaintext, iv) {
|
||||||
|
if (_util2.default.getNodeCrypto() && nodeAlgos[algo]) {
|
||||||
|
// Node crypto library.
|
||||||
|
return nodeEncrypt(algo, key, plaintext, iv);
|
||||||
|
}
|
||||||
if (algo.substr(0, 3) === 'aes') {
|
if (algo.substr(0, 3) === 'aes') {
|
||||||
return aesEncrypt(algo, key, plaintext, iv);
|
return aesEncrypt(algo, key, plaintext, iv);
|
||||||
}
|
}
|
||||||
|
@ -25375,52 +25392,60 @@ exports.default = {
|
||||||
const cipherfn = new _cipher2.default[algo](key);
|
const cipherfn = new _cipher2.default[algo](key);
|
||||||
const block_size = cipherfn.blockSize;
|
const block_size = cipherfn.blockSize;
|
||||||
|
|
||||||
let blocki = new Uint8Array(block_size);
|
|
||||||
const blockc = iv.slice();
|
const blockc = iv.slice();
|
||||||
let pos = 0;
|
let pt = new Uint8Array();
|
||||||
const ciphertext = new Uint8Array(plaintext.length);
|
const process = chunk => {
|
||||||
|
if (chunk) {
|
||||||
|
pt = _util2.default.concatUint8Array([pt, chunk]);
|
||||||
|
}
|
||||||
|
const ciphertext = new Uint8Array(pt.length);
|
||||||
let i;
|
let i;
|
||||||
let j = 0;
|
let j = 0;
|
||||||
|
while (chunk ? pt.length >= block_size : pt.length) {
|
||||||
while (plaintext.length > block_size * pos) {
|
|
||||||
const encblock = cipherfn.encrypt(blockc);
|
const encblock = cipherfn.encrypt(blockc);
|
||||||
blocki = plaintext.subarray(pos * block_size, pos * block_size + block_size);
|
for (i = 0; i < block_size; i++) {
|
||||||
for (i = 0; i < blocki.length; i++) {
|
blockc[i] = pt[i] ^ encblock[i];
|
||||||
blockc[i] = blocki[i] ^ encblock[i];
|
|
||||||
ciphertext[j++] = blockc[i];
|
ciphertext[j++] = blockc[i];
|
||||||
}
|
}
|
||||||
pos++;
|
pt = pt.subarray(block_size);
|
||||||
}
|
}
|
||||||
return ciphertext;
|
return ciphertext.subarray(0, j);
|
||||||
|
};
|
||||||
|
return _webStreamTools2.default.transform(plaintext, process, process);
|
||||||
},
|
},
|
||||||
|
|
||||||
decrypt: async function decrypt(algo, key, ciphertext, iv) {
|
decrypt: async function decrypt(algo, key, ciphertext, iv) {
|
||||||
|
if (_util2.default.getNodeCrypto() && nodeAlgos[algo]) {
|
||||||
|
// Node crypto library.
|
||||||
|
return nodeDecrypt(algo, key, ciphertext, iv);
|
||||||
|
}
|
||||||
if (algo.substr(0, 3) === 'aes') {
|
if (algo.substr(0, 3) === 'aes') {
|
||||||
return aesDecrypt(algo, key, ciphertext, iv);
|
return aesDecrypt(algo, key, ciphertext, iv);
|
||||||
}
|
}
|
||||||
|
|
||||||
ciphertext = await _webStreamTools2.default.readToEnd(ciphertext);
|
|
||||||
|
|
||||||
const cipherfn = new _cipher2.default[algo](key);
|
const cipherfn = new _cipher2.default[algo](key);
|
||||||
const block_size = cipherfn.blockSize;
|
const block_size = cipherfn.blockSize;
|
||||||
|
|
||||||
let blockp = iv;
|
let blockp = iv;
|
||||||
let pos = 0;
|
let ct = new Uint8Array();
|
||||||
const plaintext = new Uint8Array(ciphertext.length);
|
const process = chunk => {
|
||||||
const offset = 0;
|
if (chunk) {
|
||||||
|
ct = _util2.default.concatUint8Array([ct, chunk]);
|
||||||
|
}
|
||||||
|
const plaintext = new Uint8Array(ct.length);
|
||||||
let i;
|
let i;
|
||||||
let j = 0;
|
let j = 0;
|
||||||
|
while (chunk ? ct.length >= block_size : ct.length) {
|
||||||
while (ciphertext.length > block_size * pos) {
|
|
||||||
const decblock = cipherfn.encrypt(blockp);
|
const decblock = cipherfn.encrypt(blockp);
|
||||||
blockp = ciphertext.subarray(pos * block_size + offset, pos * block_size + block_size + offset);
|
blockp = ct;
|
||||||
for (i = 0; i < blockp.length; i++) {
|
for (i = 0; i < block_size; i++) {
|
||||||
plaintext[j++] = blockp[i] ^ decblock[i];
|
plaintext[j++] = blockp[i] ^ decblock[i];
|
||||||
}
|
}
|
||||||
pos++;
|
ct = ct.subarray(block_size);
|
||||||
}
|
}
|
||||||
|
return plaintext.subarray(0, j);
|
||||||
return plaintext;
|
};
|
||||||
|
return _webStreamTools2.default.transform(ciphertext, process, process);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25432,19 +25457,12 @@ function aesEncrypt(algo, key, pt, iv) {
|
||||||
// Web Crypto
|
// Web Crypto
|
||||||
return webEncrypt(algo, key, pt, iv);
|
return webEncrypt(algo, key, pt, iv);
|
||||||
}
|
}
|
||||||
if (nodeCrypto) {
|
// asm.js fallback
|
||||||
// Node crypto library.
|
|
||||||
return nodeEncrypt(algo, key, pt, iv);
|
|
||||||
} // asm.js fallback
|
|
||||||
const cfb = new _cfb.AES_CFB(key, iv);
|
const cfb = new _cfb.AES_CFB(key, iv);
|
||||||
return _webStreamTools2.default.transform(pt, value => cfb.AES_Encrypt_process(value), () => cfb.AES_Encrypt_finish());
|
return _webStreamTools2.default.transform(pt, value => cfb.AES_Encrypt_process(value), () => cfb.AES_Encrypt_finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
function aesDecrypt(algo, key, ct, iv) {
|
function aesDecrypt(algo, key, ct, iv) {
|
||||||
if (nodeCrypto) {
|
|
||||||
// Node crypto library.
|
|
||||||
return nodeDecrypt(algo, key, ct, iv);
|
|
||||||
}
|
|
||||||
if (_util2.default.isStream(ct)) {
|
if (_util2.default.isStream(ct)) {
|
||||||
const cfb = new _cfb.AES_CFB(key, iv);
|
const cfb = new _cfb.AES_CFB(key, iv);
|
||||||
return _webStreamTools2.default.transform(ct, value => cfb.AES_Decrypt_process(value), () => cfb.AES_Decrypt_finish());
|
return _webStreamTools2.default.transform(ct, value => cfb.AES_Decrypt_process(value), () => cfb.AES_Decrypt_finish());
|
||||||
|
@ -25472,14 +25490,14 @@ async function webEncrypt(algo, key, pt, iv) {
|
||||||
function nodeEncrypt(algo, key, pt, iv) {
|
function nodeEncrypt(algo, key, pt, iv) {
|
||||||
key = Buffer.from(key);
|
key = Buffer.from(key);
|
||||||
iv = Buffer.from(iv);
|
iv = Buffer.from(iv);
|
||||||
const cipherObj = new nodeCrypto.createCipheriv('aes-' + algo.substr(3, 3) + '-cfb', key, iv);
|
const cipherObj = new nodeCrypto.createCipheriv(nodeAlgos[algo], key, iv);
|
||||||
return _webStreamTools2.default.transform(pt, value => new Uint8Array(cipherObj.update(Buffer.from(value))));
|
return _webStreamTools2.default.transform(pt, value => new Uint8Array(cipherObj.update(Buffer.from(value))));
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodeDecrypt(algo, key, ct, iv) {
|
function nodeDecrypt(algo, key, ct, iv) {
|
||||||
key = Buffer.from(key);
|
key = Buffer.from(key);
|
||||||
iv = Buffer.from(iv);
|
iv = Buffer.from(iv);
|
||||||
const decipherObj = new nodeCrypto.createDecipheriv('aes-' + algo.substr(3, 3) + '-cfb', key, iv);
|
const decipherObj = new nodeCrypto.createDecipheriv(nodeAlgos[algo], key, iv);
|
||||||
return _webStreamTools2.default.transform(ct, value => new Uint8Array(decipherObj.update(Buffer.from(value))));
|
return _webStreamTools2.default.transform(ct, value => new Uint8Array(decipherObj.update(Buffer.from(value))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25732,7 +25750,7 @@ function BF(key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BF.keySize = BF.prototype.keySize = 16;
|
BF.keySize = BF.prototype.keySize = 16;
|
||||||
BF.blockSize = BF.prototype.blockSize = 16;
|
BF.blockSize = BF.prototype.blockSize = 8;
|
||||||
|
|
||||||
exports.default = BF;
|
exports.default = BF;
|
||||||
|
|
||||||
|
@ -39594,7 +39612,7 @@ SecretKey.prototype.encrypt = async function (passphrase) {
|
||||||
this.keyMaterial = await modeInstance.encrypt(cleartext, this.iv.subarray(0, mode.ivLength), new Uint8Array());
|
this.keyMaterial = await modeInstance.encrypt(cleartext, this.iv.subarray(0, mode.ivLength), new Uint8Array());
|
||||||
} else {
|
} else {
|
||||||
this.s2k_usage = 254;
|
this.s2k_usage = 254;
|
||||||
this.keyMaterial = _crypto2.default.cfb.encrypt(this.symmetric, key, _util2.default.concatUint8Array([cleartext, await _crypto2.default.hash.sha1(cleartext)]), this.iv);
|
this.keyMaterial = await _crypto2.default.cfb.encrypt(this.symmetric, key, _util2.default.concatUint8Array([cleartext, await _crypto2.default.hash.sha1(cleartext)]), this.iv);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
4
dist/openpgp.min.js
vendored
4
dist/openpgp.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/openpgp.worker.min.js
vendored
2
dist/openpgp.worker.min.js
vendored
|
@ -1,2 +1,2 @@
|
||||||
/*! OpenPGP.js v4.8.1 - 2020-01-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
|
/*! OpenPGP.js v4.9.0 - 2020-02-02 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
|
||||||
!function(){return function e(n,t,r){function o(i,s){if(!t[i]){if(!n[i]){var u="function"==typeof require&&require;if(!s&&u)return u(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var f=t[i]={exports:{}};n[i][0].call(f.exports,function(e){return o(n[i][1][e]||e)},f,f.exports,e,n,t,r)}return t[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}}()({1:[function(e,n,t){(function(e){importScripts("openpgp.min.js");var n=e.openpgp,t=[],r=6e4;n.crypto.random.randomBuffer.init(r,function(){return t.length||self.postMessage({event:"request-seed",amount:r}),new Promise(function(e){t.push(e)})}),self.onmessage=function(e){var r,s=e.data||{};switch(s.event){case"configure":r=s.config,Object.keys(r).forEach(function(e){n.config[e]=r[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));n.crypto.random.randomBuffer.set(e)}(s.buf);var u=t;t=[];for(var c=0;c<u.length;c++)u[c]();break;default:!function(e,t,r){if("clear-key-cache"===t)return Array.from(o.values()).forEach(e=>{e.isPrivate()&&e.clearPrivateParams()}),o.clear(),void i({id:e,event:"method-return"});if("function"!=typeof n[t])return void i({id:e,event:"method-return",err:"Unknown Worker Event"});n.util.restoreStreams(r),(r=n.packet.clone.parseClonedPackets(r,t)).publicKeys&&(r.publicKeys=r.publicKeys.map(a));r.privateKeys&&(r.privateKeys=r.privateKeys.map(a));n[t](r).then(function(t){i({id:e,event:"method-return",data:n.packet.clone.clonePackets(t)})}).catch(function(t){n.util.print_debug_error(t),i({id:e,event:"method-return",err:t.message,stack:t.stack})})}(s.id,s.event,s.options||{})}};const o=new Map;function a(e){const n=e.armor();return o.has(n)?o.get(n):(o.set(n,e),e)}function i(e){self.postMessage(e,n.util.getTransferables(e.data,!0))}postMessage({event:"loaded"})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
|
!function(){return function e(n,t,r){function o(i,s){if(!t[i]){if(!n[i]){var u="function"==typeof require&&require;if(!s&&u)return u(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var f=t[i]={exports:{}};n[i][0].call(f.exports,function(e){return o(n[i][1][e]||e)},f,f.exports,e,n,t,r)}return t[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}}()({1:[function(e,n,t){(function(e){importScripts("openpgp.min.js");var n=e.openpgp,t=[],r=6e4;n.crypto.random.randomBuffer.init(r,function(){return t.length||self.postMessage({event:"request-seed",amount:r}),new Promise(function(e){t.push(e)})}),self.onmessage=function(e){var r,s=e.data||{};switch(s.event){case"configure":r=s.config,Object.keys(r).forEach(function(e){n.config[e]=r[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));n.crypto.random.randomBuffer.set(e)}(s.buf);var u=t;t=[];for(var c=0;c<u.length;c++)u[c]();break;default:!function(e,t,r){if("clear-key-cache"===t)return Array.from(o.values()).forEach(e=>{e.isPrivate()&&e.clearPrivateParams()}),o.clear(),void i({id:e,event:"method-return"});if("function"!=typeof n[t])return void i({id:e,event:"method-return",err:"Unknown Worker Event"});n.util.restoreStreams(r),(r=n.packet.clone.parseClonedPackets(r,t)).publicKeys&&(r.publicKeys=r.publicKeys.map(a));r.privateKeys&&(r.privateKeys=r.privateKeys.map(a));n[t](r).then(function(t){i({id:e,event:"method-return",data:n.packet.clone.clonePackets(t)})}).catch(function(t){n.util.print_debug_error(t),i({id:e,event:"method-return",err:t.message,stack:t.stack})})}(s.id,s.event,s.options||{})}};const o=new Map;function a(e){const n=e.armor();return o.has(n)?o.get(n):(o.set(n,e),e)}function i(e){self.postMessage(e,n.util.getTransferables(e.data,!0))}postMessage({event:"loaded"})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);
|
2
npm-shrinkwrap.json
generated
2
npm-shrinkwrap.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "openpgp",
|
"name": "openpgp",
|
||||||
"version": "4.8.1",
|
"version": "4.9.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "openpgp",
|
"name": "openpgp",
|
||||||
"description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
|
"description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
|
||||||
"version": "4.8.1",
|
"version": "4.9.0",
|
||||||
"license": "LGPL-3.0+",
|
"license": "LGPL-3.0+",
|
||||||
"homepage": "https://openpgpjs.org/",
|
"homepage": "https://openpgpjs.org/",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user