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

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

Issue 1988993002: Check self-signed certificate names and signatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dependency on openssl -text format Created 4 years, 6 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
« no previous file with comments | « net/cert/x509_certificate_ios.cc ('k') | net/cert/x509_certificate_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 (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 #include <cert.h> 5 #include <cert.h>
6 #include <cryptohi.h> 6 #include <cryptohi.h>
7 #include <keyhi.h> 7 #include <keyhi.h>
8 #include <nss.h> 8 #include <nss.h>
9 #include <pk11pub.h> 9 #include <pk11pub.h>
10 #include <prtime.h> 10 #include <prtime.h>
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 size_t* size_bits, 278 size_t* size_bits,
279 PublicKeyType* type) { 279 PublicKeyType* type) {
280 x509_util::GetPublicKeyInfo(cert_handle, size_bits, type); 280 x509_util::GetPublicKeyInfo(cert_handle, size_bits, type);
281 } 281 }
282 282
283 // static 283 // static
284 bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) { 284 bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) {
285 crypto::ScopedSECKEYPublicKey public_key(CERT_ExtractPublicKey(cert_handle)); 285 crypto::ScopedSECKEYPublicKey public_key(CERT_ExtractPublicKey(cert_handle));
286 if (!public_key.get()) 286 if (!public_key.get())
287 return false; 287 return false;
288 return SECSuccess == CERT_VerifySignedDataWithPublicKey( 288 if (SECSuccess != CERT_VerifySignedDataWithPublicKey(
289 &cert_handle->signatureWrap, public_key.get(), NULL); 289 &cert_handle->signatureWrap, public_key.get(), NULL)) {
290 return false;
291 }
292 return CERT_CompareName(&cert_handle->subject, &cert_handle->issuer) ==
293 SECEqual;
290 } 294 }
291 295
292 } // namespace net 296 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_ios.cc ('k') | net/cert/x509_certificate_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698