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

Side by Side Diff: google_apis/cup/client_update_protocol_nss.cc

Issue 36593002: crypto/nss_util: Get TPM slot id, do lookup by id instead of by name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sandbox debugging crap Created 7 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "google_apis/cup/client_update_protocol.h" 5 #include "google_apis/cup/client_update_protocol.h"
6 6
7 #include <keyhi.h> 7 #include <keyhi.h>
8 #include <pk11pub.h> 8 #include <pk11pub.h>
9 #include <seccomon.h> 9 #include <seccomon.h>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "crypto/nss_util.h" 12 #include "crypto/nss_util.h"
13 #include "crypto/scoped_nss_types.h" 13 #include "crypto/scoped_nss_types.h"
14 14
15 typedef scoped_ptr_malloc< 15 typedef scoped_ptr_malloc<
16 CERTSubjectPublicKeyInfo, 16 CERTSubjectPublicKeyInfo,
17 crypto::NSSDestroyer<CERTSubjectPublicKeyInfo, 17 crypto::NSSDestroyer<CERTSubjectPublicKeyInfo,
18 SECKEY_DestroySubjectPublicKeyInfo> > 18 SECKEY_DestroySubjectPublicKeyInfo> >
19 ScopedCERTSubjectPublicKeyInfo; 19 ScopedCERTSubjectPublicKeyInfo;
20 20
21 ClientUpdateProtocol::~ClientUpdateProtocol() { 21 ClientUpdateProtocol::~ClientUpdateProtocol() {
22 if (public_key_) 22 if (public_key_)
23 SECKEY_DestroyPublicKey(public_key_); 23 SECKEY_DestroyPublicKey(public_key_);
24 } 24 }
25 25
26 bool ClientUpdateProtocol::LoadPublicKey(const base::StringPiece& public_key) { 26 bool ClientUpdateProtocol::LoadPublicKey(const base::StringPiece& public_key) {
27 LOG(ERROR) << "HIIIIIIIIIIIIIIIIIIIIIIIIIII";
27 crypto::EnsureNSSInit(); 28 crypto::EnsureNSSInit();
28 29
29 // The binary blob |public_key| is expected to be a DER-encoded ASN.1 30 // The binary blob |public_key| is expected to be a DER-encoded ASN.1
30 // Subject Public Key Info. 31 // Subject Public Key Info.
31 SECItem spki_item; 32 SECItem spki_item;
32 spki_item.type = siBuffer; 33 spki_item.type = siBuffer;
33 spki_item.data = 34 spki_item.data =
34 reinterpret_cast<unsigned char*>(const_cast<char*>(public_key.data())); 35 reinterpret_cast<unsigned char*>(const_cast<char*>(public_key.data()));
35 spki_item.len = static_cast<unsigned int>(public_key.size()); 36 spki_item.len = static_cast<unsigned int>(public_key.size());
36 37
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 73
73 encrypted_key_source_.resize(keysize); 74 encrypted_key_source_.resize(keysize);
74 return SECSuccess == PK11_PubEncryptRaw( 75 return SECSuccess == PK11_PubEncryptRaw(
75 public_key_, 76 public_key_,
76 &encrypted_key_source_[0], 77 &encrypted_key_source_[0],
77 const_cast<unsigned char*>(&key_source[0]), 78 const_cast<unsigned char*>(&key_source[0]),
78 key_source.size(), 79 key_source.size(),
79 NULL); 80 NULL);
80 } 81 }
81 82
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698