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 6814c3580038b58930ab02babcca751e08223660..b62a362acecc8cb13ae0bd3d24ac537e2f03fac9 100644 |
--- a/content/child/webcrypto/test/aes_cbc_unittest.cc |
+++ b/content/child/webcrypto/test/aes_cbc_unittest.cc |
@@ -173,7 +173,7 @@ TEST(WebCryptoAesCbcTest, GenerateKeyIsRandom) { |
ASSERT_EQ(Status::Success(), |
GenerateSecretKey( |
CreateAesCbcKeyGenAlgorithm(kKeyLength[key_length_i]), true, |
- 0, &key)); |
+ blink::WebCryptoKeyUsageEncrypt, &key)); |
EXPECT_TRUE(key.handle()); |
EXPECT_EQ(blink::WebCryptoKeyTypeSecret, key.type()); |
ASSERT_EQ(Status::Success(), |
@@ -463,6 +463,14 @@ TEST(WebCryptoAesCbcTest, GenerateKeyBadUsages) { |
} |
} |
+// Generate an AES-CBC key with no usages. |
+TEST(WebCryptoAesCbcTest, GenerateKeyEmptyUsages) { |
+ blink::WebCryptoKey key; |
+ |
+ ASSERT_EQ(Status::ErrorCreateKeyEmptyUsages(), |
+ 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. |
@@ -489,7 +497,8 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) { |
blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
blink::WebCryptoAlgorithmIdSha256, |
modulus_length, public_exponent), |
- true, 0, &public_key, &private_key)); |
+ true, blink::WebCryptoKeyUsageSign, &public_key, |
+ &private_key)); |
// Export key pair as SPKI + PKCS8 |
std::vector<uint8_t> public_key_spki; |
@@ -532,8 +541,8 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) { |
ASSERT_EQ( |
Status::Success(), |
UnwrapKey(blink::WebCryptoKeyFormatPkcs8, CryptoData(wrapped_private_key), |
- wrapping_key, wrap_algorithm, rsa_import_algorithm, true, 0, |
- &unwrapped_private_key)); |
+ wrapping_key, wrap_algorithm, rsa_import_algorithm, true, |
+ blink::WebCryptoKeyUsageSign, &unwrapped_private_key)); |
// Export unwrapped key pair as SPKI + PKCS8 |
std::vector<uint8_t> unwrapped_public_key_spki; |