Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

certstor_system.cpp
Go to the documentation of this file.
1 /*
2 * (C) 2019 Jack Lloyd
3 *
4 * Botan is released under the Simplified BSD License (see license.txt)
5 */
6
7 #include <botan/certstor_system.h>
8 #include <botan/x509cert.h>
9
10 #if defined(BOTAN_HAS_CERTSTOR_MACOS)
11 #include <botan/certstor_macos.h>
12 #elif defined(BOTAN_HAS_CERTSTOR_WINDOWS)
13 #include <botan/certstor_windows.h>
14 #elif defined(BOTAN_HAS_CERTSTOR_FLATFILE) && defined(BOTAN_SYSTEM_CERT_BUNDLE)
15 #include <botan/certstor_flatfile.h>
16 #endif
17
18 namespace Botan {
19
20 System_Certificate_Store::System_Certificate_Store()
21 {
22 #if defined(BOTAN_HAS_CERTSTOR_MACOS)
23 m_system_store = std::make_shared<Certificate_Store_MacOS>();
24 #elif defined(BOTAN_HAS_CERTSTOR_WINDOWS)
25 m_system_store = std::make_shared<Certificate_Store_Windows>();
26 #elif defined(BOTAN_HAS_CERTSTOR_FLATFILE) && defined(BOTAN_SYSTEM_CERT_BUNDLE)
27 m_system_store = std::make_shared<Flatfile_Certificate_Store>(BOTAN_SYSTEM_CERT_BUNDLE, true);
28 #else
29 throw Not_Implemented("No system certificate store available in this build");
30 #endif
31 }
32
33 std::shared_ptr<const X509_Certificate>
34 System_Certificate_Store::find_cert(const X509_DN& subject_dn, const std::vector<uint8_t>& key_id) const
35 {
36 return m_system_store->find_cert(subject_dn, key_id);
37 }
38
39 std::vector<std::shared_ptr<const X509_Certificate>>
40 System_Certificate_Store::find_all_certs(const X509_DN& subject_dn,
41 const std::vector<uint8_t>& key_id) const
42 {
43 return m_system_store->find_all_certs(subject_dn, key_id);
44 }
45
46 std::shared_ptr<const X509_Certificate>
47 System_Certificate_Store::find_cert_by_pubkey_sha1(const std::vector<uint8_t>& key_hash) const
48 {
49 return m_system_store->find_cert_by_pubkey_sha1(key_hash);
50 }
51
52 std::shared_ptr<const X509_Certificate>
53 System_Certificate_Store::find_cert_by_raw_subject_dn_sha256(const std::vector<uint8_t>& subject_hash) const
54 {
55 return m_system_store->find_cert_by_raw_subject_dn_sha256(subject_hash);
56 }
57
58 std::shared_ptr<const X509_CRL>
59 System_Certificate_Store::find_crl_for(const X509_Certificate& subject) const
60 {
61 return m_system_store->find_crl_for(subject);
62 }
63
64 std::vector<X509_DN> System_Certificate_Store::all_subjects() const
65 {
66 return m_system_store->all_subjects();
67 }
68
69 }
Botan::System_Certificate_Store::all_subjects
std::vector< X509_DN > all_subjects() const override
Definition: certstor_system.cpp:64
Botan::System_Certificate_Store::find_cert_by_pubkey_sha1
std::shared_ptr< const X509_Certificate > find_cert_by_pubkey_sha1(const std::vector< uint8_t > &key_hash) const override
Definition: certstor_system.cpp:47
Botan::Not_Implemented
Definition: exceptn.h:355
Botan::System_Certificate_Store::find_crl_for
std::shared_ptr< const X509_CRL > find_crl_for(const X509_Certificate &subject) const override
Definition: certstor_system.cpp:59
Botan::X509_Certificate
Definition: x509cert.h:40
Botan::System_Certificate_Store::find_cert_by_raw_subject_dn_sha256
std::shared_ptr< const X509_Certificate > find_cert_by_raw_subject_dn_sha256(const std::vector< uint8_t > &subject_hash) const override
Definition: certstor_system.cpp:53
Botan::System_Certificate_Store::find_all_certs
std::vector< std::shared_ptr< const X509_Certificate > > find_all_certs(const X509_DN &subject_dn, const std::vector< uint8_t > &key_id) const override
Definition: certstor_system.cpp:40
Botan::X509_DN
Definition: x509_dn.h:24
Botan
Definition: alg_id.cpp:13
Botan::System_Certificate_Store::System_Certificate_Store
System_Certificate_Store()
Definition: certstor_system.cpp:20
Botan::System_Certificate_Store::find_cert
std::shared_ptr< const X509_Certificate > find_cert(const X509_DN &subject_dn, const std::vector< uint8_t > &key_id) const override
Definition: certstor_system.cpp:34