| 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" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm, | 76 const blink::WebCryptoAlgorithm& unwrapped_key_algorithm, |
| 77 bool extractable, | 77 bool extractable, |
| 78 blink::WebCryptoKeyUsageMask usages, | 78 blink::WebCryptoKeyUsageMask usages, |
| 79 blink::WebCryptoResult result); | 79 blink::WebCryptoResult result); |
| 80 // This method synchronously computes a digest for the given data, returning | 80 // This method synchronously computes a digest for the given data, returning |
| 81 // |true| if successful and |false| otherwise. | 81 // |true| if successful and |false| otherwise. |
| 82 virtual bool digestSynchronous(const blink::WebCryptoAlgorithmId algorithm_id, | 82 virtual bool digestSynchronous(const blink::WebCryptoAlgorithmId algorithm_id, |
| 83 const unsigned char* data, | 83 const unsigned char* data, |
| 84 unsigned int data_size, | 84 unsigned int data_size, |
| 85 blink::WebArrayBuffer& result); | 85 blink::WebArrayBuffer& result); |
| 86 // This method returns a digestor object that can be used to synchronously |
| 87 // compute a digest one chunk at a time. Thus, the consume does not need to |
| 88 // hold onto a large buffer with all the data to digest. Chunks can be given |
| 89 // one at a time and the digest will be computed piecemeal. The allocated |
| 90 // WebCrytpoDigestor that is returned by createDigestor must be freed by the |
| 91 // caller. |
| 92 virtual blink::WebCryptoDigestor* createDigestor( |
| 93 const blink::WebCryptoAlgorithmId algorithm_id); |
| 86 | 94 |
| 87 virtual bool deserializeKeyForClone( | 95 virtual bool deserializeKeyForClone( |
| 88 const blink::WebCryptoKeyAlgorithm& algorithm, | 96 const blink::WebCryptoKeyAlgorithm& algorithm, |
| 89 blink::WebCryptoKeyType type, | 97 blink::WebCryptoKeyType type, |
| 90 bool extractable, | 98 bool extractable, |
| 91 blink::WebCryptoKeyUsageMask usages, | 99 blink::WebCryptoKeyUsageMask usages, |
| 92 const unsigned char* key_data, | 100 const unsigned char* key_data, |
| 93 unsigned key_data_size, | 101 unsigned key_data_size, |
| 94 blink::WebCryptoKey& key); | 102 blink::WebCryptoKey& key); |
| 95 | 103 |
| 96 virtual bool serializeKeyForClone(const blink::WebCryptoKey& key, | 104 virtual bool serializeKeyForClone(const blink::WebCryptoKey& key, |
| 97 blink::WebVector<unsigned char>& key_data); | 105 blink::WebVector<unsigned char>& key_data); |
| 98 | 106 |
| 99 private: | 107 private: |
| 100 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); | 108 DISALLOW_COPY_AND_ASSIGN(WebCryptoImpl); |
| 101 }; | 109 }; |
| 102 | 110 |
| 103 } // namespace content | 111 } // namespace content |
| 104 | 112 |
| 105 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ | 113 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_IMPL_H_ |
| OLD | NEW |