8000 Release new version · javascriptit/openpgpjs@9ad3647 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ad3647

Browse files
author
Tankred Hase
committed
Release new version
1 parent dfc15e4 commit 9ad3647

File tree

5 files changed

+43
-27
lines changed

5 files changed

+43
-27
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openpgp",
3-
"version": "0.10.3",
3+
"version": "0.11.0",
44
"homepage": "http://openpgpjs.org/",
55
"authors": [
66
"OpenPGP Development Team <list@openpgpjs.org> (https://github.com/openpgpjs/openpgpjs/graphs/contributors)"

dist/openpgp.js

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ module.exports = {
992992

993993
show_version: true,
994994
show_comment: true,
995-
versionstring: "OpenPGP.js v0.10.3",
995+
versionstring: "OpenPGP.js v0.11.0",
996996
commentstring: "http://openpgpjs.org",
997997

998998
keyserver: "keyserver.linux.it", // "pgp.mit.edu:11371"
@@ -9079,7 +9079,6 @@ function RSA() {
90799079

90809080
function generate(B, E) {
90819081
var webCrypto = util.getWebCrypto();
9082-
var promise;
90839082

90849083
//
90859084
// Native RSA keygen using Web Crypto
@@ -9088,22 +9087,41 @@ function RSA() {
90889087
if (webCrypto) {
90899088
var Euint32 = new Uint32Array([parseInt(E, 16)]); // get integer of exponent
90909089
var Euint8 = new Uint8Array(Euint32.buffer); // get bytes of exponent
9091-
var keyGenOpt = {
9092-
name: 'RSASSA-PKCS1-v1_5',
9093-
modulusLength: B, // the specified keysize in bits
9094-
publicExponent: Euint8.subarray(0, 3), // take three bytes (max 65537)
9095-
hash: {
9096-
name: 'SHA-1' // not required for actual RSA keys, but for crypto api 'sign' and 'verify'
9097-
}
9098-
};
9099-
promise = webCrypto.generateKey(keyGenOpt, true, ['sign', 'verify']);
9100-
return promise.then(exportKey).then(decodeKey);
9090+
var keyGenOpt;
9091+
9092+
if (window.crypto.subtle) {
9093+
// current standard spec
9094+
keyGenOpt = {
9095+
name: 'RSASSA-PKCS1-v1_5',
9096+
modulusLength: B, // the specified keysize in bits
9097+
publicExponent: Euint8.subarray(0, 3), // take three bytes (max 65537)
9098+
hash: {
9099+
name: 'SHA-1' // not required for actual RSA keys, but for crypto api 'sign' and 'verify'
9100+
}
9101+
};
9102+
return webCrypto.generateKey(keyGenOpt, true, ['sign', 'verify']).then(exportKey).then(decodeKey);
9103+
9104+
} else if (window.crypto.webkitSubtle) {
9105+
// outdated spec implemented by Webkit
9106+
keyGenOpt = {
9107+
name: 'RSA-OAEP',
9108+
modulusLength: B, // the specified keysize in bits
9109+
publicExponent: Euint8.subarray(0, 3), // take three bytes (max 65537)
9110+
};
9111+
return webCrypto.generateKey(keyGenOpt, true, ['encrypt', 'decrypt']).then(exportKey).then(function(key) {
9112+
if (key instanceof ArrayBuffer) {
9113+
// parse raw ArrayBuffer bytes to jwk/json (WebKit/Safari quirk)
9114+
return decodeKey(JSON.parse(String.fromCharCode.apply(null, new Uint8Array(key))));
9115+
}
9116+
return decodeKey(key);
9117+
});
9118+
}
91019119
}
91029120

9103-
function exportKey(key) {
9121+
function exportKey(keypair) {
91049122
// export the generated keys as JsonWebKey (JWK)
91059123
// https://tools.ietf.org/html/draft-ietf-jose-json-web-key-33
9106-
return webCrypto.exportKey('jwk', key.privateKey);
9124+
return webCrypto.exportKey('jwk', keypair.privateKey);
91079125
}
91089126

91099127
function decodeKey(jwk) {
@@ -9129,7 +9147,7 @@ function RSA() {
91299147
// JS code
91309148
//
91319149

9132-
promise = new Promise(function(resolve) {
9150+
return new Promise(function(resolve) {
91339151
var key = new keyObject();
91349152
var rng = new SecureRandom();
91359153
var qs = B >> 1;
@@ -9167,8 +9185,6 @@ function RSA() {
91679185

91689186
resolve(key);
91699187
});
9170-
9171-
return promise;
91729188
}
91739189

91749190
this.encrypt = encrypt;
@@ -16196,8 +16212,8 @@ module.exports = {
1619616212
return;
1619716213
}
1619816214

16199-
if (typeof window !== 'undefined' && window.crypto && window.crypto.subtle) {
16200-
return window.crypto.subtle;
16215+
if (typeof window !== 'undefined' && window.crypto) {
16216+
return window.crypto.subtle || window.crypto.webkitSubtle;
1620116217
}
1620216218
}
1620316219
};

dist/openpgp.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/openpgp.worker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "openpgp",
33
"description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
4-
"version": "0.10.3",
4+
"version": "0.11.0",
55
"homepage": "http://openpgpjs.org/",
66
"engines": {
77
"node": ">=0.8"

0 commit comments

Comments
 (0)
0