Botan 3.6.1
Crypto and TLS for C&
|
#include <certstor_sqlite.h>
Public Member Functions | |
void | affirm_cert (const X509_Certificate &) |
Reverses the revokation for "cert". | |
std::vector< X509_DN > | all_subjects () const override |
bool | certificate_known (const X509_Certificate &cert) const |
Certificate_Store_In_SQLite (std::string_view db_path, std::string_view passwd, RandomNumberGenerator &rng, std::string_view table_prefix="") | |
std::vector< X509_Certificate > | find_all_certs (const X509_DN &subject_dn, const std::vector< uint8_t > &key_id) const override |
std::optional< X509_Certificate > | find_cert (const X509_DN &subject_dn, const std::vector< uint8_t > &key_id) const override |
std::optional< X509_Certificate > | find_cert_by_pubkey_sha1 (const std::vector< uint8_t > &key_hash) const override |
std::optional< X509_Certificate > | find_cert_by_raw_subject_dn_sha256 (const std::vector< uint8_t > &subject_hash) const override |
std::vector< X509_Certificate > | find_certs_for_key (const Private_Key &key) const |
Returns all certificates for private key "key". | |
std::optional< X509_CRL > | find_crl_for (const X509_Certificate &issuer) const override |
std::shared_ptr< const Private_Key > | find_key (const X509_Certificate &) const |
Returns the private key for "cert" or an empty shared_ptr if none was found. | |
std::vector< X509_CRL > | generate_crls () const |
bool | insert_cert (const X509_Certificate &cert) |
bool | insert_key (const X509_Certificate &cert, const Private_Key &key) |
bool | remove_cert (const X509_Certificate &cert) |
void | remove_key (const Private_Key &key) |
Removes "key" from the store. | |
void | revoke_cert (const X509_Certificate &, CRL_Code, const X509_Time &time=X509_Time()) |
Marks "cert" as revoked starting from "time". | |
Certificate and private key store backed by an sqlite (https://sqlite.org) database.
Definition at line 18 of file certstor_sqlite.h.
Botan::Certificate_Store_In_SQLite::Certificate_Store_In_SQLite | ( | std::string_view | db_path, |
std::string_view | passwd, | ||
RandomNumberGenerator & | rng, | ||
std::string_view | table_prefix = "" ) |
Create/open a certificate store.
db_path | path to the database file |
passwd | password to encrypt private keys in the database |
rng | used for encrypting keys |
table_prefix | optional prefix for db table names |
Definition at line 14 of file certstor_sqlite.cpp.
|
inherited |
Reverses the revokation for "cert".
Definition at line 266 of file certstor_sql.cpp.
References Botan::X509_Certificate::fingerprint().
|
overridevirtualinherited |
Returns all subject DNs known to the store instance.
Implements Botan::Certificate_Store.
Definition at line 122 of file certstor_sql.cpp.
References Botan::X509_DN::decode_from().
|
inlineinherited |
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().
|
overridevirtualinherited |
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 72 of file certstor_sql.cpp.
References Botan::ASN1_Object::BER_encode().
|
overridevirtualinherited |
Returns the first certificate with matching subject DN and optional key ID.
Reimplemented from Botan::Certificate_Store.
Definition at line 46 of file certstor_sql.cpp.
References Botan::ASN1_Object::BER_encode().
Referenced by Botan::Certificate_Store_In_SQL::remove_cert().
|
overridevirtualinherited |
Find a certificate by searching for one with a matching SHA-1 hash of public key. Used for OCSP.
key_hash | SHA-1 hash of the subject's public key |
Implements Botan::Certificate_Store.
Definition at line 100 of file certstor_sql.cpp.
|
overridevirtualinherited |
Find a certificate by searching for one with a matching SHA-256 hash of raw subject name. Used for OCSP.
subject_hash | SHA-256 hash of the subject's raw name |
Implements Botan::Certificate_Store.
Definition at line 105 of file certstor_sql.cpp.
|
inherited |
Returns all certificates for private key "key".
Definition at line 196 of file certstor_sql.cpp.
References Botan::Private_Key::fingerprint_private().
|
overridevirtualinherited |
Generates a CRL for all certificates issued by the given issuer.
Reimplemented from Botan::Certificate_Store.
Definition at line 110 of file certstor_sql.cpp.
References Botan::Certificate_Store_In_SQL::generate_crls(), and Botan::X509_Certificate::issuer_dn().
|
inherited |
Returns the private key for "cert" or an empty shared_ptr if none was found.
Definition at line 176 of file certstor_sql.cpp.
References Botan::X509_Certificate::fingerprint(), and Botan::PKCS8::load_key().
Referenced by Botan::Certificate_Store_In_SQL::insert_key().
|
inherited |
Generates Certificate Revocation Lists for all certificates marked as revoked. A CRL is returned for each unique issuer DN.
Definition at line 273 of file certstor_sql.cpp.
Referenced by Botan::Certificate_Store_In_SQL::find_crl_for().
|
inherited |
Inserts "cert" into the store, returns false if the certificate is already known and true if insertion was successful.
Definition at line 139 of file certstor_sql.cpp.
References Botan::ASN1_Object::BER_encode(), Botan::X509_Certificate::fingerprint(), Botan::X509_Certificate::subject_dn(), and Botan::X509_Certificate::subject_key_id().
Referenced by Botan::Certificate_Store_In_SQL::insert_key(), and Botan::Certificate_Store_In_SQL::revoke_cert().
|
inherited |
Inserts "key" for "cert" into the store, returns false if the key is already known and true if insertion was successful.
Definition at line 212 of file certstor_sql.cpp.
References Botan::PKCS8::BER_encode(), Botan::Certificate_Store_In_SQL::find_key(), Botan::X509_Certificate::fingerprint(), Botan::Private_Key::fingerprint_private(), and Botan::Certificate_Store_In_SQL::insert_cert().
|
inherited |
Removes "cert" from the store. Returns false if the certificate could not be found and true if removal was successful.
Definition at line 162 of file certstor_sql.cpp.
References Botan::Certificate_Store_In_SQL::find_cert(), Botan::X509_Certificate::fingerprint(), Botan::X509_Certificate::subject_dn(), and Botan::X509_Certificate::subject_key_id().
|
inherited |
Removes "key" from the store.
Definition at line 239 of file certstor_sql.cpp.
References Botan::Private_Key::fingerprint_private().
|
inherited |
Marks "cert" as revoked starting from "time".
Definition at line 248 of file certstor_sql.cpp.
References Botan::ASN1_Object::BER_encode(), Botan::X509_Certificate::fingerprint(), Botan::Certificate_Store_In_SQL::insert_cert(), and Botan::ASN1_Time::time_is_set().