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..ea803e9c97306bf97a747e88a2237a5eddfc76b2 100644 |
--- a/content/child/webcrypto/test/aes_cbc_unittest.cc |
+++ b/content/child/webcrypto/test/aes_cbc_unittest.cc |
@@ -199,6 +199,16 @@ TEST(WebCryptoAesCbcTest, GenerateKeyBadLength) { |
} |
} |
+TEST(WebCryptoAesCbcTest, ImportKeyEmptyUsage) { |
+ blink::WebCryptoKey key; |
+ std::vector<uint8_t> key_bytes(16); |
+ ASSERT_EQ(Status::ErrorImportEmptyKeyUsage(), |
+ ImportKey(blink::WebCryptoKeyFormatRaw, |
+ CryptoData(key_bytes), |
+ CreateAlgorithm(blink::WebCryptoAlgorithmIdAesCbc), |
+ true, 0, &key)); |
+} |
+ |
// If key_ops is specified but empty, no key usages are allowed for the key. |
TEST(WebCryptoAesCbcTest, ImportKeyJwkEmptyKeyOps) { |
blink::WebCryptoKey key; |
@@ -208,13 +218,6 @@ TEST(WebCryptoAesCbcTest, ImportKeyJwkEmptyKeyOps) { |
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg"); |
dict.Set("key_ops", new base::ListValue); // Takes ownership. |
- EXPECT_EQ(Status::Success(), |
- ImportKeyJwkFromDict( |
- dict, CreateAlgorithm(blink::WebCryptoAlgorithmIdAesCbc), false, |
- 0, &key)); |
- |
- EXPECT_EQ(0, key.usages()); |
- |
// The JWK does not contain encrypt usages. |
EXPECT_EQ(Status::ErrorJwkKeyopsInconsistent(), |
ImportKeyJwkFromDict( |
@@ -524,16 +527,16 @@ TEST(WebCryptoAesCbcTest, WrapUnwrapRoundtripSpkiPkcs8) { |
ASSERT_EQ( |
Status::Success(), |
UnwrapKey(blink::WebCryptoKeyFormatSpki, CryptoData(wrapped_public_key), |
- wrapping_key, wrap_algorithm, rsa_import_algorithm, true, 0, |
- &unwrapped_public_key)); |
+ wrapping_key, wrap_algorithm, rsa_import_algorithm, true, |
+ blink::WebCryptoKeyUsageVerify, &unwrapped_public_key)); |
blink::WebCryptoKey unwrapped_private_key; |
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; |