| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ | |
| 6 #define CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "content/common/content_export.h" | |
| 12 #include "third_party/WebKit/public/platform/WebCrypto.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 class CONTENT_EXPORT WebCryptoImpl | |
| 17 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { | |
| 18 public: | |
| 19 WebCryptoImpl(); | |
| 20 | |
| 21 virtual void digest( | |
| 22 const WebKit::WebCryptoAlgorithm& algorithm, | |
| 23 const unsigned char* data, | |
| 24 unsigned data_size, | |
| 25 WebKit::WebCryptoResult result); | |
| 26 virtual void importKey( | |
| 27 WebKit::WebCryptoKeyFormat format, | |
| 28 const unsigned char* key_data, | |
| 29 unsigned key_data_size, | |
| 30 const WebKit::WebCryptoAlgorithm& algorithm, | |
| 31 bool extractable, | |
| 32 WebKit::WebCryptoKeyUsageMask usage_mask, | |
| 33 WebKit::WebCryptoResult result); | |
| 34 virtual void sign( | |
| 35 const WebKit::WebCryptoAlgorithm& algorithm, | |
| 36 const WebKit::WebCryptoKey& key, | |
| 37 const unsigned char* data, | |
| 38 unsigned data_size, | |
| 39 WebKit::WebCryptoResult result); | |
| 40 virtual void verifySignature( | |
| 41 const WebKit::WebCryptoAlgorithm& algorithm, | |
| 42 const WebKit::WebCryptoKey& key, | |
| 43 const unsigned char* signature, | |
| 44 unsigned signature_size, | |
| 45 const unsigned char* data, | |
| 46 unsigned data_size, | |
| 47 WebKit::WebCryptoResult result); | |
| 48 | |
| 49 protected: | |
| 50 friend class WebCryptoImplTest; | |
| 51 | |
| 52 void Init(); | |
| 53 | |
| 54 bool DigestInternal( | |
| 55 const WebKit::WebCryptoAlgorithm& algorithm, | |
| 56 const unsigned char* data, | |
| 57 unsigned data_size, | |
| 58 WebKit::WebArrayBuffer* buffer); | |
| 59 bool ImportKeyInternal( | |
| 60 WebKit::WebCryptoKeyFormat format, | |
| 61 const unsigned char* key_data, | |
| 62 unsigned key_data_size, | |
| 63 const WebKit::WebCryptoAlgorithm& algorithm, | |
| 64 WebKit::WebCryptoKeyUsageMask usage_mask, | |
| 65 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle, | |
| 66 WebKit::WebCryptoKeyType* type); | |
| 67 bool SignInternal( | |
| 68 const WebKit::WebCryptoAlgorithm& algorithm, | |
| 69 const WebKit::WebCryptoKey& key, | |
| 70 const unsigned char* data, | |
| 71 unsigned data_size, | |
| 72 WebKit::WebArrayBuffer* buffer); | |
| 73 bool VerifySignatureInternal( | |
| 74 const WebKit::WebCryptoAlgorithm& algorithm, | |
| 75 const WebKit::WebCryptoKey& key, | |
| 76 const unsigned char* signature, | |
| 77 unsigned signature_size, | |
| 78 const unsigned char* data, | |
| 79 unsigned data_size, | |
| 80 bool* signature_match); | |
| 81 | |
| 82 private: | |
| 83 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | |
| 84 }; | |
| 85 | |
| 86 } // namespace content | |
| 87 | |
| 88 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ | |
| OLD | NEW |