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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ |
6 #define CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ | 6 #define CONTENT_RENDERER_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 "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
13 #include "third_party/WebKit/public/platform/WebCrypto.h" | 12 #include "third_party/WebKit/public/platform/WebCrypto.h" |
14 | 13 |
15 namespace content { | 14 namespace content { |
16 | 15 |
17 class CONTENT_EXPORT WebCryptoImpl | 16 class CONTENT_EXPORT WebCryptoImpl |
18 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { | 17 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { |
19 public: | 18 public: |
20 WebCryptoImpl(); | 19 WebCryptoImpl(); |
21 | 20 |
22 virtual void digest( | 21 virtual void digest( |
23 const WebKit::WebCryptoAlgorithm& algorithm, | 22 const WebKit::WebCryptoAlgorithm& algorithm, |
24 const unsigned char* data, | 23 const unsigned char* data, |
25 unsigned data_size, | 24 unsigned data_size, |
26 WebKit::WebCryptoResult result); | 25 WebKit::WebCryptoResult result); |
27 virtual void importKey( | |
28 WebKit::WebCryptoKeyFormat format, | |
29 const unsigned char* key_data, | |
30 unsigned key_data_size, | |
31 const WebKit::WebCryptoAlgorithm& algorithm, | |
32 bool extractable, | |
33 WebKit::WebCryptoKeyUsageMask usage_mask, | |
34 WebKit::WebCryptoResult result); | |
35 virtual void sign( | |
36 const WebKit::WebCryptoAlgorithm& algorithm, | |
37 const WebKit::WebCryptoKey& key, | |
38 const unsigned char* data, | |
39 unsigned data_size, | |
40 WebKit::WebCryptoResult result); | |
41 | 26 |
42 protected: | 27 protected: |
43 FRIEND_TEST_ALL_PREFIXES(WebCryptoImplTest, DigestSampleSets); | 28 FRIEND_TEST_ALL_PREFIXES(WebCryptoImplTest, DigestSampleSets); |
44 FRIEND_TEST_ALL_PREFIXES(WebCryptoImplTest, HMACSampleSets); | |
45 | 29 |
46 void Init(); | 30 void Init(); |
47 | 31 |
48 bool DigestInternal( | 32 bool DigestInternal( |
49 const WebKit::WebCryptoAlgorithm& algorithm, | 33 const WebKit::WebCryptoAlgorithm& algorithm, |
50 const unsigned char* data, | 34 const unsigned char* data, |
51 unsigned data_size, | 35 unsigned data_size, |
52 WebKit::WebArrayBuffer* buffer); | 36 WebKit::WebArrayBuffer* buffer); |
53 bool ImportKeyInternal( | |
54 WebKit::WebCryptoKeyFormat format, | |
55 const unsigned char* key_data, | |
56 unsigned key_data_size, | |
57 const WebKit::WebCryptoAlgorithm& algorithm, | |
58 WebKit::WebCryptoKeyUsageMask usage_mask, | |
59 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle, | |
60 WebKit::WebCryptoKeyType* type); | |
61 bool SignInternal( | |
62 const WebKit::WebCryptoAlgorithm& algorithm, | |
63 const WebKit::WebCryptoKey& key, | |
64 const unsigned char* data, | |
65 unsigned data_size, | |
66 WebKit::WebArrayBuffer* buffer); | |
67 | 37 |
68 private: | 38 private: |
69 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 39 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
70 }; | 40 }; |
71 | 41 |
72 } // namespace content | 42 } // namespace content |
73 | 43 |
74 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ | 44 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ |
OLD | NEW |