Index: content/child/webcrypto/test/rsa_ssa_unittest.cc |
diff --git a/content/child/webcrypto/test/rsa_ssa_unittest.cc b/content/child/webcrypto/test/rsa_ssa_unittest.cc |
index 1733ae78e3a9ce92aef0d0e05bb9d6edd9f4399b..6c86139932421e43dbaba7d6f95adc381da2aed0 100644 |
--- a/content/child/webcrypto/test/rsa_ssa_unittest.cc |
+++ b/content/child/webcrypto/test/rsa_ssa_unittest.cc |
@@ -823,6 +823,27 @@ TEST(WebCryptoRsaSsaTest, GenerateKeyPairEmptyUsages) { |
true, 0, &public_key, &private_key)); |
} |
+TEST(WebCryptoRsaSsaTest, ImportKeyEmptyUsages) { |
eroman
2014/12/09 21:04:46
Could you also add the same sort of test to ecdh_u
Habib Virji
2014/12/15 18:48:55
Added test.
|
+ blink::WebCryptoKey key; |
+ // Public without usage does not throw error. |
+ ASSERT_EQ(Status::Success(), |
+ ImportKey(blink::WebCryptoKeyFormatSpki, |
+ CryptoData(HexStringToBytes(kPublicKeySpkiDerHex)), |
+ CreateRsaHashedImportAlgorithm( |
+ blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
+ blink::WebCryptoAlgorithmIdSha256), |
+ true, 0, &key)); |
+ // Private key usage will generate error. |
eroman
2014/12/09 21:04:46
Could you add two more tests for JWK:
(1) Import
Habib Virji
2014/12/15 18:48:55
Done. Have done export key and import key as jwk.
|
+ ASSERT_EQ(Status::ErrorImportKeyEmptyUsages(), |
+ ImportKey(blink::WebCryptoKeyFormatPkcs8, |
+ CryptoData(HexStringToBytes(kPrivateKeyPkcs8DerHex)), |
+ CreateRsaHashedImportAlgorithm( |
+ blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5, |
+ blink::WebCryptoAlgorithmIdSha1), |
+ true, 0, &key)); |
+ |
+} |
+ |
TEST(WebCryptoRsaSsaTest, ImportExportJwkRsaPublicKey) { |
struct TestCase { |
const blink::WebCryptoAlgorithmId hash; |