| 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_WEBCRYPTO_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| 6 #define CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 6 #define CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> |
| 9 #include <string> |
| 8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 12 #include "third_party/WebKit/public/platform/WebCrypto.h" | 14 #include "third_party/WebKit/public/platform/WebCrypto.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 class CONTENT_EXPORT WebCryptoImpl | 18 class CONTENT_EXPORT WebCryptoImpl |
| 17 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { | 19 : NON_EXPORTED_BASE(public WebKit::WebCrypto) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 const WebKit::WebCryptoKey& key, | 56 const WebKit::WebCryptoKey& key, |
| 55 const unsigned char* signature, | 57 const unsigned char* signature, |
| 56 unsigned signature_size, | 58 unsigned signature_size, |
| 57 const unsigned char* data, | 59 const unsigned char* data, |
| 58 unsigned data_size, | 60 unsigned data_size, |
| 59 WebKit::WebCryptoResult result); | 61 WebKit::WebCryptoResult result); |
| 60 | 62 |
| 61 protected: | 63 protected: |
| 62 friend class WebCryptoImplTest; | 64 friend class WebCryptoImplTest; |
| 63 | 65 |
| 66 std::map<std::string, int> jwk_algorithm_map_; |
| 67 |
| 64 void Init(); | 68 void Init(); |
| 65 | 69 |
| 66 bool EncryptInternal( | 70 bool EncryptInternal( |
| 67 const WebKit::WebCryptoAlgorithm& algorithm, | 71 const WebKit::WebCryptoAlgorithm& algorithm, |
| 68 const WebKit::WebCryptoKey& key, | 72 const WebKit::WebCryptoKey& key, |
| 69 const unsigned char* data, | 73 const unsigned char* data, |
| 70 unsigned data_size, | 74 unsigned data_size, |
| 71 WebKit::WebArrayBuffer* buffer); | 75 WebKit::WebArrayBuffer* buffer); |
| 72 bool DecryptInternal( | 76 bool DecryptInternal( |
| 73 const WebKit::WebCryptoAlgorithm& algorithm, | 77 const WebKit::WebCryptoAlgorithm& algorithm, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 96 WebKit::WebArrayBuffer* buffer); | 100 WebKit::WebArrayBuffer* buffer); |
| 97 bool VerifySignatureInternal( | 101 bool VerifySignatureInternal( |
| 98 const WebKit::WebCryptoAlgorithm& algorithm, | 102 const WebKit::WebCryptoAlgorithm& algorithm, |
| 99 const WebKit::WebCryptoKey& key, | 103 const WebKit::WebCryptoKey& key, |
| 100 const unsigned char* signature, | 104 const unsigned char* signature, |
| 101 unsigned signature_size, | 105 unsigned signature_size, |
| 102 const unsigned char* data, | 106 const unsigned char* data, |
| 103 unsigned data_size, | 107 unsigned data_size, |
| 104 bool* signature_match); | 108 bool* signature_match); |
| 105 | 109 |
| 110 bool ImportKeyJwk( |
| 111 const unsigned char* key_data, |
| 112 unsigned key_data_size, |
| 113 scoped_ptr<WebKit::WebCryptoKeyHandle>* handle, |
| 114 WebKit::WebCryptoKeyType* type, |
| 115 bool* extractable, |
| 116 WebKit::WebCryptoAlgorithm* algorithm, |
| 117 WebKit::WebCryptoKeyUsageMask* usage_mask); |
| 118 |
| 119 |
| 106 private: | 120 private: |
| 107 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 121 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
| 108 }; | 122 }; |
| 109 | 123 |
| 110 } // namespace content | 124 } // namespace content |
| 111 | 125 |
| 112 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 126 #endif // CONTENT_RENDERER_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| OLD | NEW |