| 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 242db07a23a1c52fb866cd4840eee4510fae7294..13f5735bcc1c4354b3b8c19c6a5e9cc882af4dd7 100644
|
| --- a/content/child/webcrypto/platform_crypto_nss.cc
|
| +++ b/content/child/webcrypto/platform_crypto_nss.cc
|
| @@ -542,6 +542,10 @@ Status DoUnwrapSymKeyAesKw(const CryptoData& wrapped_key_data,
|
| return Status::Success();
|
| }
|
|
|
| +void CopySECItemToVector(const SECItem& item, std::vector<uint8>* out) {
|
| + out->assign(item.data, item.data + item.len);
|
| +}
|
| +
|
| // From PKCS#1 [http://tools.ietf.org/html/rfc3447]:
|
| //
|
| // RSAPrivateKey ::= SEQUENCE {
|
| @@ -795,6 +799,20 @@ Status ExportKeySpki(PublicKey* key, blink::WebArrayBuffer* buffer) {
|
| return Status::Success();
|
| }
|
|
|
| +Status ExportRsaPublicKey(PublicKey* key,
|
| + std::vector<uint8>* modulus,
|
| + std::vector<uint8>* public_exponent) {
|
| + DCHECK(key);
|
| + DCHECK(key->key());
|
| + if (key->key()->keyType != rsaKey)
|
| + return Status::ErrorUnsupported();
|
| + CopySECItemToVector(key->key()->u.rsa.modulus, modulus);
|
| + CopySECItemToVector(key->key()->u.rsa.publicExponent, public_exponent);
|
| + if (modulus->empty() || public_exponent->empty())
|
| + return Status::ErrorUnexpected();
|
| + return Status::Success();
|
| +}
|
| +
|
| Status ExportKeyPkcs8(PrivateKey* key,
|
| const blink::WebCryptoKeyAlgorithm& key_algorithm,
|
| blink::WebArrayBuffer* buffer) {
|
|
|