Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_WEBCRYPTO_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| 6 #define CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 6 #define CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_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 "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/renderer/webcrypto/webcrypto_util.h" | |
|
Ryan Sleevi
2014/01/28 21:11:58
You can forward-declare webcrypto::Status here bec
eroman
2014/01/28 22:59:08
Neat, didn't realize you could do that for return-
| |
| 11 #include "third_party/WebKit/public/platform/WebCrypto.h" | 12 #include "third_party/WebKit/public/platform/WebCrypto.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 class CONTENT_EXPORT WebCryptoImpl | 16 class CONTENT_EXPORT WebCryptoImpl |
| 16 : NON_EXPORTED_BASE(public blink::WebCrypto) { | 17 : NON_EXPORTED_BASE(public blink::WebCrypto) { |
| 17 public: | 18 public: |
| 18 WebCryptoImpl(); | 19 WebCryptoImpl(); |
| 19 | 20 |
| 20 virtual void encrypt( | 21 virtual void encrypt( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 const unsigned char* data, | 66 const unsigned char* data, |
| 66 unsigned data_size, | 67 unsigned data_size, |
| 67 blink::WebCryptoResult result); | 68 blink::WebCryptoResult result); |
| 68 | 69 |
| 69 | 70 |
| 70 protected: | 71 protected: |
| 71 friend class WebCryptoImplTest; | 72 friend class WebCryptoImplTest; |
| 72 | 73 |
| 73 void Init(); | 74 void Init(); |
| 74 | 75 |
| 75 bool EncryptInternal( | 76 webcrypto::Status EncryptInternal( |
| 76 const blink::WebCryptoAlgorithm& algorithm, | 77 const blink::WebCryptoAlgorithm& algorithm, |
| 77 const blink::WebCryptoKey& key, | 78 const blink::WebCryptoKey& key, |
| 78 const unsigned char* data, | 79 const unsigned char* data, |
| 79 unsigned data_size, | 80 unsigned data_size, |
| 80 blink::WebArrayBuffer* buffer); | 81 blink::WebArrayBuffer* buffer); |
| 81 bool DecryptInternal( | 82 webcrypto::Status DecryptInternal( |
| 82 const blink::WebCryptoAlgorithm& algorithm, | 83 const blink::WebCryptoAlgorithm& algorithm, |
| 83 const blink::WebCryptoKey& key, | 84 const blink::WebCryptoKey& key, |
| 84 const unsigned char* data, | 85 const unsigned char* data, |
| 85 unsigned data_size, | 86 unsigned data_size, |
| 86 blink::WebArrayBuffer* buffer); | 87 blink::WebArrayBuffer* buffer); |
| 87 bool DigestInternal( | 88 webcrypto::Status DigestInternal( |
| 88 const blink::WebCryptoAlgorithm& algorithm, | 89 const blink::WebCryptoAlgorithm& algorithm, |
| 89 const unsigned char* data, | 90 const unsigned char* data, |
| 90 unsigned data_size, | 91 unsigned data_size, |
| 91 blink::WebArrayBuffer* buffer); | 92 blink::WebArrayBuffer* buffer); |
| 92 bool GenerateKeyInternal( | 93 webcrypto::Status GenerateKeyInternal( |
| 93 const blink::WebCryptoAlgorithm& algorithm, | 94 const blink::WebCryptoAlgorithm& algorithm, |
| 94 bool extractable, | 95 bool extractable, |
| 95 blink::WebCryptoKeyUsageMask usage_mask, | 96 blink::WebCryptoKeyUsageMask usage_mask, |
| 96 blink::WebCryptoKey* key); | 97 blink::WebCryptoKey* key); |
| 97 bool GenerateKeyPairInternal( | 98 webcrypto::Status GenerateKeyPairInternal( |
| 98 const blink::WebCryptoAlgorithm& algorithm, | 99 const blink::WebCryptoAlgorithm& algorithm, |
| 99 bool extractable, | 100 bool extractable, |
| 100 blink::WebCryptoKeyUsageMask usage_mask, | 101 blink::WebCryptoKeyUsageMask usage_mask, |
| 101 blink::WebCryptoKey* public_key, | 102 blink::WebCryptoKey* public_key, |
| 102 blink::WebCryptoKey* private_key); | 103 blink::WebCryptoKey* private_key); |
| 103 bool ImportKeyInternal( | 104 webcrypto::Status ImportKeyInternal( |
| 104 blink::WebCryptoKeyFormat format, | 105 blink::WebCryptoKeyFormat format, |
| 105 const unsigned char* key_data, | 106 const unsigned char* key_data, |
| 106 unsigned key_data_size, | 107 unsigned key_data_size, |
| 107 const blink::WebCryptoAlgorithm& algorithm_or_null, | 108 const blink::WebCryptoAlgorithm& algorithm_or_null, |
| 108 bool extractable, | 109 bool extractable, |
| 109 blink::WebCryptoKeyUsageMask usage_mask, | 110 blink::WebCryptoKeyUsageMask usage_mask, |
| 110 blink::WebCryptoKey* key); | 111 blink::WebCryptoKey* key); |
| 111 bool ExportKeyInternal( | 112 webcrypto::Status ExportKeyInternal( |
| 112 blink::WebCryptoKeyFormat format, | 113 blink::WebCryptoKeyFormat format, |
| 113 const blink::WebCryptoKey& key, | 114 const blink::WebCryptoKey& key, |
| 114 blink::WebArrayBuffer* buffer); | 115 blink::WebArrayBuffer* buffer); |
| 115 bool SignInternal( | 116 webcrypto::Status SignInternal( |
| 116 const blink::WebCryptoAlgorithm& algorithm, | 117 const blink::WebCryptoAlgorithm& algorithm, |
| 117 const blink::WebCryptoKey& key, | 118 const blink::WebCryptoKey& key, |
| 118 const unsigned char* data, | 119 const unsigned char* data, |
| 119 unsigned data_size, | 120 unsigned data_size, |
| 120 blink::WebArrayBuffer* buffer); | 121 blink::WebArrayBuffer* buffer); |
| 121 bool VerifySignatureInternal( | 122 webcrypto::Status VerifySignatureInternal( |
| 122 const blink::WebCryptoAlgorithm& algorithm, | 123 const blink::WebCryptoAlgorithm& algorithm, |
| 123 const blink::WebCryptoKey& key, | 124 const blink::WebCryptoKey& key, |
| 124 const unsigned char* signature, | 125 const unsigned char* signature, |
| 125 unsigned signature_size, | 126 unsigned signature_size, |
| 126 const unsigned char* data, | 127 const unsigned char* data, |
| 127 unsigned data_size, | 128 unsigned data_size, |
| 128 bool* signature_match); | 129 bool* signature_match); |
| 129 | 130 |
| 130 bool ImportKeyJwk( | 131 webcrypto::Status ImportKeyJwk( |
| 131 const unsigned char* key_data, | 132 const unsigned char* key_data, |
| 132 unsigned key_data_size, | 133 unsigned key_data_size, |
| 133 const blink::WebCryptoAlgorithm& algorithm_or_null, | 134 const blink::WebCryptoAlgorithm& algorithm_or_null, |
| 134 bool extractable, | 135 bool extractable, |
| 135 blink::WebCryptoKeyUsageMask usage_mask, | 136 blink::WebCryptoKeyUsageMask usage_mask, |
| 136 blink::WebCryptoKey* key); | 137 blink::WebCryptoKey* key); |
| 137 bool ImportRsaPublicKeyInternal( | 138 webcrypto::Status ImportRsaPublicKeyInternal( |
| 138 const unsigned char* modulus_data, | 139 const unsigned char* modulus_data, |
| 139 unsigned modulus_size, | 140 unsigned modulus_size, |
| 140 const unsigned char* exponent_data, | 141 const unsigned char* exponent_data, |
| 141 unsigned exponent_size, | 142 unsigned exponent_size, |
| 142 const blink::WebCryptoAlgorithm& algorithm, | 143 const blink::WebCryptoAlgorithm& algorithm, |
| 143 bool extractable, | 144 bool extractable, |
| 144 blink::WebCryptoKeyUsageMask usage_mask, | 145 blink::WebCryptoKeyUsageMask usage_mask, |
| 145 blink::WebCryptoKey* key); | 146 blink::WebCryptoKey* key); |
| 146 | 147 |
| 147 private: | 148 private: |
| 148 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 149 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 } // namespace content | 152 } // namespace content |
| 152 | 153 |
| 153 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 154 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| OLD | NEW |