Chromium Code Reviews| Index: content/child/webcrypto/platform_crypto_nss.cc |
| diff --git a/content/child/webcrypto/platform_crypto_nss.cc b/content/child/webcrypto/platform_crypto_nss.cc |
| index 478c7aaff73fbb6c873cdcab6465c6de80a146ec..f44cd7172e36644db24ff1c65b31be276413ab62 100644 |
| --- a/content/child/webcrypto/platform_crypto_nss.cc |
| +++ b/content/child/webcrypto/platform_crypto_nss.cc |
| @@ -695,6 +695,30 @@ Status ExportKeySpki(PublicKey* key, blink::WebArrayBuffer* buffer) { |
| return Status::Success(); |
| } |
| +Status ExportRsaPublicKey(PublicKey* key, |
| + blink::WebArrayBuffer* modulus, |
| + blink::WebArrayBuffer* public_exponent) { |
| + DCHECK(key); |
| + DCHECK(key->key()); |
| + |
| + if (key->key()->keyType != rsaKey) |
| + return Status::ErrorUnsupported(); |
| + |
| + SECItem modulus_item = key->key()->u.rsa.modulus; |
| + DCHECK(modulus_item.data); |
|
eroman
2014/03/21 02:30:51
Do these need to be proper returns?
padolph
2014/03/24 04:24:06
Yes.
|
| + DCHECK(modulus_item.len); |
| + |
| + SECItem public_exponent_item = key->key()->u.rsa.publicExponent; |
| + DCHECK(public_exponent_item.data); |
| + DCHECK(public_exponent_item.len); |
| + |
| + *modulus = CreateArrayBuffer(modulus_item.data, modulus_item.len); |
| + *public_exponent = |
| + CreateArrayBuffer(public_exponent_item.data, public_exponent_item.len); |
| + |
| + return Status::Success(); |
| +} |
| + |
| Status ImportKeyPkcs8(const blink::WebCryptoAlgorithm& algorithm, |
| const CryptoData& key_data, |
| bool extractable, |