OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
6 | 6 |
7 #include <CommonCrypto/CommonDigest.h> | 7 #include <CommonCrypto/CommonDigest.h> |
8 #include <Security/Security.h> | 8 #include <Security/Security.h> |
9 #include <time.h> | 9 #include <time.h> |
10 | 10 |
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 } | 1121 } |
1122 if (i < certs->size()) | 1122 if (i < certs->size()) |
1123 continue; | 1123 continue; |
1124 | 1124 |
1125 bool is_preferred = preferred_identity && | 1125 bool is_preferred = preferred_identity && |
1126 CFEqual(preferred_identity, identity); | 1126 CFEqual(preferred_identity, identity); |
1127 | 1127 |
1128 // Make sure the issuer matches valid_issuers, if given. | 1128 // Make sure the issuer matches valid_issuers, if given. |
1129 // But an explicit cert preference overrides this. | 1129 // But an explicit cert preference overrides this. |
1130 if (!is_preferred && | 1130 if (!is_preferred && |
1131 valid_issuers.size() > 0 && | 1131 !valid_issuers.empty() && |
1132 !cert->IsIssuedBy(valid_issuers)) | 1132 !cert->IsIssuedBy(valid_issuers)) |
1133 continue; | 1133 continue; |
1134 | 1134 |
1135 // The cert passes, so add it to the vector. | 1135 // The cert passes, so add it to the vector. |
1136 // If it's the preferred identity, add it at the start (so it'll be | 1136 // If it's the preferred identity, add it at the start (so it'll be |
1137 // selected by default in the UI.) | 1137 // selected by default in the UI.) |
1138 if (is_preferred) | 1138 if (is_preferred) |
1139 certs->insert(certs->begin(), cert); | 1139 certs->insert(certs->begin(), cert); |
1140 else | 1140 else |
1141 certs->push_back(cert); | 1141 certs->push_back(cert); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 CFArrayAppendArray(chain, | 1176 CFArrayAppendArray(chain, |
1177 cert_chain, | 1177 cert_chain, |
1178 CFRangeMake(1, chain_count - 1)); | 1178 CFRangeMake(1, chain_count - 1)); |
1179 } | 1179 } |
1180 } | 1180 } |
1181 | 1181 |
1182 return chain.release(); | 1182 return chain.release(); |
1183 } | 1183 } |
1184 | 1184 |
1185 } // namespace net | 1185 } // namespace net |
OLD | NEW |