| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/internal/parse_ocsp.h" | 5 #include "net/cert/internal/parse_ocsp.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "net/cert/internal/test_helpers.h" | 9 #include "net/cert/internal/test_helpers.h" |
| 10 #include "net/cert/x509_certificate.h" | 10 #include "net/cert/x509_certificate.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (!ParseOCSPResponseData(parsed_ocsp.data, &parsed_ocsp_data)) | 73 if (!ParseOCSPResponseData(parsed_ocsp.data, &parsed_ocsp_data)) |
| 74 return PARSE_OCSP_DATA; | 74 return PARSE_OCSP_DATA; |
| 75 | 75 |
| 76 OCSPCertStatus status; | 76 OCSPCertStatus status; |
| 77 | 77 |
| 78 if (!GetOCSPCertStatus(parsed_ocsp_data, issuer_tbs_certificate_tlv, | 78 if (!GetOCSPCertStatus(parsed_ocsp_data, issuer_tbs_certificate_tlv, |
| 79 cert_tbs_certificate_tlv, &status)) | 79 cert_tbs_certificate_tlv, &status)) |
| 80 return PARSE_OCSP_SINGLE_RESPONSE; | 80 return PARSE_OCSP_SINGLE_RESPONSE; |
| 81 | 81 |
| 82 switch (status.status) { | 82 switch (status.status) { |
| 83 case OCSPCertStatus::Status::GOOD: | 83 case OCSPRevocationStatus::GOOD: |
| 84 return OCSP_SUCCESS; | 84 return OCSP_SUCCESS; |
| 85 case OCSPCertStatus::Status::REVOKED: | 85 case OCSPRevocationStatus::REVOKED: |
| 86 return OCSP_SUCCESS_REVOKED; | 86 return OCSP_SUCCESS_REVOKED; |
| 87 case OCSPCertStatus::Status::UNKNOWN: | 87 case OCSPRevocationStatus::UNKNOWN: |
| 88 return OCSP_SUCCESS_UNKNOWN; | 88 return OCSP_SUCCESS_UNKNOWN; |
| 89 } | 89 } |
| 90 | 90 |
| 91 return OCSP_SUCCESS_UNKNOWN; | 91 return OCSP_SUCCESS_UNKNOWN; |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace | 94 } // namespace |
| 95 | 95 |
| 96 TEST(ParseOCSPTest, OCSPGoodResponse) { | 96 TEST(ParseOCSPTest, OCSPGoodResponse) { |
| 97 ASSERT_EQ(OCSP_SUCCESS, ParseOCSP("good_response.pem")); | 97 ASSERT_EQ(OCSP_SUCCESS, ParseOCSP("good_response.pem")); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 der::EncodeTimeAsGeneralizedTime(this_update, &response.this_update)); | 306 der::EncodeTimeAsGeneralizedTime(this_update, &response.this_update)); |
| 307 response.has_next_update = false; | 307 response.has_next_update = false; |
| 308 #if defined(OS_WIN) | 308 #if defined(OS_WIN) |
| 309 EXPECT_FALSE(CheckOCSPDateValid(response, verify_time, kOCSPAgeOneWeek)); | 309 EXPECT_FALSE(CheckOCSPDateValid(response, verify_time, kOCSPAgeOneWeek)); |
| 310 #else | 310 #else |
| 311 EXPECT_TRUE(CheckOCSPDateValid(response, verify_time, kOCSPAgeOneWeek)); | 311 EXPECT_TRUE(CheckOCSPDateValid(response, verify_time, kOCSPAgeOneWeek)); |
| 312 #endif | 312 #endif |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace net | 315 } // namespace net |
| OLD | NEW |