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 #ifndef NET_CERT_CT_OBJECTS_EXTRACTOR_H_ | 5 #ifndef NET_CERT_CT_OBJECTS_EXTRACTOR_H_ |
6 #define NET_CERT_CT_OBJECTS_EXTRACTOR_H_ | 6 #define NET_CERT_CT_OBJECTS_EXTRACTOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
12 #include "net/cert/x509_certificate.h" | 12 #include "net/cert/x509_certificate.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 namespace ct { | 16 namespace ct { |
17 | 17 |
18 struct LogEntry; | 18 struct SignedEntryData; |
19 | 19 |
20 // Extracts a SignedCertificateTimestampList that has been embedded within a | 20 // Extracts a SignedCertificateTimestampList that has been embedded within a |
21 // leaf cert as an X.509v3 extension with the OID 1.3.6.1.4.1.11129.2.4.2. | 21 // leaf cert as an X.509v3 extension with the OID 1.3.6.1.4.1.11129.2.4.2. |
22 // If the extension is present, returns true, updating |*sct_list| to contain | 22 // If the extension is present, returns true, updating |*sct_list| to contain |
23 // the encoded list, minus the DER encoding necessary for the extension. | 23 // the encoded list, minus the DER encoding necessary for the extension. |
24 // |*sct_list| can then be further decoded with ct::DecodeSCTList | 24 // |*sct_list| can then be further decoded with ct::DecodeSCTList |
25 NET_EXPORT_PRIVATE bool ExtractEmbeddedSCTList( | 25 NET_EXPORT_PRIVATE bool ExtractEmbeddedSCTList( |
26 X509Certificate::OSCertHandle cert, | 26 X509Certificate::OSCertHandle cert, |
27 std::string* sct_list); | 27 std::string* sct_list); |
28 | 28 |
29 // Obtains a PrecertChain log entry for |leaf|, an X.509v3 certificate that | 29 // Obtains a PrecertChain log entry for |leaf|, an X.509v3 certificate that |
30 // contains an X.509v3 extension with the OID 1.3.6.1.4.1.11129.2.4.2. On | 30 // contains an X.509v3 extension with the OID 1.3.6.1.4.1.11129.2.4.2. On |
31 // success, fills |*result| with the data for a PrecertChain log entry and | 31 // success, fills |*result| with the data for a PrecertChain log entry and |
32 // returns true. | 32 // returns true. |
33 // The filled |*result| should be verified using ct::CTLogVerifier::Verify | 33 // The filled |*result| should be verified using ct::CTLogVerifier::Verify |
34 // Note: If |leaf| does not contain the required extension, it is treated as | 34 // Note: If |leaf| does not contain the required extension, it is treated as |
35 // a failure. | 35 // a failure. |
36 NET_EXPORT_PRIVATE bool GetPrecertLogEntry(X509Certificate::OSCertHandle leaf, | 36 NET_EXPORT_PRIVATE bool GetPrecertSignedEntry( |
37 X509Certificate::OSCertHandle issuer, | 37 X509Certificate::OSCertHandle leaf, |
38 LogEntry* result); | 38 X509Certificate::OSCertHandle issuer, |
| 39 SignedEntryData* result); |
39 | 40 |
40 // Obtains an X509Chain log entry for |leaf|, an X.509v3 certificate that | 41 // Obtains an X509Chain log entry for |leaf|, an X.509v3 certificate that |
41 // is not expected to contain an X.509v3 extension with the OID | 42 // is not expected to contain an X.509v3 extension with the OID |
42 // 1.3.6.1.4.1.11129.2.4.2 (meaning a certificate without an embedded SCT). | 43 // 1.3.6.1.4.1.11129.2.4.2 (meaning a certificate without an embedded SCT). |
43 // On success, fills |result| with the data for an X509Chain log entry and | 44 // On success, fills |result| with the data for an X509Chain log entry and |
44 // returns true. | 45 // returns true. |
45 // The filled |*result| should be verified using ct::CTLogVerifier::Verify | 46 // The filled |*result| should be verified using ct::CTLogVerifier::Verify |
46 NET_EXPORT_PRIVATE bool GetX509LogEntry(X509Certificate::OSCertHandle leaf, | 47 NET_EXPORT_PRIVATE bool GetX509SignedEntry(X509Certificate::OSCertHandle leaf, |
47 LogEntry* result); | 48 SignedEntryData* result); |
48 | 49 |
49 // Extracts a SignedCertificateTimestampList that has been embedded within | 50 // Extracts a SignedCertificateTimestampList that has been embedded within |
50 // an OCSP response as an extension with the OID 1.3.6.1.4.1.11129.2.4.5. | 51 // an OCSP response as an extension with the OID 1.3.6.1.4.1.11129.2.4.5. |
51 // If the extension is present, and the response matches the issuer and | 52 // If the extension is present, and the response matches the issuer and |
52 // serial number, returns true, updating |*sct_list| to contain | 53 // serial number, returns true, updating |*sct_list| to contain |
53 // the encoded list, minus the DER encoding necessary for the extension. | 54 // the encoded list, minus the DER encoding necessary for the extension. |
54 // |*sct_list| can then be further decoded with ct::DecodeSCTList. | 55 // |*sct_list| can then be further decoded with ct::DecodeSCTList. |
55 NET_EXPORT_PRIVATE bool ExtractSCTListFromOCSPResponse( | 56 NET_EXPORT_PRIVATE bool ExtractSCTListFromOCSPResponse( |
56 X509Certificate::OSCertHandle issuer, | 57 X509Certificate::OSCertHandle issuer, |
57 const std::string& cert_serial_number, | 58 const std::string& cert_serial_number, |
58 base::StringPiece ocsp_response, | 59 base::StringPiece ocsp_response, |
59 std::string* sct_list); | 60 std::string* sct_list); |
60 | 61 |
61 } // namespace ct | 62 } // namespace ct |
62 | 63 |
63 } // namespace net | 64 } // namespace net |
64 | 65 |
65 #endif // NET_CERT_CT_OBJECTS_EXTRACTOR_H_ | 66 #endif // NET_CERT_CT_OBJECTS_EXTRACTOR_H_ |
OLD | NEW |