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