Botan 2.19.5 Crypto and TLS for C&

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/pkix_types.h>
9#include <botan/x509cert.h>
10
11#if defined(BOTAN_HAS_CERTSTOR_MACOS)
12 #include <botan/certstor_macos.h>
13#elif defined(BOTAN_HAS_CERTSTOR_WINDOWS)
14 #include <botan/certstor_windows.h>
15#elif defined(BOTAN_HAS_CERTSTOR_FLATFILE) && defined(BOTAN_SYSTEM_CERT_BUNDLE)
16 #include <botan/certstor_flatfile.h>
17#endif
18
19 namespace Botan {
20
21 System_Certificate_Store::System_Certificate_Store()
22 {
23#if defined(BOTAN_HAS_CERTSTOR_MACOS)
24 m_system_store = std::make_shared<Certificate_Store_MacOS>();
25#elif defined(BOTAN_HAS_CERTSTOR_WINDOWS)
26 m_system_store = std::make_shared<Certificate_Store_Windows>();
27#elif defined(BOTAN_HAS_CERTSTOR_FLATFILE) && defined(BOTAN_SYSTEM_CERT_BUNDLE)
28 m_system_store = std::make_shared<Flatfile_Certificate_Store>(BOTAN_SYSTEM_CERT_BUNDLE, true);
29#else
30 throw Not_Implemented("No system certificate store available in this build");
31#endif
32 }
33
34std::shared_ptr<const X509_Certificate>
35 System_Certificate_Store::find_cert(const X509_DN& subject_dn, const std::vector<uint8_t>& key_id) const
36 {
37 return m_system_store->find_cert(subject_dn, key_id);
38 }
39
40std::vector<std::shared_ptr<const X509_Certificate>>
41 System_Certificate_Store::find_all_certs(const X509_DN& subject_dn,
42 const std::vector<uint8_t>& key_id) const
43 {
44 return m_system_store->find_all_certs(subject_dn, key_id);
45 }
46
47std::shared_ptr<const X509_Certificate>
48 System_Certificate_Store::find_cert_by_pubkey_sha1(const std::vector<uint8_t>& key_hash) const
49 {
50 return m_system_store->find_cert_by_pubkey_sha1(key_hash);
51 }
52
53std::shared_ptr<const X509_Certificate>
54 System_Certificate_Store::find_cert_by_raw_subject_dn_sha256(const std::vector<uint8_t>& subject_hash) const
55 {
56 return m_system_store->find_cert_by_raw_subject_dn_sha256(subject_hash);
57 }
58
59std::shared_ptr<const X509_CRL>
60 System_Certificate_Store::find_crl_for(const X509_Certificate& subject) const
61 {
62 return m_system_store->find_crl_for(subject);
63 }
64
65std::vector<X509_DN> System_Certificate_Store::all_subjects() const
66 {
67 return m_system_store->all_subjects();
68 }
69
70}
Botan::Not_Implemented
Definition: exceptn.h:356
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:60
Botan::System_Certificate_Store::all_subjects
std::vector< X509_DN > all_subjects() const override
Definition: certstor_system.cpp:65
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:54
Botan::System_Certificate_Store::System_Certificate_Store
System_Certificate_Store()
Definition: certstor_system.cpp:21
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:48
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:35
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:41
Botan::X509_Certificate
Definition: x509cert.h:38
Botan::X509_DN
Definition: pkix_types.h:43
Botan
Definition: alg_id.cpp:13