| 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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const WebKit::WebCryptoAlgorithm& algorithm, | 30 const WebKit::WebCryptoAlgorithm& algorithm, |
| 31 bool extractable, | 31 bool extractable, |
| 32 WebKit::WebCryptoKeyUsageMask usage_mask, | 32 WebKit::WebCryptoKeyUsageMask usage_mask, |
| 33 WebKit::WebCryptoResult result); | 33 WebKit::WebCryptoResult result); |
| 34 virtual void sign( | 34 virtual void sign( |
| 35 const WebKit::WebCryptoAlgorithm& algorithm, | 35 const WebKit::WebCryptoAlgorithm& algorithm, |
| 36 const WebKit::WebCryptoKey& key, | 36 const WebKit::WebCryptoKey& key, |
| 37 const unsigned char* data, | 37 const unsigned char* data, |
| 38 unsigned data_size, | 38 unsigned data_size, |
| 39 WebKit::WebCryptoResult result); | 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); |
| 40 | 48 |
| 41 protected: | 49 protected: |
| 42 friend class WebCryptoImplTest; | 50 friend class WebCryptoImplTest; |
| 43 | 51 |
| 44 void Init(); | 52 void Init(); |
| 45 | 53 |
| 46 bool DigestInternal( | 54 bool DigestInternal( |
| 47 const WebKit::WebCryptoAlgorithm& algorithm, | 55 const WebKit::WebCryptoAlgorithm& algorithm, |
| 48 const unsigned char* data, | 56 const unsigned char* data, |
| 49 unsigned data_size, | 57 unsigned data_size, |
| 50 WebKit::WebArrayBuffer* buffer); | 58 WebKit::WebArrayBuffer* buffer); |
| 51 bool ImportKeyInternal( | 59 bool ImportKeyInternal( |
| 52 WebKit::WebCryptoKeyFormat format, | 60 WebKit::WebCryptoKeyFormat format, |
| 53 const unsigned char* key_data, | 61 const unsigned char* key_data, |
| 54 unsigned key_data_size, | 62 unsigned key_data_size, |
| 55 const WebKit::WebCryptoAlgorithm& algorithm, | 63 const WebKit::WebCryptoAlgorithm& algorithm, |
| 56 WebKit::WebCryptoKeyUsageMask usage_mask, | 64 WebKit::WebCryptoKeyUsageMask usage_mask, |
| 57 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle, | 65 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle, |
| 58 WebKit::WebCryptoKeyType* type); | 66 WebKit::WebCryptoKeyType* type); |
| 59 bool SignInternal( | 67 bool SignInternal( |
| 60 const WebKit::WebCryptoAlgorithm& algorithm, | 68 const WebKit::WebCryptoAlgorithm& algorithm, |
| 61 const WebKit::WebCryptoKey& key, | 69 const WebKit::WebCryptoKey& key, |
| 62 const unsigned char* data, | 70 const unsigned char* data, |
| 63 unsigned data_size, | 71 unsigned data_size, |
| 64 WebKit::WebArrayBuffer* buffer); | 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); |
| 65 | 81 |
| 66 private: | 82 private: |
| 67 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 83 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
| 68 }; | 84 }; |
| 69 | 85 |
| 70 } // namespace content | 86 } // namespace content |
| 71 | 87 |
| 72 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ | 88 #endif // CONTENT_RENDERER_WEBCRYPTO_IMPL_H_ |
| OLD | NEW |