mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
serialize private key to pkcs8 format
This commit is contained in:
parent
14e290c489
commit
ed9d26fd1b
@ -183,14 +183,15 @@ angular
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var privateKey = forge.pki.privateKeyToAsn1(keypair.privateKey);
|
var privateKeyAsn1 = forge.pki.privateKeyToAsn1(keypair.privateKey);
|
||||||
var privateKeyBytes = forge.asn1.toDer(privateKey).getBytes();
|
var privateKeyPkcs8 = forge.pki.wrapRsaPrivateKey(privateKeyAsn1);
|
||||||
var privateKeyEnc = _service.encrypt(privateKeyBytes, key, 'raw');
|
var privateKeyBytes = forge.asn1.toDer(privateKeyPkcs8).getBytes();
|
||||||
|
var privateKeyEncBytes = _service.encrypt(privateKeyBytes, key, 'raw');
|
||||||
|
|
||||||
var publicKey = forge.pki.publicKeyToAsn1(keypair.publicKey);
|
var publicKeyAsn1 = forge.pki.publicKeyToAsn1(keypair.publicKey);
|
||||||
var publicKeyBytes = forge.asn1.toDer(publicKey).getBytes();
|
var publicKeyBytes = forge.asn1.toDer(publicKeyAsn1).getBytes();
|
||||||
|
|
||||||
callback(forge.util.encode64(publicKeyBytes), privateKeyEnc, null);
|
callback(forge.util.encode64(publicKeyBytes), privateKeyEncBytes, null);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user