Skip to content

Commit

Permalink
Release new version
Browse files Browse the repository at this point in the history
  • Loading branch information
twiss committed Jan 24, 2021
1 parent 38ec531 commit 1f237e6
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 72 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openpgp",
"version": "4.10.9",
"version": "4.10.10",
"license": "LGPL-3.0+",
"homepage": "https://openpgpjs.org/",
"authors": [
Expand Down
37 changes: 18 additions & 19 deletions dist/compat/openpgp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! OpenPGP.js v4.10.9 - 2020-12-07 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
/*! OpenPGP.js v4.10.10 - 2021-01-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.openpgp = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
(function (global){
"use strict";
Expand Down Expand Up @@ -28678,7 +28678,7 @@ function modL(r, x) {
carry = 0;
for (j = i - 32, k = i - 12; j < k; ++j) {
x[j] += carry - 16 * x[i] * L[j - (i - 32)];
carry = (x[j] + 128) >> 8;
carry = Math.floor((x[j] + 128) / 256);
x[j] -= carry * 256;
}
x[j] += carry;
Expand Down Expand Up @@ -28779,12 +28779,11 @@ function unpackneg(r, p) {
}

function crypto_sign_open(m, sm, n, pk) {
var i, mlen;
var i;
var t = new Uint8Array(32), h;
var p = [gf(), gf(), gf(), gf()],
q = [gf(), gf(), gf(), gf()];

mlen = -1;
if (n < 64) return -1;

if (unpackneg(q, pk)) return -1;
Expand All @@ -28806,8 +28805,7 @@ function crypto_sign_open(m, sm, n, pk) {
}

for (i = 0; i < n; i++) m[i] = sm[i + 64];
mlen = n;
return mlen;
return n;
}

var crypto_scalarmult_BYTES = 32,
Expand Down Expand Up @@ -31501,7 +31499,7 @@ exports.default = {
* @memberof module:config
* @property {String} versionstring A version string to be included in armored messages
*/
versionstring: "OpenPGP.js v4.10.9",
versionstring: "OpenPGP.js v4.10.10",
/**
* @memberof module:config
* @property {String} commentstring A comment string to be included in armored messages
Expand Down Expand Up @@ -33956,7 +33954,8 @@ exports.default = {
case 18:
_context2.t2 = _context2.sent;
result = new _context2.t1(_context2.t2);
return _context2.abrupt('return', _pkcs2.default.eme.decode(result.toString()));
return _context2.abrupt('return', _pkcs2.default.eme.decode(_util2.default.Uint8Array_to_str(result.toUint8Array('be', _p.byteLength())) // re-introduce leading zeros
));

case 21:
oid = key_params[0];
Expand Down Expand Up @@ -36228,10 +36227,6 @@ hash_headers[11] = [0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
* @returns {String} message, an octet string
*/
eme.decode = function (EM) {
// leading zeros truncated by bn.js
if (EM.charCodeAt(0) !== 0) {
EM = String.fromCharCode(0) + EM;
}
var firstOct = EM.charCodeAt(0);
var secondOct = EM.charCodeAt(1);
var i = 2;
Expand Down Expand Up @@ -36787,8 +36782,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
* @module crypto/public_key/elgamal
*/

var zero = new _bn2.default(0);

exports.default = {
/**
* ElGamal Encryption function
Expand All @@ -36810,10 +36803,11 @@ exports.default = {
mred = m.toRed(redp);
gred = g.toRed(redp);
yred = y.toRed(redp);
// See Section 11.5 here: https://crypto.stanford.edu/~dabo/cryptobook/BonehShoup_0_4.pdf
// OpenPGP uses a "special" version of ElGamal where g is generator of the full group Z/pZ*
// hence g has order p-1, and to avoid that k = 0 mod p-1, we need to pick k in [1, p-2]

_context.next = 6;
return _random2.default.getRandomBN(zero, p);
return _random2.default.getRandomBN(new _bn2.default(1), p.subn(1));

case 6:
k = _context.sent;
Expand Down Expand Up @@ -40883,7 +40877,11 @@ exports.default = {
});
key = { key: pem, padding: nodeCrypto.constants.RSA_PKCS1_PADDING };
}
return _util2.default.Uint8Array_to_str(nodeCrypto.privateDecrypt(key, data));
try {
return _util2.default.Uint8Array_to_str(nodeCrypto.privateDecrypt(key, data));
} catch (err) {
throw new Error('Decryption error');
}
},

bnDecrypt: function () {
Expand Down Expand Up @@ -40946,9 +40944,10 @@ exports.default = {
result = result.redMul(unblinder);
}

return _context15.abrupt('return', _pkcs2.default.eme.decode(new _mpi2.default(result).toString()));
result = new _mpi2.default(result).toUint8Array('be', n.byteLength()); // preserve leading zeros
return _context15.abrupt('return', _pkcs2.default.eme.decode(_util2.default.Uint8Array_to_str(result)));

case 30:
case 31:
case 'end':
return _context15.stop();
}
Expand Down
4 changes: 2 additions & 2 deletions dist/compat/openpgp.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/compat/openpgp.worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! OpenPGP.js v4.10.9 - 2020-12-07 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
/*! OpenPGP.js v4.10.10 - 2021-01-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){
// GPG4Browsers - An OpenPGP implementation in javascript
Expand Down
2 changes: 1 addition & 1 deletion dist/compat/openpgp.worker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 18 additions & 19 deletions dist/lightweight/openpgp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! OpenPGP.js v4.10.9 - 2020-12-07 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
/*! OpenPGP.js v4.10.10 - 2021-01-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.openpgp = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){
"use strict";
Expand Down Expand Up @@ -19145,7 +19145,7 @@ function modL(r, x) {
carry = 0;
for (j = i - 32, k = i - 12; j < k; ++j) {
x[j] += carry - 16 * x[i] * L[j - (i - 32)];
carry = (x[j] + 128) >> 8;
carry = Math.floor((x[j] + 128) / 256);
x[j] -= carry * 256;
}
x[j] += carry;
Expand Down Expand Up @@ -19246,12 +19246,11 @@ function unpackneg(r, p) {
}

function crypto_sign_open(m, sm, n, pk) {
var i, mlen;
var i;
var t = new Uint8Array(32), h;
var p = [gf(), gf(), gf(), gf()],
q = [gf(), gf(), gf(), gf()];

mlen = -1;
if (n < 64) return -1;

if (unpackneg(q, pk)) return -1;
Expand All @@ -19273,8 +19272,7 @@ function crypto_sign_open(m, sm, n, pk) {
}

for (i = 0; i < n; i++) m[i] = sm[i + 64];
mlen = n;
return mlen;
return n;
}

var crypto_scalarmult_BYTES = 32,
Expand Down Expand Up @@ -20673,7 +20671,7 @@ exports.default = {
* @memberof module:config
* @property {String} versionstring A version string to be included in armored messages
*/
versionstring: "OpenPGP.js v4.10.9",
versionstring: "OpenPGP.js v4.10.10",
/**
* @memberof module:config
* @property {String} commentstring A comment string to be included in armored messages
Expand Down Expand Up @@ -22841,8 +22839,9 @@ exports.default = {
const c2 = data_params[1].toBN();
const p = key_params[0].toBN();
const x = key_params[3].toBN();
const result = new _mpi2.default((await _public_key2.default.elgamal.decrypt(c1, c2, p, x)));
return _pkcs2.default.eme.decode(result.toString());
const result = new _mpi2.default((await _public_key2.default.elgamal.decrypt(c1, c2, p, x))); // MPI and BN.js discard any leading zeros
return _pkcs2.default.eme.decode(_util2.default.Uint8Array_to_str(result.toUint8Array('be', p.byteLength())) // re-introduce leading zeros
);
}
case _enums2.default.publicKey.ecdh:
{
Expand Down Expand Up @@ -24366,10 +24365,6 @@ eme.encode = async function (M, k) {
* @returns {String} message, an octet string
*/
eme.decode = function (EM) {
// leading zeros truncated by bn.js
if (EM.charCodeAt(0) !== 0) {
EM = String.fromCharCode(0) + EM;
}
const firstOct = EM.charCodeAt(0);
const secondOct = EM.charCodeAt(1);
let i = 2;
Expand Down Expand Up @@ -24736,8 +24731,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
* @module crypto/public_key/elgamal
*/

const zero = new _bn2.default(0);

exports.default = {
/**
* ElGamal Encryption function
Expand All @@ -24753,8 +24746,9 @@ exports.default = {
const mred = m.toRed(redp);
const gred = g.toRed(redp);
const yred = y.toRed(redp);
// See Section 11.5 here: https://crypto.stanford.edu/~dabo/cryptobook/BonehShoup_0_4.pdf
const k = await _random2.default.getRandomBN(zero, p); // returns in [0, p-1]
// OpenPGP uses a "special" version of ElGamal where g is generator of the full group Z/pZ*
// hence g has order p-1, and to avoid that k = 0 mod p-1, we need to pick k in [1, p-2]
const k = await _random2.default.getRandomBN(new _bn2.default(1), p.subn(1));
return {
c1: gred.redPow(k).fromRed(),
c2: yred.redPow(k).redMul(mred).fromRed()
Expand Down Expand Up @@ -27158,7 +27152,11 @@ exports.default = {
});
key = { key: pem, padding: nodeCrypto.constants.RSA_PKCS1_PADDING };
}
return _util2.default.Uint8Array_to_str(nodeCrypto.privateDecrypt(key, data));
try {
return _util2.default.Uint8Array_to_str(nodeCrypto.privateDecrypt(key, data));
} catch (err) {
throw new Error('Decryption error');
}
},

bnDecrypt: async function bnDecrypt(data, n, e, d, p, q, u) {
Expand Down Expand Up @@ -27197,7 +27195,8 @@ exports.default = {
result = result.redMul(unblinder);
}

return _pkcs2.default.eme.decode(new _mpi2.default(result).toString());
result = new _mpi2.default(result).toUint8Array('be', n.byteLength()); // preserve leading zeros
return _pkcs2.default.eme.decode(_util2.default.Uint8Array_to_str(result));
},

prime: _prime2.default
Expand Down
4 changes: 2 additions & 2 deletions dist/lightweight/openpgp.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lightweight/openpgp.worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! OpenPGP.js v4.10.9 - 2020-12-07 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
/*! OpenPGP.js v4.10.10 - 2021-01-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){
// GPG4Browsers - An OpenPGP implementation in javascript
Expand Down
2 changes: 1 addition & 1 deletion dist/lightweight/openpgp.worker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1f237e6

Please sign in to comment.