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_RENDERER_WEBCRYPTO_PLATFORM_CRYPTO_H_ | 5 #ifndef CONTENT_RENDERER_WEBCRYPTO_PLATFORM_CRYPTO_H_ |
6 #define CONTENT_RENDERER_WEBCRYPTO_PLATFORM_CRYPTO_H_ | 6 #define CONTENT_RENDERER_WEBCRYPTO_PLATFORM_CRYPTO_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 10 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // * keylen_bytes is non-zero (TODO(eroman): revisit this). | 115 // * keylen_bytes is non-zero (TODO(eroman): revisit this). |
116 // * For AES algorithms |keylen_bytes| is either 16, 24, or 32 bytes long. | 116 // * For AES algorithms |keylen_bytes| is either 16, 24, or 32 bytes long. |
117 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, | 117 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, |
118 bool extractable, | 118 bool extractable, |
119 blink::WebCryptoKeyUsageMask usage_mask, | 119 blink::WebCryptoKeyUsageMask usage_mask, |
120 unsigned keylen_bytes, | 120 unsigned keylen_bytes, |
121 blink::WebCryptoKey* key); | 121 blink::WebCryptoKey* key); |
122 | 122 |
123 // Preconditions: | 123 // Preconditions: |
124 // * algorithm.id() is for an RSA algorithm. | 124 // * algorithm.id() is for an RSA algorithm. |
125 // * algorithm.rsaKeyGenParams() is non-null. | 125 // * public_exponent, modulus_length_bits and hash_or_null are the same as what |
| 126 // is in algorithm. They are split out for convenience. |
| 127 // * hash_or_null.isNull() may be true if a hash is not applicable to the |
| 128 // algorithm |
| 129 // * modulus_length_bits is not 0 |
| 130 // * public_exponent is not empty. |
126 Status GenerateRsaKeyPair(const blink::WebCryptoAlgorithm& algorithm, | 131 Status GenerateRsaKeyPair(const blink::WebCryptoAlgorithm& algorithm, |
127 bool extractable, | 132 bool extractable, |
128 blink::WebCryptoKeyUsageMask usage_mask, | 133 blink::WebCryptoKeyUsageMask usage_mask, |
| 134 unsigned int modulus_length_bits, |
| 135 const CryptoData& public_exponent, |
| 136 const blink::WebCryptoAlgorithm& hash, |
129 blink::WebCryptoKey* public_key, | 137 blink::WebCryptoKey* public_key, |
130 blink::WebCryptoKey* private_key); | 138 blink::WebCryptoKey* private_key); |
131 | 139 |
132 // Preconditions: | 140 // Preconditions: |
133 // * |key| is non-null. | 141 // * |key| is non-null. |
134 // * |algorithm.id()| is for a symmetric key algorithm. | 142 // * |algorithm.id()| is for a symmetric key algorithm. |
135 // * For AES algorithms |key_data| is either 16, 24, or 32 bytes long. | 143 // * For AES algorithms |key_data| is either 16, 24, or 32 bytes long. |
136 Status ImportKeyRaw(const blink::WebCryptoAlgorithm& algorithm, | 144 Status ImportKeyRaw(const blink::WebCryptoAlgorithm& algorithm, |
137 const CryptoData& key_data, | 145 const CryptoData& key_data, |
138 bool extractable, | 146 bool extractable, |
(...skipping 29 matching lines...) Expand all Loading... |
168 // * |key| is non-null. | 176 // * |key| is non-null. |
169 Status ExportKeySpki(PublicKey* key, blink::WebArrayBuffer* buffer); | 177 Status ExportKeySpki(PublicKey* key, blink::WebArrayBuffer* buffer); |
170 | 178 |
171 } // namespace platform | 179 } // namespace platform |
172 | 180 |
173 } // namespace webcrypto | 181 } // namespace webcrypto |
174 | 182 |
175 } // namespace content | 183 } // namespace content |
176 | 184 |
177 #endif // CONTENT_RENDERER_WEBCRYPTO_PLATFORM_CRYPTO_H_ | 185 #endif // CONTENT_RENDERER_WEBCRYPTO_PLATFORM_CRYPTO_H_ |
OLD | NEW |