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 <map> | |
9 #include <string> | |
eroman
2013/10/28 23:02:00
These two headers appear unused in this file. Add
padolph
2013/10/29 02:25:40
Done.
| |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
11 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
12 #include "third_party/WebKit/public/platform/WebCrypto.h" | 14 #include "third_party/WebKit/public/platform/WebCrypto.h" |
13 | 15 |
14 namespace content { | 16 namespace content { |
15 | 17 |
16 class CONTENT_EXPORT WebCryptoImpl | 18 class CONTENT_EXPORT WebCryptoImpl |
17 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { | 19 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { |
18 public: | 20 public: |
19 WebCryptoImpl(); | 21 WebCryptoImpl(); |
22 virtual ~WebCryptoImpl(); | |
eroman
2013/10/28 23:02:00
Any reason to add the destructor definition? Since
padolph
2013/10/29 02:25:40
Clang complained when I didn't have this. Should I
| |
20 | 23 |
21 virtual void encrypt( | 24 virtual void encrypt( |
22 const WebKit::WebCryptoAlgorithm& algorithm, | 25 const WebKit::WebCryptoAlgorithm& algorithm, |
23 const WebKit::WebCryptoKey& key, | 26 const WebKit::WebCryptoKey& key, |
24 const unsigned char* data, | 27 const unsigned char* data, |
25 unsigned data_size, | 28 unsigned data_size, |
26 WebKit::WebCryptoResult result); | 29 WebKit::WebCryptoResult result); |
27 virtual void decrypt( | 30 virtual void decrypt( |
28 const WebKit::WebCryptoAlgorithm& algorithm, | 31 const WebKit::WebCryptoAlgorithm& algorithm, |
29 const WebKit::WebCryptoKey& key, | 32 const WebKit::WebCryptoKey& key, |
(...skipping 26 matching lines...) Expand all Loading... | |
56 WebKit::WebCryptoResult result); | 59 WebKit::WebCryptoResult result); |
57 virtual void verifySignature( | 60 virtual void verifySignature( |
58 const WebKit::WebCryptoAlgorithm& algorithm, | 61 const WebKit::WebCryptoAlgorithm& algorithm, |
59 const WebKit::WebCryptoKey& key, | 62 const WebKit::WebCryptoKey& key, |
60 const unsigned char* signature, | 63 const unsigned char* signature, |
61 unsigned signature_size, | 64 unsigned signature_size, |
62 const unsigned char* data, | 65 const unsigned char* data, |
63 unsigned data_size, | 66 unsigned data_size, |
64 WebKit::WebCryptoResult result); | 67 WebKit::WebCryptoResult result); |
65 | 68 |
66 static void ShrinkBuffer(WebKit::WebArrayBuffer* buffer, unsigned new_size); | |
67 | |
68 protected: | 69 protected: |
69 friend class WebCryptoImplTest; | 70 friend class WebCryptoImplTest; |
70 | 71 |
71 void Init(); | 72 void Init(); |
72 | 73 |
73 bool EncryptInternal( | 74 bool EncryptInternal( |
74 const WebKit::WebCryptoAlgorithm& algorithm, | 75 const WebKit::WebCryptoAlgorithm& algorithm, |
75 const WebKit::WebCryptoKey& key, | 76 const WebKit::WebCryptoKey& key, |
76 const unsigned char* data, | 77 const unsigned char* data, |
77 unsigned data_size, | 78 unsigned data_size, |
(...skipping 29 matching lines...) Expand all Loading... | |
107 WebKit::WebArrayBuffer* buffer); | 108 WebKit::WebArrayBuffer* buffer); |
108 bool VerifySignatureInternal( | 109 bool VerifySignatureInternal( |
109 const WebKit::WebCryptoAlgorithm& algorithm, | 110 const WebKit::WebCryptoAlgorithm& algorithm, |
110 const WebKit::WebCryptoKey& key, | 111 const WebKit::WebCryptoKey& key, |
111 const unsigned char* signature, | 112 const unsigned char* signature, |
112 unsigned signature_size, | 113 unsigned signature_size, |
113 const unsigned char* data, | 114 const unsigned char* data, |
114 unsigned data_size, | 115 unsigned data_size, |
115 bool* signature_match); | 116 bool* signature_match); |
116 | 117 |
118 bool ImportKeyJwk( | |
119 const unsigned char* key_data, | |
120 unsigned key_data_size, | |
121 bool extractable, | |
122 const WebKit::WebCryptoAlgorithm& algorithm, | |
123 WebKit::WebCryptoKeyUsageMask usage_mask, | |
124 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle, | |
125 WebKit::WebCryptoKeyType* type); | |
126 | |
117 private: | 127 private: |
118 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 128 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
119 }; | 129 }; |
120 | 130 |
121 } // namespace content | 131 } // namespace content |
122 | 132 |
123 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 133 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
OLD | NEW |