| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "third_party/WebKit/public/platform/WebCrypto.h" | 12 #include "third_party/WebKit/public/platform/WebCrypto.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class CONTENT_EXPORT WebCryptoImpl | 16 class CONTENT_EXPORT WebCryptoImpl |
| 17 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { | 17 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { |
| 18 public: | 18 public: |
| 19 WebCryptoImpl(); | 19 WebCryptoImpl(); |
| 20 | 20 |
| 21 // Implementation of WebKit::WebCrypto | 21 // Implementation of WebKit::WebCrypto |
| 22 virtual void encrypt( | 22 virtual void encrypt( |
| 23 const WebKit::WebCryptoAlgorithm& algorithm, | 23 const WebKit::WebCryptoAlgorithm& algorithm, |
| 24 const WebKit::WebCryptoKey& key, | 24 const WebKit::WebCryptoKey& key, |
| 25 const unsigned char* data, | 25 const unsigned char* data, |
| 26 unsigned data_size, | 26 unsigned data_size, |
| 27 WebKit::WebCryptoResult result); | 27 WebKit::WebCryptoResult result); |
| 28 virtual void decrypt( |
| 29 const WebKit::WebCryptoAlgorithm& algorithm, |
| 30 const WebKit::WebCryptoKey& key, |
| 31 const unsigned char* data, |
| 32 unsigned data_size, |
| 33 WebKit::WebCryptoResult result); |
| 28 virtual void digest( | 34 virtual void digest( |
| 29 const WebKit::WebCryptoAlgorithm& algorithm, | 35 const WebKit::WebCryptoAlgorithm& algorithm, |
| 30 const unsigned char* data, | 36 const unsigned char* data, |
| 31 unsigned data_size, | 37 unsigned data_size, |
| 32 WebKit::WebCryptoResult result); | 38 WebKit::WebCryptoResult result); |
| 33 virtual void importKey( | 39 virtual void importKey( |
| 34 WebKit::WebCryptoKeyFormat format, | 40 WebKit::WebCryptoKeyFormat format, |
| 35 const unsigned char* key_data, | 41 const unsigned char* key_data, |
| 36 unsigned key_data_size, | 42 unsigned key_data_size, |
| 37 const WebKit::WebCryptoAlgorithm& algorithm, | 43 const WebKit::WebCryptoAlgorithm& algorithm, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 friend class WebCryptoImplTest; | 55 friend class WebCryptoImplTest; |
| 50 | 56 |
| 51 void Init(); | 57 void Init(); |
| 52 | 58 |
| 53 bool EncryptInternal( | 59 bool EncryptInternal( |
| 54 const WebKit::WebCryptoAlgorithm& algorithm, | 60 const WebKit::WebCryptoAlgorithm& algorithm, |
| 55 const WebKit::WebCryptoKey& key, | 61 const WebKit::WebCryptoKey& key, |
| 56 const unsigned char* data, | 62 const unsigned char* data, |
| 57 unsigned data_size, | 63 unsigned data_size, |
| 58 WebKit::WebArrayBuffer* buffer); | 64 WebKit::WebArrayBuffer* buffer); |
| 65 bool DecryptInternal( |
| 66 const WebKit::WebCryptoAlgorithm& algorithm, |
| 67 const WebKit::WebCryptoKey& key, |
| 68 const unsigned char* data, |
| 69 unsigned data_size, |
| 70 WebKit::WebArrayBuffer* buffer); |
| 59 bool DigestInternal( | 71 bool DigestInternal( |
| 60 const WebKit::WebCryptoAlgorithm& algorithm, | 72 const WebKit::WebCryptoAlgorithm& algorithm, |
| 61 const unsigned char* data, | 73 const unsigned char* data, |
| 62 unsigned data_size, | 74 unsigned data_size, |
| 63 WebKit::WebArrayBuffer* buffer); | 75 WebKit::WebArrayBuffer* buffer); |
| 64 bool ImportKeyInternal( | 76 bool ImportKeyInternal( |
| 65 WebKit::WebCryptoKeyFormat format, | 77 WebKit::WebCryptoKeyFormat format, |
| 66 const unsigned char* key_data, | 78 const unsigned char* key_data, |
| 67 unsigned key_data_size, | 79 unsigned key_data_size, |
| 68 const WebKit::WebCryptoAlgorithm& algorithm, | 80 const WebKit::WebCryptoAlgorithm& algorithm, |
| 69 WebKit::WebCryptoKeyUsageMask usage_mask, | 81 WebKit::WebCryptoKeyUsageMask usage_mask, |
| 70 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle, | 82 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle, |
| 71 WebKit::WebCryptoKeyType* type); | 83 WebKit::WebCryptoKeyType* type); |
| 72 bool SignInternal( | 84 bool SignInternal( |
| 73 const WebKit::WebCryptoAlgorithm& algorithm, | 85 const WebKit::WebCryptoAlgorithm& algorithm, |
| 74 const WebKit::WebCryptoKey& key, | 86 const WebKit::WebCryptoKey& key, |
| 75 const unsigned char* data, | 87 const unsigned char* data, |
| 76 unsigned data_size, | 88 unsigned data_size, |
| 77 WebKit::WebArrayBuffer* buffer); | 89 WebKit::WebArrayBuffer* buffer); |
| 78 | 90 |
| 79 private: | 91 private: |
| 80 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 92 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
| 81 }; | 93 }; |
| 82 | 94 |
| 83 } // namespace content | 95 } // namespace content |
| 84 | 96 |
| 85 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ | 97 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ |
| OLD | NEW |