v1.2.14: use try/catch on PEM import
This commit is contained in:
parent
5dc3795a17
commit
48bee9204d
10
keypairs.js
10
keypairs.js
|
@ -346,10 +346,14 @@ Enc.bufToUrlBase64 = function (buf) {
|
||||||
// For 'rsa-compat' module only
|
// For 'rsa-compat' module only
|
||||||
// PLEASE do not use these sync methods, they are deprecated
|
// PLEASE do not use these sync methods, they are deprecated
|
||||||
Keypairs._importSync = function (opts) {
|
Keypairs._importSync = function (opts) {
|
||||||
if ('RSA' === opts.jwk.kty) {
|
try {
|
||||||
return Rasha.importSync(opts);
|
|
||||||
} else {
|
|
||||||
return Eckles.importSync(opts);
|
return Eckles.importSync(opts);
|
||||||
|
} catch(e) {
|
||||||
|
try {
|
||||||
|
return Rasha.importSync(opts);
|
||||||
|
} catch(e) {
|
||||||
|
console.error("options.pem does not appear to be a valid RSA or ECDSA public or private key");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// PLEASE do not use these, they are deprecated
|
// PLEASE do not use these, they are deprecated
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "keypairs",
|
"name": "keypairs",
|
||||||
"version": "1.2.13",
|
"version": "1.2.14",
|
||||||
"description": "Lightweight RSA/ECDSA keypair generation and JWK <-> PEM using node's native RSA and ECDSA support",
|
"description": "Lightweight RSA/ECDSA keypair generation and JWK <-> PEM using node's native RSA and ECDSA support",
|
||||||
"main": "keypairs.js",
|
"main": "keypairs.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|
Loading…
Reference in New Issue