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 #ifndef CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ |
6 #define CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ |
7 | 7 |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Returns empty vector on failure. | 91 // Returns empty vector on failure. |
92 std::vector<uint8_t> GetBytesFromHexString(base::DictionaryValue* dict, | 92 std::vector<uint8_t> GetBytesFromHexString(base::DictionaryValue* dict, |
93 const char* property_name); | 93 const char* property_name); |
94 | 94 |
95 // Reads a string property with path "property_name" and converts it to a | 95 // Reads a string property with path "property_name" and converts it to a |
96 // WebCryptoAlgorith. Returns null algorithm on failure. | 96 // WebCryptoAlgorith. Returns null algorithm on failure. |
97 blink::WebCryptoAlgorithm GetDigestAlgorithm(base::DictionaryValue* dict, | 97 blink::WebCryptoAlgorithm GetDigestAlgorithm(base::DictionaryValue* dict, |
98 const char* property_name); | 98 const char* property_name); |
99 | 99 |
100 // Returns true if any of the vectors in the input list have identical content. | 100 // Returns true if any of the vectors in the input list have identical content. |
101 // Dumb O(n^2) implementation but should be fast enough for the input sizes that | |
102 // are used. | |
103 bool CopiesExist(const std::vector<std::vector<uint8_t> >& bufs); | 101 bool CopiesExist(const std::vector<std::vector<uint8_t> >& bufs); |
104 | 102 |
105 blink::WebCryptoAlgorithm CreateAesKeyGenAlgorithm( | 103 blink::WebCryptoAlgorithm CreateAesKeyGenAlgorithm( |
106 blink::WebCryptoAlgorithmId aes_alg_id, | 104 blink::WebCryptoAlgorithmId aes_alg_id, |
107 unsigned short length); | 105 unsigned short length); |
108 | 106 |
109 // The following key pair is comprised of the SPKI (public key) and PKCS#8 | 107 // The following key pair is comprised of the SPKI (public key) and PKCS#8 |
110 // (private key) representations of the key pair provided in Example 1 of the | 108 // (private key) representations of the key pair provided in Example 1 of the |
111 // NIST test vectors at | 109 // NIST test vectors at |
112 // ftp://ftp.rsa.com/pub/rsalabs/tmp/pkcs1v15sign-vectors.txt | 110 // ftp://ftp.rsa.com/pub/rsalabs/tmp/pkcs1v15sign-vectors.txt |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 int key_len_bits, | 168 int key_len_bits, |
171 const blink::WebCryptoAlgorithm& import_algorithm, | 169 const blink::WebCryptoAlgorithm& import_algorithm, |
172 blink::WebCryptoKeyUsageMask usages, | 170 blink::WebCryptoKeyUsageMask usages, |
173 const std::string& jwk_alg); | 171 const std::string& jwk_alg); |
174 | 172 |
175 } // namespace webcrypto | 173 } // namespace webcrypto |
176 | 174 |
177 } // namesapce content | 175 } // namesapce content |
178 | 176 |
179 #endif // CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ | 177 #endif // CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ |
OLD | NEW |