| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 issuer_.ParseDistinguishedName(cert_handle_->pCertInfo->Issuer.pbData, | 157 issuer_.ParseDistinguishedName(cert_handle_->pCertInfo->Issuer.pbData, |
| 158 cert_handle_->pCertInfo->Issuer.cbData); | 158 cert_handle_->pCertInfo->Issuer.cbData); |
| 159 | 159 |
| 160 valid_start_ = Time::FromFileTime(cert_handle_->pCertInfo->NotBefore); | 160 valid_start_ = Time::FromFileTime(cert_handle_->pCertInfo->NotBefore); |
| 161 valid_expiry_ = Time::FromFileTime(cert_handle_->pCertInfo->NotAfter); | 161 valid_expiry_ = Time::FromFileTime(cert_handle_->pCertInfo->NotAfter); |
| 162 | 162 |
| 163 fingerprint_ = CalculateFingerprint(cert_handle_); | 163 fingerprint_ = CalculateFingerprint(cert_handle_); |
| 164 ca_fingerprint_ = CalculateCAFingerprint(intermediate_ca_certs_); | 164 ca_fingerprint_ = CalculateCAFingerprint(intermediate_ca_certs_); |
| 165 | 165 |
| 166 const CRYPT_INTEGER_BLOB* serial = &cert_handle_->pCertInfo->SerialNumber; | 166 const CRYPT_INTEGER_BLOB* serial = &cert_handle_->pCertInfo->SerialNumber; |
| 167 scoped_ptr<uint8[]> serial_bytes(new uint8[serial->cbData]); | 167 scoped_ptr<uint8_t[]> serial_bytes(new uint8_t[serial->cbData]); |
| 168 for (unsigned i = 0; i < serial->cbData; i++) | 168 for (unsigned i = 0; i < serial->cbData; i++) |
| 169 serial_bytes[i] = serial->pbData[serial->cbData - i - 1]; | 169 serial_bytes[i] = serial->pbData[serial->cbData - i - 1]; |
| 170 serial_number_ = std::string( | 170 serial_number_ = std::string( |
| 171 reinterpret_cast<char*>(serial_bytes.get()), serial->cbData); | 171 reinterpret_cast<char*>(serial_bytes.get()), serial->cbData); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void X509Certificate::GetSubjectAltName( | 174 void X509Certificate::GetSubjectAltName( |
| 175 std::vector<std::string>* dns_names, | 175 std::vector<std::string>* dns_names, |
| 176 std::vector<std::string>* ip_addrs) const { | 176 std::vector<std::string>* ip_addrs) const { |
| 177 if (dns_names) | 177 if (dns_names) |
| (...skipping 314 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 |