Botan  2.11.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::System_Certificate_Store Class Referencefinal

#include <certstor_system.h>

Inheritance diagram for Botan::System_Certificate_Store:
Botan::Certificate_Store

Public Member Functions

std::vector< X509_DNall_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_Certificatefind_cert (const X509_DN &subject_dn, const std::vector< uint8_t > &key_id) const override
 
std::shared_ptr< const X509_Certificatefind_cert_by_pubkey_sha1 (const std::vector< uint8_t > &key_hash) const override
 
std::shared_ptr< const X509_Certificatefind_cert_by_raw_subject_dn_sha256 (const std::vector< uint8_t > &subject_hash) const override
 
std::shared_ptr< const X509_CRLfind_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

◆ System_Certificate_Store()

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

◆ all_subjects()

std::vector< X509_DN > Botan::System_Certificate_Store::all_subjects ( ) const
overridevirtual

Implements Botan::Certificate_Store.

Definition at line 64 of file certstor_system.cpp.

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

◆ certificate_known()

bool Botan::Certificate_Store::certificate_known ( const X509_Certificate cert) const
inlineinherited
Returns
whether the certificate is known
Parameters
certcertififcate 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  }
virtual std::shared_ptr< const X509_Certificate > find_cert(const X509_DN &subject_dn, const std::vector< uint8_t > &key_id) const =0

◆ find_all_certs()

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
overridevirtual

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  }

◆ find_cert()

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
overridevirtual

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

Parameters
subject_dnthe subject's distinguished name
key_idan 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  }

◆ find_cert_by_pubkey_sha1()

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

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

Parameters
key_hashSHA-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  }

◆ find_cert_by_raw_subject_dn_sha256()

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
overridevirtual

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

Parameters
subject_hashSHA-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  }

◆ find_crl_for()

std::shared_ptr< const X509_CRL > Botan::System_Certificate_Store::find_crl_for ( const X509_Certificate subject) const
overridevirtual

Finds a CRL for the given certificate

Parameters
subjectthe 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: