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

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

Issue 287133004: [webcrypto] Add JWK import/export of RSA private keys (NSS). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add JWK private key import as well. 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
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 // Preconditions: 188 // Preconditions:
189 // * algorithm.id() is for an RSA algorithm. 189 // * algorithm.id() is for an RSA algorithm.
190 Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm, 190 Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm,
191 bool extractable, 191 bool extractable,
192 blink::WebCryptoKeyUsageMask usage_mask, 192 blink::WebCryptoKeyUsageMask usage_mask,
193 const CryptoData& modulus_data, 193 const CryptoData& modulus_data,
194 const CryptoData& exponent_data, 194 const CryptoData& exponent_data,
195 blink::WebCryptoKey* key); 195 blink::WebCryptoKey* key);
196 196
197 // Preconditions:
198 // * algorithm.id() is for an RSA algorithm.
199 Status ImportRsaPrivateKey(const blink::WebCryptoAlgorithm& algorithm,
200 bool extractable,
201 blink::WebCryptoKeyUsageMask usage_mask,
202 const CryptoData& modulus,
203 const CryptoData& public_exponent,
204 const CryptoData& private_exponent,
205 bool has_prime1,
206 const CryptoData& prime1,
207 bool has_prime2,
208 const CryptoData& prime2,
209 bool has_exponent,
210 const CryptoData& exponent1,
211 bool has_exponent2,
212 const CryptoData& exponent2,
213 bool has_coefficient,
214 const CryptoData& coefficient,
215 blink::WebCryptoKey* key);
216
197 // Note that this may be called from target Blink thread. 217 // Note that this may be called from target Blink thread.
198 Status ImportKeySpki(const blink::WebCryptoAlgorithm& algorithm, 218 Status ImportKeySpki(const blink::WebCryptoAlgorithm& algorithm,
199 const CryptoData& key_data, 219 const CryptoData& key_data,
200 bool extractable, 220 bool extractable,
201 blink::WebCryptoKeyUsageMask usage_mask, 221 blink::WebCryptoKeyUsageMask usage_mask,
202 blink::WebCryptoKey* key); 222 blink::WebCryptoKey* key);
203 223
204 // Note that this may be called from target Blink thread. 224 // Note that this may be called from target Blink thread.
205 Status ImportKeyPkcs8(const blink::WebCryptoAlgorithm& algorithm, 225 Status ImportKeyPkcs8(const blink::WebCryptoAlgorithm& algorithm,
206 const CryptoData& key_data, 226 const CryptoData& key_data,
(...skipping 10 matching lines...) Expand all
217 Status ExportKeySpki(PublicKey* key, std::vector<uint8>* buffer); 237 Status ExportKeySpki(PublicKey* key, std::vector<uint8>* buffer);
218 238
219 // Preconditions: 239 // Preconditions:
220 // * |key| is non-null. 240 // * |key| is non-null.
221 Status ExportRsaPublicKey(PublicKey* key, 241 Status ExportRsaPublicKey(PublicKey* key,
222 std::vector<uint8>* modulus, 242 std::vector<uint8>* modulus,
223 std::vector<uint8>* public_exponent); 243 std::vector<uint8>* public_exponent);
224 244
225 // Preconditions: 245 // Preconditions:
226 // * |key| is non-null. 246 // * |key| is non-null.
247 Status ExportRsaPrivateKey(PrivateKey* key,
248 std::vector<uint8>* modulus,
249 std::vector<uint8>* public_exponent,
250 std::vector<uint8>* private_exponent,
251 std::vector<uint8>* prime1,
252 std::vector<uint8>* prime2,
253 std::vector<uint8>* exponent1,
254 std::vector<uint8>* exponent2,
255 std::vector<uint8>* coefficient);
256
257 // Preconditions:
258 // * |key| is non-null.
227 Status ExportKeyPkcs8(PrivateKey* key, 259 Status ExportKeyPkcs8(PrivateKey* key,
228 const blink::WebCryptoKeyAlgorithm& key_algorithm, 260 const blink::WebCryptoKeyAlgorithm& key_algorithm,
229 std::vector<uint8>* buffer); 261 std::vector<uint8>* buffer);
230 262
231 // Preconditions: 263 // Preconditions:
232 // * |key| is non-null 264 // * |key| is non-null
233 // * |wrapping_key| is non-null 265 // * |wrapping_key| is non-null
234 Status WrapSymKeyAesKw(SymKey* key, 266 Status WrapSymKeyAesKw(SymKey* key,
235 SymKey* wrapping_key, 267 SymKey* wrapping_key,
236 std::vector<uint8>* buffer); 268 std::vector<uint8>* buffer);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 blink::WebCryptoKeyUsageMask usage_mask, 312 blink::WebCryptoKeyUsageMask usage_mask,
281 blink::WebCryptoKey* key); 313 blink::WebCryptoKey* key);
282 314
283 } // namespace platform 315 } // namespace platform
284 316
285 } // namespace webcrypto 317 } // namespace webcrypto
286 318
287 } // namespace content 319 } // namespace content
288 320
289 #endif // CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_ 321 #endif // CONTENT_CHILD_WEBCRYPTO_PLATFORM_CRYPTO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698