| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| 6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_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 "third_party/WebKit/public/platform/WebCrypto.h" | 10 #include "third_party/WebKit/public/platform/WebCrypto.h" |
| 11 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" | 11 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" |
| 12 #include "third_party/WebKit/public/platform/WebVector.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 // Wrapper around the blink WebCrypto asynchronous interface, which forwards to | 16 // Wrapper around the blink WebCrypto asynchronous interface, which forwards to |
| 16 // the synchronous platfrom (NSS or OpenSSL) implementation. | 17 // the synchronous platfrom (NSS or OpenSSL) implementation. |
| 17 // | 18 // |
| 18 // TODO(eroman): Post the synchronous work to a background thread. | 19 // TODO(eroman): Post the synchronous work to a background thread. |
| 19 class WebCryptoImpl : public blink::WebCrypto { | 20 class WebCryptoImpl : public blink::WebCrypto { |
| 20 public: | 21 public: |
| 21 WebCryptoImpl(); | 22 WebCryptoImpl(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const unsigned char* data, | 62 const unsigned char* data, |
| 62 unsigned int data_size, | 63 unsigned int data_size, |
| 63 blink::WebCryptoResult result); | 64 blink::WebCryptoResult result); |
| 64 // This method synchronously computes a digest for the given data, returning | 65 // This method synchronously computes a digest for the given data, returning |
| 65 // |true| if successful and |false| otherwise. | 66 // |true| if successful and |false| otherwise. |
| 66 virtual bool digestSynchronous(const blink::WebCryptoAlgorithmId algorithm_id, | 67 virtual bool digestSynchronous(const blink::WebCryptoAlgorithmId algorithm_id, |
| 67 const unsigned char* data, | 68 const unsigned char* data, |
| 68 unsigned int data_size, | 69 unsigned int data_size, |
| 69 blink::WebArrayBuffer& result); | 70 blink::WebArrayBuffer& result); |
| 70 | 71 |
| 72 virtual bool deserializeKeyForClone( |
| 73 const blink::WebCryptoKeyAlgorithm& algorithm, |
| 74 blink::WebCryptoKeyType type, |
| 75 bool extractable, |
| 76 blink::WebCryptoKeyUsageMask usages, |
| 77 const unsigned char* key_data, |
| 78 unsigned key_data_size, |
| 79 blink::WebCryptoKey& key); |
| 80 |
| 81 virtual bool serializeKeyForClone(const blink::WebCryptoKey& key, |
| 82 blink::WebVector<unsigned char>& key_data); |
| 83 |
| 71 private: | 84 private: |
| 72 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 85 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
| 73 }; | 86 }; |
| 74 | 87 |
| 75 } // namespace content | 88 } // namespace content |
| 76 | 89 |
| 77 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 90 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| OLD | NEW |