OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
9 #include <Security/Security.h> | 9 #include <Security/Security.h> |
10 #include <time.h> | 10 #include <time.h> |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 if ((*certs)[i]->fingerprint().Equals(fingerprint)) | 1486 if ((*certs)[i]->fingerprint().Equals(fingerprint)) |
1487 break; | 1487 break; |
1488 } | 1488 } |
1489 if (i < certs->size()) | 1489 if (i < certs->size()) |
1490 continue; | 1490 continue; |
1491 | 1491 |
1492 bool is_preferred = preferred_identity && | 1492 bool is_preferred = preferred_identity && |
1493 CFEqual(preferred_identity, identity); | 1493 CFEqual(preferred_identity, identity); |
1494 | 1494 |
1495 // Make sure the issuer matches valid_issuers, if given. | 1495 // Make sure the issuer matches valid_issuers, if given. |
1496 // But an explicit cert preference overrides this. | 1496 if (!valid_issuers.empty() && !cert->IsIssuedBy(valid_issuers)) |
1497 if (!is_preferred && | |
1498 !valid_issuers.empty() && | |
1499 !cert->IsIssuedBy(valid_issuers)) | |
1500 continue; | 1497 continue; |
1501 | 1498 |
1502 // The cert passes, so add it to the vector. | 1499 // The cert passes, so add it to the vector. |
1503 // If it's the preferred identity, add it at the start (so it'll be | 1500 // If it's the preferred identity, add it at the start (so it'll be |
1504 // selected by default in the UI.) | 1501 // selected by default in the UI.) |
1505 if (is_preferred) | 1502 if (is_preferred) |
1506 certs->insert(certs->begin(), cert); | 1503 certs->insert(certs->begin(), cert); |
1507 else | 1504 else |
1508 certs->push_back(cert); | 1505 certs->push_back(cert); |
1509 } | 1506 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 *type = kPublicKeyTypeDH; | 1623 *type = kPublicKeyTypeDH; |
1627 break; | 1624 break; |
1628 default: | 1625 default: |
1629 *type = kPublicKeyTypeUnknown; | 1626 *type = kPublicKeyTypeUnknown; |
1630 *size_bits = 0; | 1627 *size_bits = 0; |
1631 break; | 1628 break; |
1632 } | 1629 } |
1633 } | 1630 } |
1634 | 1631 |
1635 } // namespace net | 1632 } // namespace net |
OLD | NEW |