feat(rsa): add fallback pure js fallback for webcrypto-ossl

This commit is contained in:
Friedel Ziegelmayer
2016-11-29 17:54:41 +01:00
parent 6d15450438
commit 148d16ab25
7 changed files with 326 additions and 230 deletions

View File

@ -17,7 +17,7 @@ class RsaPublicKey {
}
marshal () {
return crypto.jwkToPkix(this._key)
return crypto.utils.jwkToPkix(this._key)
}
get bytes () {
@ -71,7 +71,7 @@ class RsaPrivateKey {
}
marshal () {
return crypto.jwkToPkcs1(this._key)
return crypto.utils.jwkToPkcs1(this._key)
}
get bytes () {
@ -92,7 +92,7 @@ class RsaPrivateKey {
}
function unmarshalRsaPrivateKey (bytes, callback) {
const jwk = crypto.pkcs1ToJwk(bytes)
const jwk = crypto.utils.pkcs1ToJwk(bytes)
crypto.unmarshalPrivateKey(jwk, (err, keys) => {
if (err) {
return callback(err)
@ -103,7 +103,7 @@ function unmarshalRsaPrivateKey (bytes, callback) {
}
function unmarshalRsaPublicKey (bytes) {
const jwk = crypto.pkixToJwk(bytes)
const jwk = crypto.utils.pkixToJwk(bytes)
return new RsaPublicKey(jwk)
}