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