OLD | NEW |
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 "net/cert/x509_certificate.h" | 5 #include "net/cert/x509_certificate.h" |
6 | 6 |
7 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. | 7 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 it != intermediate_ca_certs_.end(); ++it) { | 465 it != intermediate_ca_certs_.end(); ++it) { |
466 if (IsCertNameBlobInIssuerList(&(*it)->pCertInfo->Issuer, | 466 if (IsCertNameBlobInIssuerList(&(*it)->pCertInfo->Issuer, |
467 valid_issuers)) { | 467 valid_issuers)) { |
468 return true; | 468 return true; |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 return false; | 472 return false; |
473 } | 473 } |
474 | 474 |
| 475 // static |
| 476 bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) { |
| 477 return !!CryptVerifyCertificateSignatureEx( |
| 478 NULL, |
| 479 X509_ASN_ENCODING, |
| 480 CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT, |
| 481 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), |
| 482 CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT, |
| 483 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), |
| 484 0, |
| 485 NULL); |
| 486 } |
| 487 |
475 } // namespace net | 488 } // namespace net |
OLD | NEW |