| Index: content/child/webcrypto/shared_crypto_unittest.cc
|
| diff --git a/content/child/webcrypto/shared_crypto_unittest.cc b/content/child/webcrypto/shared_crypto_unittest.cc
|
| index 696868e28394dc4f1a2c9a9d707b4ef14f535d8f..258d10856c837342e3480ed70d131424abc643f2 100644
|
| --- a/content/child/webcrypto/shared_crypto_unittest.cc
|
| +++ b/content/child/webcrypto/shared_crypto_unittest.cc
|
| @@ -1895,7 +1895,7 @@ TEST_F(SharedCryptoTest, MAYBE(GenerateKeyPairRsa)) {
|
| CreateRsaKeyGenAlgorithm(blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5,
|
| modulus_length,
|
| public_exponent);
|
| - bool extractable = false;
|
| + bool extractable = true;
|
| const blink::WebCryptoKeyUsageMask usage_mask = 0;
|
| blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull();
|
| blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull();
|
| @@ -1910,6 +1910,36 @@ TEST_F(SharedCryptoTest, MAYBE(GenerateKeyPairRsa)) {
|
| EXPECT_EQ(usage_mask, public_key.usages());
|
| EXPECT_EQ(usage_mask, private_key.usages());
|
|
|
| + // Try exporting the generated key pair, and then re-importing to verify that
|
| + // the exported data was valid.
|
| + blink::WebArrayBuffer public_key_spki;
|
| + EXPECT_STATUS_SUCCESS(
|
| + ExportKey(blink::WebCryptoKeyFormatSpki, public_key, &public_key_spki));
|
| + public_key = blink::WebCryptoKey::createNull();
|
| + EXPECT_STATUS_SUCCESS(
|
| + ImportKey(blink::WebCryptoKeyFormatSpki,
|
| + CryptoData(public_key_spki),
|
| + CreateAlgorithm(blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5),
|
| + true,
|
| + usage_mask,
|
| + &public_key));
|
| + EXPECT_EQ(modulus_length,
|
| + public_key.algorithm().rsaParams()->modulusLengthBits());
|
| +
|
| + blink::WebArrayBuffer private_key_pkcs8;
|
| + EXPECT_STATUS_SUCCESS(ExportKey(
|
| + blink::WebCryptoKeyFormatPkcs8, private_key, &private_key_pkcs8));
|
| + private_key = blink::WebCryptoKey::createNull();
|
| + EXPECT_STATUS_SUCCESS(
|
| + ImportKey(blink::WebCryptoKeyFormatPkcs8,
|
| + CryptoData(private_key_pkcs8),
|
| + CreateAlgorithm(blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5),
|
| + true,
|
| + usage_mask,
|
| + &private_key));
|
| + EXPECT_EQ(modulus_length,
|
| + private_key.algorithm().rsaParams()->modulusLengthBits());
|
| +
|
| // Fail with bad modulus.
|
| algorithm = CreateRsaKeyGenAlgorithm(
|
| blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, 0, public_exponent);
|
|
|