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 #ifndef NET_TEST_CERT_TEST_UTIL_H_ | 5 #ifndef NET_TEST_CERT_TEST_UTIL_H_ |
6 #define NET_TEST_CERT_TEST_UTIL_H_ | 6 #define NET_TEST_CERT_TEST_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "net/cert/x509_cert_types.h" | 11 #include "net/cert/x509_cert_types.h" |
12 #include "net/cert/x509_certificate.h" | 12 #include "net/cert/x509_certificate.h" |
13 | 13 |
| 14 #if defined(USE_NSS) |
| 15 #include "base/memory/scoped_ptr.h" |
| 16 |
| 17 typedef struct PK11SlotInfoStr PK11SlotInfo; |
| 18 #endif |
| 19 |
14 namespace base { | 20 namespace base { |
15 class FilePath; | 21 class FilePath; |
16 } | 22 } |
17 | 23 |
| 24 namespace crypto { |
| 25 class RSAPrivateKey; |
| 26 } |
| 27 |
18 namespace net { | 28 namespace net { |
19 | 29 |
20 class EVRootCAMetadata; | 30 class EVRootCAMetadata; |
21 | 31 |
22 // Imports all of the certificates in |cert_file|, a file in |certs_dir|, | 32 #if defined(USE_NSS) |
23 // // into a CertificateList. | 33 // Imports a private key from file |key_filename| in |dir|. The file must |
| 34 // contain a PKCS#8 PrivateKeyInfo in DER encoding. The key is imported to |
| 35 // |slot|. |
| 36 scoped_ptr<crypto::RSAPrivateKey> ImportSensitiveKeyFromFile( |
| 37 const base::FilePath& dir, |
| 38 const std::string& key_filename, |
| 39 PK11SlotInfo* slot); |
| 40 #endif |
| 41 |
| 42 // Imports all of the certificates in |cert_file|, a file in |certs_dir|, into a |
| 43 // CertificateList. |
24 CertificateList CreateCertificateListFromFile(const base::FilePath& certs_dir, | 44 CertificateList CreateCertificateListFromFile(const base::FilePath& certs_dir, |
25 const std::string& cert_file, | 45 const std::string& cert_file, |
26 int format); | 46 int format); |
27 | 47 |
28 // Imports all of the certificates in |cert_file|, a file in |certs_dir|, into | 48 // Imports all of the certificates in |cert_file|, a file in |certs_dir|, into |
29 // a new X509Certificate. The first certificate in the chain will be used for | 49 // a new X509Certificate. The first certificate in the chain will be used for |
30 // the returned cert, with any additional certificates configured as | 50 // the returned cert, with any additional certificates configured as |
31 // intermediate certificates. | 51 // intermediate certificates. |
32 scoped_refptr<X509Certificate> CreateCertificateChainFromFile( | 52 scoped_refptr<X509Certificate> CreateCertificateChainFromFile( |
33 const base::FilePath& certs_dir, | 53 const base::FilePath& certs_dir, |
(...skipping 20 matching lines...) Expand all Loading... |
54 ~ScopedTestEVPolicy(); | 74 ~ScopedTestEVPolicy(); |
55 | 75 |
56 private: | 76 private: |
57 SHA1HashValue fingerprint_; | 77 SHA1HashValue fingerprint_; |
58 EVRootCAMetadata* const ev_root_ca_metadata_; | 78 EVRootCAMetadata* const ev_root_ca_metadata_; |
59 }; | 79 }; |
60 | 80 |
61 } // namespace net | 81 } // namespace net |
62 | 82 |
63 #endif // NET_TEST_CERT_TEST_UTIL_H_ | 83 #endif // NET_TEST_CERT_TEST_UTIL_H_ |
OLD | NEW |