Fall back to js crypto in case native RSA keygen fails
This commit is contained in:
parent
d38fc07578
commit
eedb722d7b
|
@ -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": "0.8.1",
|
"version": "0.8.2",
|
||||||
"homepage": "http://openpgpjs.org/",
|
"homepage": "http://openpgpjs.org/",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8"
|
"node": ">=0.8"
|
||||||
|
|
|
@ -240,7 +240,19 @@ function generateKeyPair(options) {
|
||||||
result.publicKeyArmored = newKey.toPublic().armor();
|
result.publicKeyArmored = newKey.toPublic().armor();
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}, 'Error generating keypair!');
|
}).catch(function(err) {
|
||||||
|
console.error(err);
|
||||||
|
|
||||||
|
if (!util.getWebCrypto()) {
|
||||||
|
// js fallback already tried
|
||||||
|
throw new Error('Error generating keypair using js fallback!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// fall back to js keygen in a worker
|
||||||
|
console.log('Error generating keypair using native WebCrypto... falling back back to js!');
|
||||||
|
return asyncProxy.generateKeyPair(options);
|
||||||
|
|
||||||
|
}).catch(onError.bind(null, 'Error generating keypair!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue
Block a user