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

Side by Side Diff: crypto/rsa_private_key.h

Issue 270663002: Implemented profile-aware owner key loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests, used GetPublicSlotForChromeOSUSer. 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CRYPTO_RSA_PRIVATE_KEY_H_ 5 #ifndef CRYPTO_RSA_PRIVATE_KEY_H_
6 #define CRYPTO_RSA_PRIVATE_KEY_H_ 6 #define CRYPTO_RSA_PRIVATE_KEY_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <list> 10 #include <list>
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 static RSAPrivateKey* CreateFromKey(SECKEYPrivateKey* key); 199 static RSAPrivateKey* CreateFromKey(SECKEYPrivateKey* key);
200 200
201 // Import an existing public key, and then search for the private 201 // Import an existing public key, and then search for the private
202 // half in the key database. The format of the public key blob is is 202 // half in the key database. The format of the public key blob is is
203 // an X509 SubjectPublicKeyInfo block. This can return NULL if 203 // an X509 SubjectPublicKeyInfo block. This can return NULL if
204 // initialization fails or the private key cannot be found. The 204 // initialization fails or the private key cannot be found. The
205 // caller takes ownership of the returned object, but nothing new is 205 // caller takes ownership of the returned object, but nothing new is
206 // created in the key database. 206 // created in the key database.
207 static RSAPrivateKey* FindFromPublicKeyInfo( 207 static RSAPrivateKey* FindFromPublicKeyInfo(
208 const std::vector<uint8>& input); 208 const std::vector<uint8>& input);
209
210 // Import an existing public key, and then search for the private
211 // half in the slot specified by |slot|. The format of the public
212 // key blob is is an X509 SubjectPublicKeyInfo block. This can return
213 // NULL if initialization fails or the private key cannot be found.
214 // The caller takes ownership of the returned object, but nothing new
215 // is created in the key slot.
wtc 2014/05/19 17:23:54 Nit: I think it's better to say in |slot| or i
ygorshenin1 2014/05/20 07:53:50 Done.
216 static RSAPrivateKey* FindFromPublicKeyInfoInSlot(
217 const std::vector<uint8>& input,
218 PK11SlotInfo* slot);
209 #endif 219 #endif
210 220
211 #if defined(USE_OPENSSL) 221 #if defined(USE_OPENSSL)
212 EVP_PKEY* key() { return key_; } 222 EVP_PKEY* key() { return key_; }
213 #else 223 #else
214 SECKEYPrivateKey* key() { return key_; } 224 SECKEYPrivateKey* key() { return key_; }
215 SECKEYPublicKey* public_key() { return public_key_; } 225 SECKEYPublicKey* public_key() { return public_key_; }
216 #endif 226 #endif
217 227
218 // Creates a copy of the object. 228 // Creates a copy of the object.
(...skipping 28 matching lines...) Expand all
247 // Shared helper for CreateFromPrivateKeyInfo() and 257 // Shared helper for CreateFromPrivateKeyInfo() and
248 // CreateSensitiveFromPrivateKeyInfo(). 258 // CreateSensitiveFromPrivateKeyInfo().
249 // Note: |permanent| is only supported when USE_NSS is defined. 259 // Note: |permanent| is only supported when USE_NSS is defined.
250 static RSAPrivateKey* CreateFromPrivateKeyInfoWithParams( 260 static RSAPrivateKey* CreateFromPrivateKeyInfoWithParams(
251 PK11SlotInfo* slot, 261 PK11SlotInfo* slot,
252 const std::vector<uint8>& input, 262 const std::vector<uint8>& input,
253 bool permanent, 263 bool permanent,
254 bool sensitive); 264 bool sensitive);
255 #endif 265 #endif
256 266
267 #if defined(USE_NSS)
268 // Import an existing public key. The format of the public key blob
269 // is is an X509 SubjectPublicKeyInfo block. This can return NULL if
wtc 2014/05/19 17:23:54 Nit: is is => is
ygorshenin1 2014/05/20 07:53:50 Done.
270 // initialization fails. The caller takes ownership of the returned
271 // object, but nothing new is created in the key slot.
wtc 2014/05/19 17:23:54 Nit: since this function doesn't have a |slot| par
ygorshenin1 2014/05/20 07:53:50 Done.
272 static RSAPrivateKey* InitPublicPart(const std::vector<uint8>& input);
273 #endif
274
257 #if defined(USE_OPENSSL) 275 #if defined(USE_OPENSSL)
258 EVP_PKEY* key_; 276 EVP_PKEY* key_;
259 #else 277 #else
260 SECKEYPrivateKey* key_; 278 SECKEYPrivateKey* key_;
261 SECKEYPublicKey* public_key_; 279 SECKEYPublicKey* public_key_;
262 #endif 280 #endif
263 281
264 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey); 282 DISALLOW_COPY_AND_ASSIGN(RSAPrivateKey);
265 }; 283 };
266 284
267 } // namespace crypto 285 } // namespace crypto
268 286
269 #endif // CRYPTO_RSA_PRIVATE_KEY_H_ 287 #endif // CRYPTO_RSA_PRIVATE_KEY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698