| 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_NSS_RSA_KEY_NSS_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_NSS_RSA_KEY_NSS_H_ |
| 6 #define CONTENT_CHILD_WEBCRYPTO_NSS_RSA_KEY_NSS_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_NSS_RSA_KEY_NSS_H_ |
| 7 | 7 |
| 8 #include <pkcs11t.h> | 8 #include <pkcs11t.h> |
| 9 | 9 |
| 10 #include "content/child/webcrypto/algorithm_implementation.h" | 10 #include "content/child/webcrypto/algorithm_implementation.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 : generate_flags_(generate_flags), | 38 : generate_flags_(generate_flags), |
| 39 all_public_key_usages_(all_public_key_usages), | 39 all_public_key_usages_(all_public_key_usages), |
| 40 all_private_key_usages_(all_private_key_usages) {} | 40 all_private_key_usages_(all_private_key_usages) {} |
| 41 | 41 |
| 42 // For instance "RSA-OAEP-256". | 42 // For instance "RSA-OAEP-256". |
| 43 virtual const char* GetJwkAlgorithm( | 43 virtual const char* GetJwkAlgorithm( |
| 44 const blink::WebCryptoAlgorithmId hash) const = 0; | 44 const blink::WebCryptoAlgorithmId hash) const = 0; |
| 45 | 45 |
| 46 virtual Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm, | 46 virtual Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm, |
| 47 bool extractable, | 47 bool extractable, |
| 48 blink::WebCryptoKeyUsageMask usage_mask, | 48 blink::WebCryptoKeyUsageMask usages, |
| 49 GenerateKeyResult* result) const override; | 49 GenerateKeyResult* result) const override; |
| 50 | 50 |
| 51 virtual Status VerifyKeyUsagesBeforeImportKey( | 51 virtual Status VerifyKeyUsagesBeforeImportKey( |
| 52 blink::WebCryptoKeyFormat format, | 52 blink::WebCryptoKeyFormat format, |
| 53 blink::WebCryptoKeyUsageMask usage_mask) const override; | 53 blink::WebCryptoKeyUsageMask usages) const override; |
| 54 | 54 |
| 55 virtual Status ImportKeyPkcs8(const CryptoData& key_data, | 55 virtual Status ImportKeyPkcs8(const CryptoData& key_data, |
| 56 const blink::WebCryptoAlgorithm& algorithm, | 56 const blink::WebCryptoAlgorithm& algorithm, |
| 57 bool extractable, | 57 bool extractable, |
| 58 blink::WebCryptoKeyUsageMask usage_mask, | 58 blink::WebCryptoKeyUsageMask usages, |
| 59 blink::WebCryptoKey* key) const override; | 59 blink::WebCryptoKey* key) const override; |
| 60 | 60 |
| 61 virtual Status ImportKeySpki(const CryptoData& key_data, | 61 virtual Status ImportKeySpki(const CryptoData& key_data, |
| 62 const blink::WebCryptoAlgorithm& algorithm, | 62 const blink::WebCryptoAlgorithm& algorithm, |
| 63 bool extractable, | 63 bool extractable, |
| 64 blink::WebCryptoKeyUsageMask usage_mask, | 64 blink::WebCryptoKeyUsageMask usages, |
| 65 blink::WebCryptoKey* key) const override; | 65 blink::WebCryptoKey* key) const override; |
| 66 | 66 |
| 67 virtual Status ExportKeyPkcs8(const blink::WebCryptoKey& key, | 67 virtual Status ExportKeyPkcs8(const blink::WebCryptoKey& key, |
| 68 std::vector<uint8_t>* buffer) const override; | 68 std::vector<uint8_t>* buffer) const override; |
| 69 | 69 |
| 70 virtual Status ExportKeySpki(const blink::WebCryptoKey& key, | 70 virtual Status ExportKeySpki(const blink::WebCryptoKey& key, |
| 71 std::vector<uint8_t>* buffer) const override; | 71 std::vector<uint8_t>* buffer) const override; |
| 72 | 72 |
| 73 virtual Status ImportKeyJwk(const CryptoData& key_data, | 73 virtual Status ImportKeyJwk(const CryptoData& key_data, |
| 74 const blink::WebCryptoAlgorithm& algorithm, | 74 const blink::WebCryptoAlgorithm& algorithm, |
| 75 bool extractable, | 75 bool extractable, |
| 76 blink::WebCryptoKeyUsageMask usage_mask, | 76 blink::WebCryptoKeyUsageMask usages, |
| 77 blink::WebCryptoKey* key) const override; | 77 blink::WebCryptoKey* key) const override; |
| 78 | 78 |
| 79 virtual Status ExportKeyJwk(const blink::WebCryptoKey& key, | 79 virtual Status ExportKeyJwk(const blink::WebCryptoKey& key, |
| 80 std::vector<uint8_t>* buffer) const override; | 80 std::vector<uint8_t>* buffer) const override; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 CK_FLAGS generate_flags_; | 83 CK_FLAGS generate_flags_; |
| 84 blink::WebCryptoKeyUsageMask all_public_key_usages_; | 84 blink::WebCryptoKeyUsageMask all_public_key_usages_; |
| 85 blink::WebCryptoKeyUsageMask all_private_key_usages_; | 85 blink::WebCryptoKeyUsageMask all_private_key_usages_; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace webcrypto | 88 } // namespace webcrypto |
| 89 | 89 |
| 90 } // namespace content | 90 } // namespace content |
| 91 | 91 |
| 92 #endif // CONTENT_CHILD_WEBCRYPTO_NSS_RSA_KEY_NSS_H_ | 92 #endif // CONTENT_CHILD_WEBCRYPTO_NSS_RSA_KEY_NSS_H_ |
| OLD | NEW |