| 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" |
| 11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 12 #include "third_party/WebKit/public/platform/WebCrypto.h" | 13 #include "third_party/WebKit/public/platform/WebCrypto.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 class CONTENT_EXPORT WebCryptoImpl | 17 class CONTENT_EXPORT WebCryptoImpl |
| 17 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { | 18 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { |
| 18 public: | 19 public: |
| 19 WebCryptoImpl(); | 20 WebCryptoImpl(); |
| 20 | 21 |
| 21 virtual void digest( | 22 virtual void digest( |
| 22 const WebKit::WebCryptoAlgorithm& algorithm, | 23 const WebKit::WebCryptoAlgorithm& algorithm, |
| 23 const unsigned char* data, | 24 const unsigned char* data, |
| 24 unsigned data_size, | 25 unsigned data_size, |
| 25 WebKit::WebCryptoResult result); | 26 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); |
| 26 | 41 |
| 27 protected: | 42 protected: |
| 28 FRIEND_TEST_ALL_PREFIXES(WebCryptoImplTest, DigestSampleSets); | 43 FRIEND_TEST_ALL_PREFIXES(WebCryptoImplTest, DigestSampleSets); |
| 44 FRIEND_TEST_ALL_PREFIXES(WebCryptoImplTest, HMACSampleSets); |
| 29 | 45 |
| 30 void Init(); | 46 void Init(); |
| 31 | 47 |
| 32 bool DigestInternal( | 48 bool DigestInternal( |
| 33 const WebKit::WebCryptoAlgorithm& algorithm, | 49 const WebKit::WebCryptoAlgorithm& algorithm, |
| 34 const unsigned char* data, | 50 const unsigned char* data, |
| 35 unsigned data_size, | 51 unsigned data_size, |
| 36 WebKit::WebArrayBuffer* buffer); | 52 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); |
| 37 | 67 |
| 38 private: | 68 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 69 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
| 40 }; | 70 }; |
| 41 | 71 |
| 42 } // namespace content | 72 } // namespace content |
| 43 | 73 |
| 44 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ | 74 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ |
| OLD | NEW |