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_CERTS) | 14 #if defined(USE_NSS_CERTS) |
| 15 #include "base/memory/scoped_ptr.h" |
| 16 |
15 // From <pk11pub.h> | 17 // From <pk11pub.h> |
16 typedef struct PK11SlotInfoStr PK11SlotInfo; | 18 typedef struct PK11SlotInfoStr PK11SlotInfo; |
17 #endif | 19 #endif |
18 | 20 |
19 namespace base { | 21 namespace base { |
20 class FilePath; | 22 class FilePath; |
21 } | 23 } |
22 | 24 |
23 namespace crypto { | 25 namespace crypto { |
24 class RSAPrivateKey; | 26 class RSAPrivateKey; |
25 } | 27 } |
26 | 28 |
27 namespace net { | 29 namespace net { |
28 | 30 |
29 class EVRootCAMetadata; | 31 class EVRootCAMetadata; |
30 | 32 |
31 #if defined(USE_NSS_CERTS) | 33 #if defined(USE_NSS_CERTS) |
32 // Imports a private key from file |key_filename| in |dir| into |slot|. The file | 34 // Imports a private key from file |key_filename| in |dir|. The file must |
33 // must contain a PKCS#8 PrivateKeyInfo in DER encoding. Returns true on success | 35 // contain a PKCS#8 PrivateKeyInfo in DER encoding. The key is imported to |
34 // and false on failure. | 36 // |slot|. |
35 bool ImportSensitiveKeyFromFile(const base::FilePath& dir, | 37 scoped_ptr<crypto::RSAPrivateKey> ImportSensitiveKeyFromFile( |
36 const std::string& key_filename, | 38 const base::FilePath& dir, |
37 PK11SlotInfo* slot); | 39 const std::string& key_filename, |
| 40 PK11SlotInfo* slot); |
38 | 41 |
39 bool ImportClientCertToSlot(const scoped_refptr<X509Certificate>& cert, | 42 bool ImportClientCertToSlot(const scoped_refptr<X509Certificate>& cert, |
40 PK11SlotInfo* slot); | 43 PK11SlotInfo* slot); |
41 | 44 |
42 scoped_refptr<X509Certificate> ImportClientCertAndKeyFromFile( | 45 scoped_refptr<X509Certificate> ImportClientCertAndKeyFromFile( |
43 const base::FilePath& dir, | 46 const base::FilePath& dir, |
44 const std::string& cert_filename, | 47 const std::string& cert_filename, |
45 const std::string& key_filename, | 48 const std::string& key_filename, |
46 PK11SlotInfo* slot); | 49 PK11SlotInfo* slot); |
47 #endif | 50 #endif |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 ~ScopedTestEVPolicy(); | 84 ~ScopedTestEVPolicy(); |
82 | 85 |
83 private: | 86 private: |
84 SHA1HashValue fingerprint_; | 87 SHA1HashValue fingerprint_; |
85 EVRootCAMetadata* const ev_root_ca_metadata_; | 88 EVRootCAMetadata* const ev_root_ca_metadata_; |
86 }; | 89 }; |
87 | 90 |
88 } // namespace net | 91 } // namespace net |
89 | 92 |
90 #endif // NET_TEST_CERT_TEST_UTIL_H_ | 93 #endif // NET_TEST_CERT_TEST_UTIL_H_ |
OLD | NEW |