cleanup / bugfix 'keypair._forge && ...'

This commit is contained in:
AJ ONeal 2016-08-01 09:50:46 -04:00
parent d84d8ce94c
commit ce365e9248
3 changed files with 8 additions and 8 deletions

View File

@ -110,7 +110,7 @@ var extrac = module.exports = {
, exportPrivateJwk: function (keypair) {
var hasUrsaPrivate = keypair._ursa && true;
var hasPrivatePem = keypair.privateKeyPem && true;
var hasForgePrivate = keypair._forge && keypair._forge && true;
var hasForgePrivate = keypair._forge && true;
if (keypair.privateKeyJwk) {
return keypair.privateKeyJwk;
@ -126,7 +126,7 @@ var extrac = module.exports = {
}
}
if (keypair._forge && keypair._forge) {
if (keypair._forge) {
return extrac._forgeToPrivateJwk(keypair);
}
@ -159,7 +159,7 @@ var extrac = module.exports = {
}
}
if (keypair._forge && keypair._forge) {
if (keypair._forge) {
return extrac._forgeToPublicJwk(keypair);
}

View File

@ -132,11 +132,11 @@ var forgec = module.exports = {
return keypair.privateKeyPem;
}
if (keypair.privateKeyJwk && !(keypair._forge && keypair._forge)) {
if (keypair.privateKeyJwk && !keypair._forge) {
forgec._forgeImportJwk(keypair);
}
if (keypair._forge && keypair._forge) {
if (keypair._forge) {
return forge.pki.privateKeyToPem(keypair._forge);
}
@ -148,7 +148,7 @@ var forgec = module.exports = {
}
if ((keypair.privateKeyJwk || keypair.publicKeyJwk)
&& !(keypair._forge && (keypair._forge || keypair._forgePublic))
&& !(keypair._forge || keypair._forgePublic)
) {
forgec._forgeImportPublicJwk(keypair);
}

View File

@ -87,13 +87,13 @@ function create(deps) {
RSA.import = function (keypair/*, options*/) {
//options = options || NOBJ; // ignore
if (keypair.privateKeyJwk || keypair.privateKeyPem || keypair._ursa || (keypair._forge && keypair._forge)) {
if (keypair.privateKeyJwk || keypair.privateKeyPem || keypair._ursa || keypair._forge) {
keypair.privateKeyJwk = RSA._internal.exportPrivateJwk(keypair, { internal: true });
//keypair.privateKeyPem = RSA._internal.exportPrivatePem(keypair, { internal: true });
return keypair;
}
if (keypair.publicKeyJwk || keypair.publicKeyPem || keypair._ursaPublic || (keypair._forge && keypair._forgePublic)) {
if (keypair.publicKeyJwk || keypair.publicKeyPem || keypair._ursaPublic || keypair._forgePublic) {
keypair.publicKeyJwk = RSA._internal.exportPublicJwk(keypair, { internal: true });
//keypair.publicKeyPem = RSA._internal.exportPublicPem(keypair, { internal: true });
return keypair;