Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_CERT_OCSP_PARSER_H_ | |
| 6 #define NET_CERT_OCSP_PARSER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "net/cert/internal/parse_certificate.h" | |
| 13 #include "net/cert/internal/signature_algorithm.h" | |
| 14 #include "net/der/input.h" | |
| 15 #include "net/der/parse_values.h" | |
| 16 #include "net/der/parser.h" | |
| 17 #include "net/der/tag.h" | |
| 18 | |
| 19 namespace net { | |
| 20 | |
| 21 namespace ct { | |
|
Ryan Sleevi
2015/12/30 18:55:18
wrong namespace ;)
svaldez
2015/12/30 19:31:37
Done.
| |
| 22 | |
| 23 // 1.3.6.1.5.5.7.48.1.1 - Basic OCSP Response | |
| 24 const uint8_t kOidPkixOcspBasic[] = {0x2b, 0x06, 0x01, 0x05, 0x05, | |
|
Ryan Sleevi
2015/12/30 18:55:18
Don't want this in a header (will end up duplicati
svaldez
2015/12/30 19:31:37
Done.
| |
| 25 0x07, 0x30, 0x01, 0x01}; | |
| 26 | |
| 27 enum OCSPRevocationReason { | |
|
Ryan Sleevi
2015/12/30 18:55:18
Inline to single response?
svaldez
2015/12/30 19:31:37
Done.
| |
| 28 OCSP_REVOKE_UNSPECIFIED, | |
| 29 OCSP_REVOKE_KEY_COMPROMISE, | |
| 30 OCSP_REVOKE_CA_COMPROMISE, | |
| 31 OCSP_REVOKE_AFFILIATION_CHANGED, | |
| 32 OCSP_REVOKE_SUPERSEDED, | |
| 33 OCSP_REVOKE_CESSATION_OF_OPERATION, | |
| 34 OCSP_REVOKE_CERTIFICATE_HOLD, | |
| 35 OCSP_REVOKE_UNUSED, | |
| 36 OCSP_REVOKE_REMOVE_FROM_CRL, | |
| 37 OCSP_REVOKE_PRIVILEGE_WITHDRAWN, | |
| 38 OCSP_REVOKE_A_COMPROMISE, | |
| 39 }; | |
| 40 | |
| 41 enum OCSPCertStatus { | |
|
Ryan Sleevi
2015/12/30 18:55:18
Inline to single response?
svaldez
2015/12/30 19:31:37
Done.
| |
| 42 OCSP_CERT_GOOD, | |
| 43 OCSP_CERT_REVOKED, | |
| 44 OCSP_CERT_UNKNOWN, | |
| 45 }; | |
| 46 | |
| 47 enum OCSPResponseStatus { | |
|
Ryan Sleevi
2015/12/30 18:55:18
inline to Response
svaldez
2015/12/30 19:31:37
Done.
| |
| 48 OCSP_SUCCESSFUL, | |
| 49 OCSP_MALFORMED_REQUEST, | |
| 50 OCSP_INTERNAL_ERROR, | |
| 51 OCSP_TRY_LATER, | |
| 52 OCSP_SIG_REQUIRED, | |
| 53 OCSP_UNAUTHORIZED, | |
| 54 }; | |
| 55 | |
| 56 struct OCSPSingleResponse { | |
| 57 OCSPSingleResponse(); | |
| 58 ~OCSPSingleResponse(); | |
| 59 | |
| 60 std::string cert_id; | |
| 61 OCSPCertStatus cert_status; | |
| 62 der::GeneralizedTime revocation_time; | |
| 63 OCSPRevocationReason revocation_reason; | |
| 64 der::GeneralizedTime this_update; | |
| 65 der::GeneralizedTime next_update; | |
| 66 std::vector<ParsedExtension> extensions; | |
| 67 }; | |
| 68 | |
| 69 struct OCSPResponseData { | |
| 70 OCSPResponseData(); | |
| 71 ~OCSPResponseData(); | |
| 72 | |
| 73 uint8_t version; | |
| 74 std::string responder_id_name; | |
| 75 std::string responder_id_key; | |
| 76 der::GeneralizedTime produced_at; | |
| 77 std::vector<OCSPSingleResponse> responses; | |
| 78 std::vector<ParsedExtension> extensions; | |
|
Ryan Sleevi
2015/12/30 18:55:18
Not sure if we want to fully parse these; much of
| |
| 79 }; | |
| 80 | |
| 81 struct NET_EXPORT OCSPResponse { | |
| 82 OCSPResponse(); | |
| 83 ~OCSPResponse(); | |
| 84 | |
| 85 OCSPResponseStatus status; | |
| 86 OCSPResponseData data; | |
| 87 scoped_ptr<SignatureAlgorithm> signature_algorithm; | |
| 88 der::BitString signature; | |
| 89 std::vector<ParsedCertificate> certs; | |
| 90 }; | |
| 91 | |
| 92 // Parses the OCSP Response. | |
| 93 NET_EXPORT_PRIVATE bool ParseOCSPResponse(const std::string& ocsp_response, | |
| 94 OCSPResponse* response); | |
| 95 | |
| 96 } // namespace ct | |
| 97 | |
| 98 } // namespace net | |
| 99 | |
| 100 #endif // NET_CERT_OCSP_PARSER_H_ | |
| OLD | NEW |