| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 namespace net { | 29 namespace net { |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 typedef crypto::ScopedCAPIHandle< | 33 typedef crypto::ScopedCAPIHandle< |
| 34 HCERTSTORE, | 34 HCERTSTORE, |
| 35 crypto::CAPIDestroyerWithFlags<HCERTSTORE, | 35 crypto::CAPIDestroyerWithFlags<HCERTSTORE, |
| 36 CertCloseStore, 0> > ScopedHCERTSTORE; | 36 CertCloseStore, 0> > ScopedHCERTSTORE; |
| 37 | 37 |
| 38 void ExplodedTimeToSystemTime(const base::Time::Exploded& exploded, | |
| 39 SYSTEMTIME* system_time) { | |
| 40 system_time->wYear = static_cast<WORD>(exploded.year); | |
| 41 system_time->wMonth = static_cast<WORD>(exploded.month); | |
| 42 system_time->wDayOfWeek = static_cast<WORD>(exploded.day_of_week); | |
| 43 system_time->wDay = static_cast<WORD>(exploded.day_of_month); | |
| 44 system_time->wHour = static_cast<WORD>(exploded.hour); | |
| 45 system_time->wMinute = static_cast<WORD>(exploded.minute); | |
| 46 system_time->wSecond = static_cast<WORD>(exploded.second); | |
| 47 system_time->wMilliseconds = static_cast<WORD>(exploded.millisecond); | |
| 48 } | |
| 49 | |
| 50 //----------------------------------------------------------------------------- | 38 //----------------------------------------------------------------------------- |
| 51 | 39 |
| 52 // Decodes the cert's subjectAltName extension into a CERT_ALT_NAME_INFO | 40 // Decodes the cert's subjectAltName extension into a CERT_ALT_NAME_INFO |
| 53 // structure and stores it in *output. | 41 // structure and stores it in *output. |
| 54 void GetCertSubjectAltName( | 42 void GetCertSubjectAltName( |
| 55 PCCERT_CONTEXT cert, | 43 PCCERT_CONTEXT cert, |
| 56 scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter>* output) { | 44 scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter>* output) { |
| 57 PCERT_EXTENSION extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2, | 45 PCERT_EXTENSION extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2, |
| 58 cert->pCertInfo->cExtension, | 46 cert->pCertInfo->cExtension, |
| 59 cert->pCertInfo->rgExtension); | 47 cert->pCertInfo->rgExtension); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 X509_ASN_ENCODING, | 480 X509_ASN_ENCODING, |
| 493 CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT, | 481 CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT, |
| 494 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), | 482 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), |
| 495 CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT, | 483 CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT, |
| 496 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), | 484 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), |
| 497 0, | 485 0, |
| 498 NULL); | 486 NULL); |
| 499 } | 487 } |
| 500 | 488 |
| 501 } // namespace net | 489 } // namespace net |
| OLD | NEW |