| 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_PLATFORM_CRYPTO_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ |
| 6 #define CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 // Preconditions: | 188 // Preconditions: |
| 189 // * algorithm.id() is for an RSA algorithm. | 189 // * algorithm.id() is for an RSA algorithm. |
| 190 Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm, | 190 Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm, |
| 191 bool extractable, | 191 bool extractable, |
| 192 blink::WebCryptoKeyUsageMask usage_mask, | 192 blink::WebCryptoKeyUsageMask usage_mask, |
| 193 const CryptoData& modulus_data, | 193 const CryptoData& modulus_data, |
| 194 const CryptoData& exponent_data, | 194 const CryptoData& exponent_data, |
| 195 blink::WebCryptoKey* key); | 195 blink::WebCryptoKey* key); |
| 196 | 196 |
| 197 // Preconditions: |
| 198 // * algorithm.id() is for an RSA algorithm. |
| 199 // * modulus, public_exponent, and private_exponent will be non-empty. However |
| 200 // all the other CryptoData parameters may be empty, which means they were |
| 201 // unspecified. |
| 202 Status ImportRsaPrivateKey(const blink::WebCryptoAlgorithm& algorithm, |
| 203 bool extractable, |
| 204 blink::WebCryptoKeyUsageMask usage_mask, |
| 205 const CryptoData& modulus, |
| 206 const CryptoData& public_exponent, |
| 207 const CryptoData& private_exponent, |
| 208 const CryptoData& prime1, |
| 209 const CryptoData& prime2, |
| 210 const CryptoData& exponent1, |
| 211 const CryptoData& exponent2, |
| 212 const CryptoData& coefficient, |
| 213 blink::WebCryptoKey* key); |
| 214 |
| 197 // Note that this may be called from target Blink thread. | 215 // Note that this may be called from target Blink thread. |
| 198 Status ImportKeySpki(const blink::WebCryptoAlgorithm& algorithm, | 216 Status ImportKeySpki(const blink::WebCryptoAlgorithm& algorithm, |
| 199 const CryptoData& key_data, | 217 const CryptoData& key_data, |
| 200 bool extractable, | 218 bool extractable, |
| 201 blink::WebCryptoKeyUsageMask usage_mask, | 219 blink::WebCryptoKeyUsageMask usage_mask, |
| 202 blink::WebCryptoKey* key); | 220 blink::WebCryptoKey* key); |
| 203 | 221 |
| 204 // Note that this may be called from target Blink thread. | 222 // Note that this may be called from target Blink thread. |
| 205 Status ImportKeyPkcs8(const blink::WebCryptoAlgorithm& algorithm, | 223 Status ImportKeyPkcs8(const blink::WebCryptoAlgorithm& algorithm, |
| 206 const CryptoData& key_data, | 224 const CryptoData& key_data, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 217 Status ExportKeySpki(PublicKey* key, std::vector<uint8>* buffer); | 235 Status ExportKeySpki(PublicKey* key, std::vector<uint8>* buffer); |
| 218 | 236 |
| 219 // Preconditions: | 237 // Preconditions: |
| 220 // * |key| is non-null. | 238 // * |key| is non-null. |
| 221 Status ExportRsaPublicKey(PublicKey* key, | 239 Status ExportRsaPublicKey(PublicKey* key, |
| 222 std::vector<uint8>* modulus, | 240 std::vector<uint8>* modulus, |
| 223 std::vector<uint8>* public_exponent); | 241 std::vector<uint8>* public_exponent); |
| 224 | 242 |
| 225 // Preconditions: | 243 // Preconditions: |
| 226 // * |key| is non-null. | 244 // * |key| is non-null. |
| 245 Status ExportRsaPrivateKey(PrivateKey* key, |
| 246 std::vector<uint8>* modulus, |
| 247 std::vector<uint8>* public_exponent, |
| 248 std::vector<uint8>* private_exponent, |
| 249 std::vector<uint8>* prime1, |
| 250 std::vector<uint8>* prime2, |
| 251 std::vector<uint8>* exponent1, |
| 252 std::vector<uint8>* exponent2, |
| 253 std::vector<uint8>* coefficient); |
| 254 |
| 255 // Preconditions: |
| 256 // * |key| is non-null. |
| 227 Status ExportKeyPkcs8(PrivateKey* key, | 257 Status ExportKeyPkcs8(PrivateKey* key, |
| 228 const blink::WebCryptoKeyAlgorithm& key_algorithm, | 258 const blink::WebCryptoKeyAlgorithm& key_algorithm, |
| 229 std::vector<uint8>* buffer); | 259 std::vector<uint8>* buffer); |
| 230 | 260 |
| 231 // Preconditions: | 261 // Preconditions: |
| 232 // * |key| is non-null | 262 // * |key| is non-null |
| 233 // * |wrapping_key| is non-null | 263 // * |wrapping_key| is non-null |
| 234 Status WrapSymKeyAesKw(SymKey* key, | 264 Status WrapSymKeyAesKw(SymKey* key, |
| 235 SymKey* wrapping_key, | 265 SymKey* wrapping_key, |
| 236 std::vector<uint8>* buffer); | 266 std::vector<uint8>* buffer); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 blink::WebCryptoKeyUsageMask usage_mask, | 310 blink::WebCryptoKeyUsageMask usage_mask, |
| 281 blink::WebCryptoKey* key); | 311 blink::WebCryptoKey* key); |
| 282 | 312 |
| 283 } // namespace platform | 313 } // namespace platform |
| 284 | 314 |
| 285 } // namespace webcrypto | 315 } // namespace webcrypto |
| 286 | 316 |
| 287 } // namespace content | 317 } // namespace content |
| 288 | 318 |
| 289 #endif // CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ | 319 #endif // CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ |
| OLD | NEW |