OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/cert_status_flags.h" | 5 #include "net/base/cert_status_flags.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 int MapCertStatusToNetError(CertStatus cert_status) { | 51 int MapCertStatusToNetError(CertStatus cert_status) { |
52 // A certificate may have multiple errors. We report the most | 52 // A certificate may have multiple errors. We report the most |
53 // serious error. | 53 // serious error. |
54 | 54 |
55 // Unrecoverable errors | 55 // Unrecoverable errors |
56 if (cert_status & CERT_STATUS_REVOKED) | 56 if (cert_status & CERT_STATUS_REVOKED) |
57 return ERR_CERT_REVOKED; | 57 return ERR_CERT_REVOKED; |
58 if (cert_status & CERT_STATUS_INVALID) | 58 if (cert_status & CERT_STATUS_INVALID) |
59 return ERR_CERT_INVALID; | 59 return ERR_CERT_INVALID; |
| 60 if (cert_status & CERT_STATUS_WEAK_SIGNATURE_ALGORITHM) |
| 61 return ERR_CERT_WEAK_SIGNATURE_ALGORITHM; |
60 | 62 |
61 // Recoverable errors | 63 // Recoverable errors |
62 if (cert_status & CERT_STATUS_AUTHORITY_INVALID) | 64 if (cert_status & CERT_STATUS_AUTHORITY_INVALID) |
63 return ERR_CERT_AUTHORITY_INVALID; | 65 return ERR_CERT_AUTHORITY_INVALID; |
64 if (cert_status & CERT_STATUS_COMMON_NAME_INVALID) | 66 if (cert_status & CERT_STATUS_COMMON_NAME_INVALID) |
65 return ERR_CERT_COMMON_NAME_INVALID; | 67 return ERR_CERT_COMMON_NAME_INVALID; |
66 if (cert_status & CERT_STATUS_WEAK_SIGNATURE_ALGORITHM) | |
67 return ERR_CERT_WEAK_SIGNATURE_ALGORITHM; | |
68 if (cert_status & CERT_STATUS_DATE_INVALID) | 68 if (cert_status & CERT_STATUS_DATE_INVALID) |
69 return ERR_CERT_DATE_INVALID; | 69 return ERR_CERT_DATE_INVALID; |
70 | 70 |
71 // Unknown status. Give it the benefit of the doubt. | 71 // Unknown status. Give it the benefit of the doubt. |
72 if (cert_status & CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) | 72 if (cert_status & CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) |
73 return ERR_CERT_UNABLE_TO_CHECK_REVOCATION; | 73 return ERR_CERT_UNABLE_TO_CHECK_REVOCATION; |
74 if (cert_status & CERT_STATUS_NO_REVOCATION_MECHANISM) | 74 if (cert_status & CERT_STATUS_NO_REVOCATION_MECHANISM) |
75 return ERR_CERT_NO_REVOCATION_MECHANISM; | 75 return ERR_CERT_NO_REVOCATION_MECHANISM; |
76 if (cert_status & CERT_STATUS_NOT_IN_DNS) | 76 if (cert_status & CERT_STATUS_NOT_IN_DNS) |
77 return ERR_CERT_NOT_IN_DNS; | 77 return ERR_CERT_NOT_IN_DNS; |
78 | 78 |
79 NOTREACHED(); | 79 NOTREACHED(); |
80 return ERR_UNEXPECTED; | 80 return ERR_UNEXPECTED; |
81 } | 81 } |
82 | 82 |
83 } // namespace net | 83 } // namespace net |
OLD | NEW |