| 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 COMPONENTS_WEBCRYPTO_ALGORITHMS_EC_H_ | 5 #ifndef COMPONENTS_WEBCRYPTO_ALGORITHMS_EC_H_ |
| 6 #define COMPONENTS_WEBCRYPTO_ALGORITHMS_EC_H_ | 6 #define COMPONENTS_WEBCRYPTO_ALGORITHMS_EC_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "components/webcrypto/algorithm_implementation.h" | 10 #include "components/webcrypto/algorithm_implementation.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // For instance "ES256". | 26 // For instance "ES256". |
| 27 virtual const char* GetJwkAlgorithm( | 27 virtual const char* GetJwkAlgorithm( |
| 28 const blink::WebCryptoNamedCurve curve) const = 0; | 28 const blink::WebCryptoNamedCurve curve) const = 0; |
| 29 | 29 |
| 30 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm, | 30 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm, |
| 31 bool extractable, | 31 bool extractable, |
| 32 blink::WebCryptoKeyUsageMask usages, | 32 blink::WebCryptoKeyUsageMask usages, |
| 33 GenerateKeyResult* result) const override; | 33 GenerateKeyResult* result) const override; |
| 34 | 34 |
| 35 Status VerifyKeyUsagesBeforeImportKey( | 35 Status ImportKey(blink::WebCryptoKeyFormat format, |
| 36 blink::WebCryptoKeyFormat format, | 36 const CryptoData& key_data, |
| 37 blink::WebCryptoKeyUsageMask usages) const override; | 37 const blink::WebCryptoAlgorithm& algorithm, |
| 38 bool extractable, |
| 39 blink::WebCryptoKeyUsageMask usages, |
| 40 blink::WebCryptoKey* key) const override; |
| 38 | 41 |
| 39 Status ImportKeyPkcs8(const CryptoData& key_data, | 42 Status ExportKey(blink::WebCryptoKeyFormat format, |
| 40 const blink::WebCryptoAlgorithm& algorithm, | 43 const blink::WebCryptoKey& key, |
| 41 bool extractable, | 44 std::vector<uint8_t>* buffer) const override; |
| 42 blink::WebCryptoKeyUsageMask usages, | |
| 43 blink::WebCryptoKey* key) const override; | |
| 44 | |
| 45 Status ImportKeySpki(const CryptoData& key_data, | |
| 46 const blink::WebCryptoAlgorithm& algorithm, | |
| 47 bool extractable, | |
| 48 blink::WebCryptoKeyUsageMask usages, | |
| 49 blink::WebCryptoKey* key) const override; | |
| 50 | |
| 51 Status ImportKeyJwk(const CryptoData& key_data, | |
| 52 const blink::WebCryptoAlgorithm& algorithm, | |
| 53 bool extractable, | |
| 54 blink::WebCryptoKeyUsageMask usages, | |
| 55 blink::WebCryptoKey* key) const override; | |
| 56 | |
| 57 Status ExportKeyPkcs8(const blink::WebCryptoKey& key, | |
| 58 std::vector<uint8_t>* buffer) const override; | |
| 59 | |
| 60 Status ExportKeySpki(const blink::WebCryptoKey& key, | |
| 61 std::vector<uint8_t>* buffer) const override; | |
| 62 | |
| 63 Status ExportKeyJwk(const blink::WebCryptoKey& key, | |
| 64 std::vector<uint8_t>* buffer) const override; | |
| 65 | 45 |
| 66 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm, | 46 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm, |
| 67 blink::WebCryptoKeyType type, | 47 blink::WebCryptoKeyType type, |
| 68 bool extractable, | 48 bool extractable, |
| 69 blink::WebCryptoKeyUsageMask usages, | 49 blink::WebCryptoKeyUsageMask usages, |
| 70 const CryptoData& key_data, | 50 const CryptoData& key_data, |
| 71 blink::WebCryptoKey* key) const override; | 51 blink::WebCryptoKey* key) const override; |
| 72 | 52 |
| 73 private: | 53 private: |
| 54 Status ImportKeyPkcs8(const CryptoData& key_data, |
| 55 const blink::WebCryptoAlgorithm& algorithm, |
| 56 bool extractable, |
| 57 blink::WebCryptoKeyUsageMask usages, |
| 58 blink::WebCryptoKey* key) const; |
| 59 |
| 60 Status ImportKeySpki(const CryptoData& key_data, |
| 61 const blink::WebCryptoAlgorithm& algorithm, |
| 62 bool extractable, |
| 63 blink::WebCryptoKeyUsageMask usages, |
| 64 blink::WebCryptoKey* key) const; |
| 65 |
| 66 Status ImportKeyJwk(const CryptoData& key_data, |
| 67 const blink::WebCryptoAlgorithm& algorithm, |
| 68 bool extractable, |
| 69 blink::WebCryptoKeyUsageMask usages, |
| 70 blink::WebCryptoKey* key) const; |
| 71 |
| 72 Status ExportKeyPkcs8(const blink::WebCryptoKey& key, |
| 73 std::vector<uint8_t>* buffer) const; |
| 74 |
| 75 Status ExportKeySpki(const blink::WebCryptoKey& key, |
| 76 std::vector<uint8_t>* buffer) const; |
| 77 |
| 78 Status ExportKeyJwk(const blink::WebCryptoKey& key, |
| 79 std::vector<uint8_t>* buffer) const; |
| 80 |
| 74 const blink::WebCryptoKeyUsageMask all_public_key_usages_; | 81 const blink::WebCryptoKeyUsageMask all_public_key_usages_; |
| 75 const blink::WebCryptoKeyUsageMask all_private_key_usages_; | 82 const blink::WebCryptoKeyUsageMask all_private_key_usages_; |
| 76 }; | 83 }; |
| 77 | 84 |
| 78 } // namespace webcrypto | 85 } // namespace webcrypto |
| 79 | 86 |
| 80 #endif // COMPONENTS_WEBCRYPTO_ALGORITHMS_EC_H_ | 87 #endif // COMPONENTS_WEBCRYPTO_ALGORITHMS_EC_H_ |
| OLD | NEW |