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 19 matching lines...) Expand all Loading... |
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, | 38 void ExplodedTimeToSystemTime(const base::Time::Exploded& exploded, |
39 SYSTEMTIME* system_time) { | 39 SYSTEMTIME* system_time) { |
40 system_time->wYear = exploded.year; | 40 system_time->wYear = static_cast<WORD>(exploded.year); |
41 system_time->wMonth = exploded.month; | 41 system_time->wMonth = static_cast<WORD>(exploded.month); |
42 system_time->wDayOfWeek = exploded.day_of_week; | 42 system_time->wDayOfWeek = static_cast<WORD>(exploded.day_of_week); |
43 system_time->wDay = exploded.day_of_month; | 43 system_time->wDay = static_cast<WORD>(exploded.day_of_month); |
44 system_time->wHour = exploded.hour; | 44 system_time->wHour = static_cast<WORD>(exploded.hour); |
45 system_time->wMinute = exploded.minute; | 45 system_time->wMinute = static_cast<WORD>(exploded.minute); |
46 system_time->wSecond = exploded.second; | 46 system_time->wSecond = static_cast<WORD>(exploded.second); |
47 system_time->wMilliseconds = exploded.millisecond; | 47 system_time->wMilliseconds = static_cast<WORD>(exploded.millisecond); |
48 } | 48 } |
49 | 49 |
50 //----------------------------------------------------------------------------- | 50 //----------------------------------------------------------------------------- |
51 | 51 |
52 // Decodes the cert's subjectAltName extension into a CERT_ALT_NAME_INFO | 52 // Decodes the cert's subjectAltName extension into a CERT_ALT_NAME_INFO |
53 // structure and stores it in *output. | 53 // structure and stores it in *output. |
54 void GetCertSubjectAltName( | 54 void GetCertSubjectAltName( |
55 PCCERT_CONTEXT cert, | 55 PCCERT_CONTEXT cert, |
56 scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter>* output) { | 56 scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter>* output) { |
57 PCERT_EXTENSION extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2, | 57 PCERT_EXTENSION extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2, |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 X509_ASN_ENCODING, | 492 X509_ASN_ENCODING, |
493 CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT, | 493 CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT, |
494 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), | 494 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), |
495 CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT, | 495 CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT, |
496 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), | 496 reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), |
497 0, | 497 0, |
498 NULL); | 498 NULL); |
499 } | 499 } |
500 | 500 |
501 } // namespace net | 501 } // namespace net |
OLD | NEW |