| 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 <cert.h> | 5 #include <cert.h> |
| 6 #include <pk11pub.h> | 6 #include <pk11pub.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 certs_dir = certs_dir.AppendASCII("certificates"); | 44 certs_dir = certs_dir.AppendASCII("certificates"); |
| 45 return certs_dir; | 45 return certs_dir; |
| 46 } | 46 } |
| 47 | 47 |
| 48 CertificateList ListCertsInSlot(PK11SlotInfo* slot) { | 48 CertificateList ListCertsInSlot(PK11SlotInfo* slot) { |
| 49 CertificateList result; | 49 CertificateList result; |
| 50 CERTCertList* cert_list = PK11_ListCertsInSlot(slot); | 50 CERTCertList* cert_list = PK11_ListCertsInSlot(slot); |
| 51 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); | 51 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); |
| 52 !CERT_LIST_END(node, cert_list); | 52 !CERT_LIST_END(node, cert_list); |
| 53 node = CERT_LIST_NEXT(node)) { | 53 node = CERT_LIST_NEXT(node)) { |
| 54 result.push_back( | 54 result.push_back(X509Certificate::CreateFromHandle( |
| 55 X509Certificate::CreateFromHandle( | 55 node->cert, X509Certificate::OSCertHandles())); |
| 56 node->cert, | |
| 57 X509Certificate::SOURCE_LONE_CERT_IMPORT, | |
| 58 X509Certificate::OSCertHandles())); | |
| 59 } | 56 } |
| 60 CERT_DestroyCertList(cert_list); | 57 CERT_DestroyCertList(cert_list); |
| 61 | 58 |
| 62 // Sort the result so that test comparisons can be deterministic. | 59 // Sort the result so that test comparisons can be deterministic. |
| 63 std::sort(result.begin(), result.end(), X509Certificate::LessThan()); | 60 std::sort(result.begin(), result.end(), X509Certificate::LessThan()); |
| 64 return result; | 61 return result; |
| 65 } | 62 } |
| 66 | 63 |
| 67 bool CleanupSlotContents(PK11SlotInfo* slot) { | 64 bool CleanupSlotContents(PK11SlotInfo* slot) { |
| 68 CertDatabase cert_db; | 65 CertDatabase cert_db; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 puny_cert.get(), CA_CERT, | 546 puny_cert.get(), CA_CERT, |
| 550 CertDatabase::TRUSTED_SSL | CertDatabase::TRUSTED_EMAIL)); | 547 CertDatabase::TRUSTED_SSL | CertDatabase::TRUSTED_EMAIL)); |
| 551 | 548 |
| 552 verify_result.Reset(); | 549 verify_result.Reset(); |
| 553 error = puny_cert->Verify("xn--wgv71a119e.com", flags, &verify_result); | 550 error = puny_cert->Verify("xn--wgv71a119e.com", flags, &verify_result); |
| 554 EXPECT_EQ(OK, error); | 551 EXPECT_EQ(OK, error); |
| 555 EXPECT_EQ(0, verify_result.cert_status); | 552 EXPECT_EQ(0, verify_result.cert_status); |
| 556 } | 553 } |
| 557 | 554 |
| 558 } // namespace net | 555 } // namespace net |
| OLD | NEW |