Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Botan::System_Certificate_Store Class Referencefinal

`#include <certstor_system.h>`

Inheritance diagram for Botan::System_Certificate_Store:

## Public Member Functions
std::vector< X509_DN > | all_subjects () const override
bool | certificate_known (const X509_Certificate &cert) const
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
std::shared_ptr< const X509_Certificate > | find_cert (const X509_DN &subject_dn, const std::vector< uint8_t > &key_id) const override
std::shared_ptr< const X509_Certificate > | find_cert_by_pubkey_sha1 (const std::vector< uint8_t > &key_hash) const override
std::shared_ptr< const X509_Certificate > | find_cert_by_raw_subject_dn_sha256 (const std::vector< uint8_t > &subject_hash) const override
std::shared_ptr< const X509_CRL > | find_crl_for (const X509_Certificate &subject) const override
| System_Certificate_Store ()

## Detailed Description

Definition at line 14 of file certstor_system.h.

## Constructor & Destructor Documentation

Botan::System_Certificate_Store::System_Certificate_Store | ( |  | ) |

Definition at line 20 of file certstor_system.cpp.

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 }

## Member Function Documentation

std::vector< X509_DN > Botan::System_Certificate_Store::all_subjects | ( |  | ) | const
| override virtual

Implements Botan::Certificate_Store.

Definition at line 64 of file certstor_system.cpp.

65 {
66 return m_system_store->all_subjects();
67 }

bool Botan::Certificate_Store::certificate_known | ( | const X509_Certificate & | cert | ) | const
| inline inherited

Returns
  whether the certificate is known

Parameters

  cert | certififcate to be searched

Definition at line 70 of file certstor.h.

References Botan::X509_Certificate::subject_dn(), and Botan::X509_Certificate::subject_key_id().

71 {
72 return find_cert(cert.subject_dn(), cert.subject_key_id()) != nullptr;
73 }
Botan::Certificate_Store::find_cert
virtual std::shared_ptr< const X509_Certificate > find_cert(const X509_DN &subject_dn, const std::vector< uint8_t > &key_id) const =0

std::vector< std::shared_ptr< const X509_Certificate > > Botan::System_Certificate_Store::find_all_certs | ( | const X509_DN & | subject_dn,
|  | const std::vector< uint8_t > & | key_id
| ) |  | const
| override virtual

Find all certificates with a given Subject DN. Subject DN and even the key identifier might not be unique.

Implements Botan::Certificate_Store.

Definition at line 40 of file certstor_system.cpp.

42 {
43 return m_system_store->find_all_certs(subject_dn, key_id);
44 }

std::shared_ptr< const X509_Certificate > Botan::System_Certificate_Store::find_cert | ( | const X509_DN & | subject_dn,
|  | const std::vector< uint8_t > & | key_id
| ) |  | const
| override virtual

Find a certificate by Subject DN and (optionally) key identifier

Parameters

  subject_dn | the subject's distinguished name
  key_id | an optional key id

Returns
  a matching certificate or nullptr otherwise

Implements Botan::Certificate_Store.

Definition at line 34 of file certstor_system.cpp.

35 {
36 return m_system_store->find_cert(subject_dn, key_id);
37 }

std::shared_ptr< const X509_Certificate > Botan::System_Certificate_Store::find_cert_by_pubkey_sha1 | ( | const std::vector< uint8_t > & | key_hash | ) | const
| override virtual

Find a certificate by searching for one with a matching SHA-1 hash of public key. Used for OCSP.

Parameters

  key_hash | SHA-1 hash of the subject's public key

Returns
  a matching certificate or nullptr otherwise

Implements Botan::Certificate_Store.

Definition at line 47 of file certstor_system.cpp.

48 {
49 return m_system_store->find_cert_by_pubkey_sha1(key_hash);
50 }

std::shared_ptr< const X509_Certificate > Botan::System_Certificate_Store::find_cert_by_raw_subject_dn_sha256 | ( | const std::vector< uint8_t > & | subject_hash | ) | const
| override virtual

Find a certificate by searching for one with a matching SHA-256 hash of raw subject name. Used for OCSP.

Parameters

  subject_hash | SHA-256 hash of the subject's raw name

Returns
  a matching certificate or nullptr otherwise

Implements Botan::Certificate_Store.

Definition at line 53 of file certstor_system.cpp.

54 {
55 return m_system_store->find_cert_by_raw_subject_dn_sha256(subject_hash);
56 }

std::shared_ptr< const X509_CRL > Botan::System_Certificate_Store::find_crl_for | ( | const X509_Certificate & | subject | ) | const
| override virtual

Finds a CRL for the given certificate

Parameters

  subject | the subject certificate

Returns
  the CRL for subject or nullptr otherwise

Reimplemented from Botan::Certificate_Store.

Definition at line 59 of file certstor_system.cpp.

60 {
61 return m_system_store->find_crl_for(subject);
62 }

The documentation for this class was generated from the following files:

- src/lib/x509/certstor_system/certstor_system.h
- src/lib/x509/certstor_system/certstor_system.cpp