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

Side by Side Diff: nss_util.cc

Issue 6793055: [login_manager] Allow new owner keys to be pushed with StorePolicy (Closed) Base URL: http://git.chromium.org/git/login_manager.git@master
Patch Set: remove some debugging code Created 9 years, 8 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 | « nss_util.h ('k') | owner_key.h » ('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 (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium OS 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 #include "login_manager/nss_util.h" 5 #include "login_manager/nss_util.h"
6 6
7 #include <base/basictypes.h> 7 #include <base/basictypes.h>
8 #include <base/crypto/rsa_private_key.h> 8 #include <base/crypto/rsa_private_key.h>
9 #include <base/crypto/signature_creator.h> 9 #include <base/crypto/signature_creator.h>
10 #include <base/crypto/signature_verifier.h> 10 #include <base/crypto/signature_verifier.h>
11 #include <base/file_path.h> 11 #include <base/file_path.h>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 NssUtil* NssUtil::Create() { 59 NssUtil* NssUtil::Create() {
60 if (!factory_) { 60 if (!factory_) {
61 return new NssUtilImpl; 61 return new NssUtilImpl;
62 base::EnsureNSSInit(); 62 base::EnsureNSSInit();
63 } else { 63 } else {
64 return factory_->CreateNssUtil(); 64 return factory_->CreateNssUtil();
65 } 65 }
66 } 66 }
67 67
68 // static 68 // static
69 void NssUtil::KeyFromBuffer(const std::string& buf, std::vector<uint8>* out) { 69 void NssUtil::BlobFromBuffer(const std::string& buf, std::vector<uint8>* out) {
70 out->resize(buf.length()); 70 out->resize(buf.length());
71 if (out->size() == 0) 71 if (out->size() == 0)
72 return; 72 return;
73 memcpy(&(out->at(0)), buf.c_str(), out->size()); 73 memcpy(&(out->at(0)), buf.c_str(), out->size());
74 } 74 }
75 75
76 // We're generating and using 2048-bit RSA keys. 76 // We're generating and using 2048-bit RSA keys.
77 // static 77 // static
78 const uint16 NssUtilImpl::kKeySizeInBits = 2048; 78 const uint16 NssUtilImpl::kKeySizeInBits = 2048;
79 79
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 std::vector<uint8>* OUT_signature, 131 std::vector<uint8>* OUT_signature,
132 base::RSAPrivateKey* key) { 132 base::RSAPrivateKey* key) {
133 scoped_ptr<base::SignatureCreator> signer( 133 scoped_ptr<base::SignatureCreator> signer(
134 base::SignatureCreator::Create(key)); 134 base::SignatureCreator::Create(key));
135 if (!signer->Update(data, data_len)) 135 if (!signer->Update(data, data_len))
136 return false; 136 return false;
137 return signer->Final(OUT_signature); 137 return signer->Final(OUT_signature);
138 } 138 }
139 139
140 } // namespace login_manager 140 } // namespace login_manager
OLDNEW
« no previous file with comments | « nss_util.h ('k') | owner_key.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698