| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ct_objects_extractor.h" | 5 #include "net/cert/ct_objects_extractor.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <openssl/bytestring.h> | 9 #include <openssl/bytestring.h> |
| 10 #include <openssl/obj.h> | 10 #include <openssl/obj.h> |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (len < 0) | 225 if (len < 0) |
| 226 return false; | 226 return false; |
| 227 uint8_t* ptr = | 227 uint8_t* ptr = |
| 228 reinterpret_cast<uint8_t*>(base::WriteInto(&to_be_signed, len + 1)); | 228 reinterpret_cast<uint8_t*>(base::WriteInto(&to_be_signed, len + 1)); |
| 229 if (i2d_X509_CINF(leaf_copy->cert_info, &ptr) < 0) | 229 if (i2d_X509_CINF(leaf_copy->cert_info, &ptr) < 0) |
| 230 return false; | 230 return false; |
| 231 | 231 |
| 232 // Extract the issuer's public key. | 232 // Extract the issuer's public key. |
| 233 std::string issuer_der; | 233 std::string issuer_der; |
| 234 if (!X509Certificate::GetDEREncoded(issuer, &issuer_der)) | 234 if (!X509Certificate::GetDEREncoded(issuer, &issuer_der)) |
| 235 return ScopedX509(); | 235 return false; |
| 236 base::StringPiece issuer_key; | 236 base::StringPiece issuer_key; |
| 237 if (!asn1::ExtractSPKIFromDERCert(issuer_der, &issuer_key)) | 237 if (!asn1::ExtractSPKIFromDERCert(issuer_der, &issuer_key)) |
| 238 return false; | 238 return false; |
| 239 | 239 |
| 240 // Fill in the LogEntry. | 240 // Fill in the LogEntry. |
| 241 result->type = ct::LogEntry::LOG_ENTRY_TYPE_PRECERT; | 241 result->type = ct::LogEntry::LOG_ENTRY_TYPE_PRECERT; |
| 242 result->tbs_certificate.swap(to_be_signed); | 242 result->tbs_certificate.swap(to_be_signed); |
| 243 crypto::SHA256HashString(issuer_key, | 243 crypto::SHA256HashString(issuer_key, |
| 244 result->issuer_key_hash.data, | 244 result->issuer_key_hash.data, |
| 245 sizeof(result->issuer_key_hash.data)); | 245 sizeof(result->issuer_key_hash.data)); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 if (!x509_exts || ptr != CBS_data(&extensions) + CBS_len(&extensions)) | 355 if (!x509_exts || ptr != CBS_data(&extensions) + CBS_len(&extensions)) |
| 356 return false; | 356 return false; |
| 357 | 357 |
| 358 return GetSCTListFromX509_EXTENSIONS( | 358 return GetSCTListFromX509_EXTENSIONS( |
| 359 x509_exts.get(), kOCSPExtensionOid, sizeof(kOCSPExtensionOid), sct_list); | 359 x509_exts.get(), kOCSPExtensionOid, sizeof(kOCSPExtensionOid), sct_list); |
| 360 } | 360 } |
| 361 | 361 |
| 362 } // namespace ct | 362 } // namespace ct |
| 363 | 363 |
| 364 } // namespace net | 364 } // namespace net |
| OLD | NEW |