Index: content/child/webcrypto/test/aes_cbc_unittest.cc |
diff --git a/content/child/webcrypto/test/aes_cbc_unittest.cc b/content/child/webcrypto/test/aes_cbc_unittest.cc |
index c6fe95dab2617a1777f6e5e875902b0dade28e8c..3eb9877b3906226b8ca5bcb32c5ffd6469790815 100644 |
--- a/content/child/webcrypto/test/aes_cbc_unittest.cc |
+++ b/content/child/webcrypto/test/aes_cbc_unittest.cc |
@@ -265,7 +265,7 @@ TEST(WebCryptoAesCbcTest, GenerateKeyIsRandom) { |
GenerateSecretKey( |
CreateAesCbcKeyGenAlgorithm(kKeyLength[key_length_i]), |
true, |
- 0, |
+ blink::WebCryptoKeyUsageEncrypt, |
&key)); |
EXPECT_TRUE(key.handle()); |
EXPECT_EQ(blink::WebCryptoKeyTypeSecret, key.type()); |
@@ -962,6 +962,15 @@ TEST(WebCryptoAesCbcTest, GenerateKeyBadUsages) { |
} |
} |
+// Generate an AES-CBC key with no usages. |
+TEST(WebCryptoAesCbcTest, GenerateKeyEmptyUsages) { |
+ blink::WebCryptoKey key; |
+ |
+ ASSERT_EQ(Status::ErrorCreateKeyBadUsages(), |
+ GenerateSecretKey( |
+ CreateAesCbcKeyGenAlgorithm(128), true, 0, &key)); |
+} |
+ |
// Generate an AES-CBC key and an RSA key pair. Use the AES-CBC key to wrap the |
// key pair (using SPKI format for public key, PKCS8 format for private key). |
// Then unwrap the wrapped key pair and verify that the key data is the same. |
@@ -991,7 +1000,7 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) { |
modulus_length, |
public_exponent), |
true, |
- 0, |
+ blink::WebCryptoKeyUsageSign, |
&public_key, |
&private_key)); |
@@ -1053,7 +1062,7 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) { |
wrap_algorithm, |
rsa_import_algorithm, |
true, |
- 0, |
+ blink::WebCryptoKeyUsageSign, |
&unwrapped_private_key)); |
// Export unwrapped key pair as SPKI + PKCS8 |