OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/webcrypto/shared_crypto.h" | 5 #include "content/child/webcrypto/shared_crypto.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1178 ImportKeyJwkFromDict(dict, aes_cbc_algorithm, false, 0, &key)); | 1178 ImportKeyJwkFromDict(dict, aes_cbc_algorithm, false, 0, &key)); |
1179 EXPECT_EQ(0, key.usages()); | 1179 EXPECT_EQ(0, key.usages()); |
1180 | 1180 |
1181 // Test each key_ops value translates to the correct Web Crypto value. | 1181 // Test each key_ops value translates to the correct Web Crypto value. |
1182 struct TestCase { | 1182 struct TestCase { |
1183 const char* jwk_key_op; | 1183 const char* jwk_key_op; |
1184 const char* jwk_alg; | 1184 const char* jwk_alg; |
1185 const blink::WebCryptoAlgorithm algorithm; | 1185 const blink::WebCryptoAlgorithm algorithm; |
1186 const blink::WebCryptoKeyUsage usage; | 1186 const blink::WebCryptoKeyUsage usage; |
1187 }; | 1187 }; |
1188 // TODO(padolph): Add 'deriveBits' key_ops value once it is supported. | |
Ryan Sleevi
2014/05/13 05:52:25
Seems like there's still a need for a test
eroman
2014/05/13 20:05:13
I will leave the TODO. It is not currently testabl
| |
1189 const TestCase test_case[] = { | 1188 const TestCase test_case[] = { |
1190 {"encrypt", "A128CBC", aes_cbc_algorithm, | 1189 {"encrypt", "A128CBC", aes_cbc_algorithm, |
1191 blink::WebCryptoKeyUsageEncrypt}, | 1190 blink::WebCryptoKeyUsageEncrypt}, |
1192 {"decrypt", "A128CBC", aes_cbc_algorithm, | 1191 {"decrypt", "A128CBC", aes_cbc_algorithm, |
1193 blink::WebCryptoKeyUsageDecrypt}, | 1192 blink::WebCryptoKeyUsageDecrypt}, |
1194 {"sign", "HS256", hmac_algorithm, blink::WebCryptoKeyUsageSign}, | 1193 {"sign", "HS256", hmac_algorithm, blink::WebCryptoKeyUsageSign}, |
1195 {"verify", "HS256", hmac_algorithm, blink::WebCryptoKeyUsageVerify}, | 1194 {"verify", "HS256", hmac_algorithm, blink::WebCryptoKeyUsageVerify}, |
1196 {"wrapKey", "A128KW", aes_kw_algorithm, blink::WebCryptoKeyUsageWrapKey}, | 1195 {"wrapKey", "A128KW", aes_kw_algorithm, blink::WebCryptoKeyUsageWrapKey}, |
1197 {"unwrapKey", "A128KW", aes_kw_algorithm, | 1196 {"unwrapKey", "A128KW", aes_kw_algorithm, |
1198 blink::WebCryptoKeyUsageUnwrapKey}, | 1197 blink::WebCryptoKeyUsageUnwrapKey}, |
(...skipping 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3419 algorithm, | 3418 algorithm, |
3420 CreateAesCbcAlgorithm(std::vector<uint8>(0, 16)), | 3419 CreateAesCbcAlgorithm(std::vector<uint8>(0, 16)), |
3421 true, | 3420 true, |
3422 blink::WebCryptoKeyUsageEncrypt, | 3421 blink::WebCryptoKeyUsageEncrypt, |
3423 &unwrapped_key)); | 3422 &unwrapped_key)); |
3424 } | 3423 } |
3425 | 3424 |
3426 } // namespace webcrypto | 3425 } // namespace webcrypto |
3427 | 3426 |
3428 } // namespace content | 3427 } // namespace content |
OLD | NEW |