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

Side by Side Diff: net/cert/ct_log_verifier_nss.cc

Issue 1440643002: Certificate Transparency: Per-profile CT verification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing iOS compilation Created 5 years, 1 month 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
« no previous file with comments | « net/cert/ct_log_verifier.cc ('k') | net/cert/ct_log_verifier_openssl.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 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 "net/cert/ct_log_verifier.h" 5 #include "net/cert/ct_log_verifier.h"
6 6
7 #include <cryptohi.h> 7 #include <cryptohi.h>
8 #include <keyhi.h> 8 #include <keyhi.h>
9 #include <nss.h> 9 #include <nss.h>
10 #include <pk11pub.h> 10 #include <pk11pub.h>
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (signature_algorithm_ == ct::DigitallySigned::SIG_ALGO_RSA && 110 if (signature_algorithm_ == ct::DigitallySigned::SIG_ALGO_RSA &&
111 SECKEY_PublicKeyStrengthInBits(public_key_) < 2048) { 111 SECKEY_PublicKeyStrengthInBits(public_key_) < 2048) {
112 DVLOG(1) << "Too small a public key."; 112 DVLOG(1) << "Too small a public key.";
113 return false; 113 return false;
114 } 114 }
115 115
116 return true; 116 return true;
117 } 117 }
118 118
119 bool CTLogVerifier::VerifySignature(const base::StringPiece& data_to_sign, 119 bool CTLogVerifier::VerifySignature(const base::StringPiece& data_to_sign,
120 const base::StringPiece& signature) { 120 const base::StringPiece& signature) const {
121 SECItem sig_data; 121 SECItem sig_data;
122 sig_data.data = reinterpret_cast<unsigned char*>(const_cast<char*>( 122 sig_data.data = reinterpret_cast<unsigned char*>(const_cast<char*>(
123 signature.data())); 123 signature.data()));
124 sig_data.len = signature.size(); 124 sig_data.len = signature.size();
125 125
126 SECStatus rv = VFY_VerifyDataDirect( 126 SECStatus rv = VFY_VerifyDataDirect(
127 reinterpret_cast<const unsigned char*>(data_to_sign.data()), 127 reinterpret_cast<const unsigned char*>(data_to_sign.data()),
128 data_to_sign.size(), public_key_, &sig_data, 128 data_to_sign.size(), public_key_, &sig_data,
129 GetNSSSigAlg(signature_algorithm_), GetNSSHashAlg(hash_algorithm_), 129 GetNSSSigAlg(signature_algorithm_), GetNSSHashAlg(hash_algorithm_),
130 NULL, NULL); 130 NULL, NULL);
131 DVLOG(1) << "Signature verification result: " << (rv == SECSuccess); 131 DVLOG(1) << "Signature verification result: " << (rv == SECSuccess);
132 return rv == SECSuccess; 132 return rv == SECSuccess;
133 } 133 }
134 134
135 } // namespace net 135 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/ct_log_verifier.cc ('k') | net/cert/ct_log_verifier_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698