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

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

Issue 282903002: [webcrypto] Remove RSA-ES support (2 of 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and merge conflicts (yuck) Created 6 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « content/child/webcrypto/jwk.cc ('k') | content/child/webcrypto/platform_crypto_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PLATFORM_CRYPTO_H_ 5 #ifndef CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_
6 #define CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ 6 #define CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // * |tag_length_bits| is one of {32, 64, 96, 104, 112, 120, 128} 90 // * |tag_length_bits| is one of {32, 64, 96, 104, 112, 120, 128}
91 Status EncryptDecryptAesGcm(EncryptOrDecrypt mode, 91 Status EncryptDecryptAesGcm(EncryptOrDecrypt mode,
92 SymKey* key, 92 SymKey* key,
93 const CryptoData& data, 93 const CryptoData& data,
94 const CryptoData& iv, 94 const CryptoData& iv,
95 const CryptoData& additional_data, 95 const CryptoData& additional_data,
96 unsigned int tag_length_bits, 96 unsigned int tag_length_bits,
97 std::vector<uint8>* buffer); 97 std::vector<uint8>* buffer);
98 98
99 // Preconditions: 99 // Preconditions:
100 // * |key| is non-null.
101 // * |data| is not empty.
102 Status EncryptRsaEsPkcs1v1_5(PublicKey* key,
103 const CryptoData& data,
104 std::vector<uint8>* buffer);
105
106 // Preconditions:
107 // * |key| is non-null.
108 Status DecryptRsaEsPkcs1v1_5(PrivateKey* key,
109 const CryptoData& data,
110 std::vector<uint8>* buffer);
111
112 // Preconditions:
113 // * |key| is non-null 100 // * |key| is non-null
114 // * |hash| is a digest algorithm 101 // * |hash| is a digest algorithm
115 // * |label| MAY be empty (e.g. 0 bytes long). 102 // * |label| MAY be empty (e.g. 0 bytes long).
116 Status EncryptRsaOaep(PublicKey* key, 103 Status EncryptRsaOaep(PublicKey* key,
117 const blink::WebCryptoAlgorithm& hash, 104 const blink::WebCryptoAlgorithm& hash,
118 const CryptoData& label, 105 const CryptoData& label,
119 const CryptoData& data, 106 const CryptoData& data,
120 std::vector<uint8>* buffer); 107 std::vector<uint8>* buffer);
121 108
122 // Preconditions: 109 // Preconditions:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, 161 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm,
175 bool extractable, 162 bool extractable,
176 blink::WebCryptoKeyUsageMask usage_mask, 163 blink::WebCryptoKeyUsageMask usage_mask,
177 unsigned keylen_bytes, 164 unsigned keylen_bytes,
178 blink::WebCryptoKey* key); 165 blink::WebCryptoKey* key);
179 166
180 // Preconditions: 167 // Preconditions:
181 // * algorithm.id() is for an RSA algorithm. 168 // * algorithm.id() is for an RSA algorithm.
182 // * public_exponent, modulus_length_bits and hash_or_null are the same as what 169 // * public_exponent, modulus_length_bits and hash_or_null are the same as what
183 // is in algorithm. They are split out for convenience. 170 // is in algorithm. They are split out for convenience.
184 // * hash_or_null.isNull() may be true if a hash is not applicable to the
185 // algorithm
186 // * modulus_length_bits is not 0 171 // * modulus_length_bits is not 0
187 // * public_exponent is not empty. 172 // * public_exponent is not empty.
188 Status GenerateRsaKeyPair(const blink::WebCryptoAlgorithm& algorithm, 173 Status GenerateRsaKeyPair(const blink::WebCryptoAlgorithm& algorithm,
189 bool extractable, 174 bool extractable,
190 blink::WebCryptoKeyUsageMask usage_mask, 175 blink::WebCryptoKeyUsageMask usage_mask,
191 unsigned int modulus_length_bits, 176 unsigned int modulus_length_bits,
192 const CryptoData& public_exponent, 177 const CryptoData& public_exponent,
193 const blink::WebCryptoAlgorithm& hash,
194 blink::WebCryptoKey* public_key, 178 blink::WebCryptoKey* public_key,
195 blink::WebCryptoKey* private_key); 179 blink::WebCryptoKey* private_key);
196 180
197 // Preconditions: 181 // Preconditions:
198 // * |key| is non-null. 182 // * |key| is non-null.
199 // * |algorithm.id()| is for a symmetric key algorithm. 183 // * |algorithm.id()| is for a symmetric key algorithm.
200 // * For AES algorithms |key_data| is either 16, 24, or 32 bytes long. 184 // * For AES algorithms |key_data| is either 16, 24, or 32 bytes long.
201 // Note that this may be called from target Blink thread. 185 // Note that this may be called from target Blink thread.
202 Status ImportKeyRaw(const blink::WebCryptoAlgorithm& algorithm, 186 Status ImportKeyRaw(const blink::WebCryptoAlgorithm& algorithm,
203 const CryptoData& key_data, 187 const CryptoData& key_data,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // when the input |data| does not directly represent a key and should instead be 289 // when the input |data| does not directly represent a key and should instead be
306 // interpreted as generic bytes. 290 // interpreted as generic bytes.
307 // Preconditions: 291 // Preconditions:
308 // * |key| is non-null 292 // * |key| is non-null
309 // * |data| is at least 24 bytes and a multiple of 8 bytes 293 // * |data| is at least 24 bytes and a multiple of 8 bytes
310 // * |buffer| is non-null. 294 // * |buffer| is non-null.
311 Status DecryptAesKw(SymKey* key, 295 Status DecryptAesKw(SymKey* key,
312 const CryptoData& data, 296 const CryptoData& data,
313 std::vector<uint8>* buffer); 297 std::vector<uint8>* buffer);
314 298
315 // Preconditions:
316 // * |key| is non-null
317 // * |wrapping_key| is non-null
318 Status WrapSymKeyRsaEs(SymKey* key,
319 PublicKey* wrapping_key,
320 std::vector<uint8>* buffer);
321
322 // Preconditions:
323 // * |wrapping_key| is non-null
324 // * |key| is non-null
325 // * |algorithm.id()| is for a symmetric key algorithm.
326 Status UnwrapSymKeyRsaEs(const CryptoData& wrapped_key_data,
327 PrivateKey* wrapping_key,
328 const blink::WebCryptoAlgorithm& algorithm,
329 bool extractable,
330 blink::WebCryptoKeyUsageMask usage_mask,
331 blink::WebCryptoKey* key);
332
333 } // namespace platform 299 } // namespace platform
334 300
335 } // namespace webcrypto 301 } // namespace webcrypto
336 302
337 } // namespace content 303 } // namespace content
338 304
339 #endif // CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ 305 #endif // CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_
OLDNEW
« no previous file with comments | « content/child/webcrypto/jwk.cc ('k') | content/child/webcrypto/platform_crypto_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698