Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: content/child/webcrypto/algorithm_implementation.h

Issue 749183004: WebCrypto: Implement crypto.subtle.deriveKey (chromium-side). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ecdh
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ALGORITHM_IMPLEMENTATION_H_ 5 #ifndef CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_
6 #define CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_ 6 #define CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 // This method corresponds to Web Crypto's crypto.subtle.generateKey(). 75 // This method corresponds to Web Crypto's crypto.subtle.generateKey().
76 // 76 //
77 // Implementations MUST verify |usages| and return an error if it is not 77 // Implementations MUST verify |usages| and return an error if it is not
78 // appropriate. 78 // appropriate.
79 virtual Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm, 79 virtual Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
80 bool extractable, 80 bool extractable,
81 blink::WebCryptoKeyUsageMask usages, 81 blink::WebCryptoKeyUsageMask usages,
82 GenerateKeyResult* result) const; 82 GenerateKeyResult* result) const;
83 83
84 // This method corresponds to Web Crypto's "derive bits" operation. 84 // This method corresponds to Web Crypto's "derive bits" operation. It is
85 // essentially crypto.subtle.deriveBits() with the exception that the length
86 // can be "null" (|has_length_bits = true|).
87 //
88 // In cases where the length was not specified, an appropriate default for the
89 // algorithm should be used (as described by the spec).
85 virtual Status DeriveBits(const blink::WebCryptoAlgorithm& algorithm, 90 virtual Status DeriveBits(const blink::WebCryptoAlgorithm& algorithm,
86 const blink::WebCryptoKey& base_key, 91 const blink::WebCryptoKey& base_key,
87 unsigned int length_bits, 92 bool has_optional_length_bits,
93 unsigned int optional_length_bits,
88 std::vector<uint8_t>* derived_bytes) const; 94 std::vector<uint8_t>* derived_bytes) const;
89 95
90 // This method corresponds with Web Crypto's "Get key length" operation. 96 // This method corresponds with Web Crypto's "Get key length" operation.
91 // 97 //
92 // In the Web Crypto spec the operation returns either "null" or an 98 // In the Web Crypto spec the operation returns either "null" or an
93 // "Integer". In this code "null" is represented by setting 99 // "Integer". In this code "null" is represented by setting
94 // |*has_length_bits = false|. 100 // |*has_length_bits = false|.
95 virtual Status GetKeyLength( 101 virtual Status GetKeyLength(
96 const blink::WebCryptoAlgorithm& key_length_algorithm, 102 const blink::WebCryptoAlgorithm& key_length_algorithm,
97 bool* has_length_bits, 103 bool* has_length_bits,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 blink::WebCryptoKeyUsageMask usages, 204 blink::WebCryptoKeyUsageMask usages,
199 const CryptoData& key_data, 205 const CryptoData& key_data,
200 blink::WebCryptoKey* key) const; 206 blink::WebCryptoKey* key) const;
201 }; 207 };
202 208
203 } // namespace webcrypto 209 } // namespace webcrypto
204 210
205 } // namespace content 211 } // namespace content
206 212
207 #endif // CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_ 213 #endif // CONTENT_CHILD_WEBCRYPTO_ALGORITHM_IMPLEMENTATION_H_
OLDNEW
« no previous file with comments | « content/child/webcrypto/algorithm_dispatch.cc ('k') | content/child/webcrypto/algorithm_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698