| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/crypto/scoped_nss_types.h" | 10 #include "base/crypto/scoped_nss_types.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 certs_dir = certs_dir.AppendASCII("certificates"); | 43 certs_dir = certs_dir.AppendASCII("certificates"); |
| 44 return certs_dir; | 44 return certs_dir; |
| 45 } | 45 } |
| 46 | 46 |
| 47 CertificateList ListCertsInSlot(PK11SlotInfo* slot) { | 47 CertificateList ListCertsInSlot(PK11SlotInfo* slot) { |
| 48 CertificateList result; | 48 CertificateList result; |
| 49 CERTCertList* cert_list = PK11_ListCertsInSlot(slot); | 49 CERTCertList* cert_list = PK11_ListCertsInSlot(slot); |
| 50 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); | 50 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); |
| 51 !CERT_LIST_END(node, cert_list); | 51 !CERT_LIST_END(node, cert_list); |
| 52 node = CERT_LIST_NEXT(node)) { | 52 node = CERT_LIST_NEXT(node)) { |
| 53 result.push_back( | 53 result.push_back(X509Certificate::CreateFromHandle( |
| 54 X509Certificate::CreateFromHandle( | 54 node->cert, X509Certificate::OSCertHandles())); |
| 55 node->cert, | |
| 56 X509Certificate::SOURCE_LONE_CERT_IMPORT, | |
| 57 X509Certificate::OSCertHandles())); | |
| 58 } | 55 } |
| 59 CERT_DestroyCertList(cert_list); | 56 CERT_DestroyCertList(cert_list); |
| 60 | 57 |
| 61 // Sort the result so that test comparisons can be deterministic. | 58 // Sort the result so that test comparisons can be deterministic. |
| 62 std::sort(result.begin(), result.end(), X509Certificate::LessThan()); | 59 std::sort(result.begin(), result.end(), X509Certificate::LessThan()); |
| 63 return result; | 60 return result; |
| 64 } | 61 } |
| 65 | 62 |
| 66 bool CleanupSlotContents(PK11SlotInfo* slot) { | 63 bool CleanupSlotContents(PK11SlotInfo* slot) { |
| 67 CertDatabase cert_db; | 64 CertDatabase cert_db; |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 puny_cert.get(), CA_CERT, | 479 puny_cert.get(), CA_CERT, |
| 483 CertDatabase::TRUSTED_SSL | CertDatabase::TRUSTED_EMAIL)); | 480 CertDatabase::TRUSTED_SSL | CertDatabase::TRUSTED_EMAIL)); |
| 484 | 481 |
| 485 verify_result.Reset(); | 482 verify_result.Reset(); |
| 486 error = puny_cert->Verify("xn--wgv71a119e.com", flags, &verify_result); | 483 error = puny_cert->Verify("xn--wgv71a119e.com", flags, &verify_result); |
| 487 EXPECT_EQ(OK, error); | 484 EXPECT_EQ(OK, error); |
| 488 EXPECT_EQ(0, verify_result.cert_status); | 485 EXPECT_EQ(0, verify_result.cert_status); |
| 489 } | 486 } |
| 490 | 487 |
| 491 } // namespace net | 488 } // namespace net |
| OLD | NEW |