|
Botan
2.13.0
Crypto and TLS for C++11
|
#include <certstor_sql.h>
Public Member Functions | |
| void | affirm_cert (const X509_Certificate &) |
| Reverses the revokation for "cert". More... | |
| std::vector< X509_DN > | all_subjects () const override |
| bool | certificate_known (const X509_Certificate &cert) const |
| Certificate_Store_In_SQL (const std::shared_ptr< SQL_Database > db, const std::string &passwd, RandomNumberGenerator &rng, const std::string &table_prefix="") | |
| 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::vector< std::shared_ptr< const X509_Certificate > > | find_certs_for_key (const Private_Key &key) const |
| Returns all certificates for private key "key". More... | |
| std::shared_ptr< const 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. More... | |
| 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. More... | |
| void | revoke_cert (const X509_Certificate &, CRL_Code, const X509_Time &time=X509_Time()) |
| Marks "cert" as revoked starting from "time". More... | |
Certificate and private key store backed by an SQL database.
Definition at line 25 of file certstor_sql.h.
|
explicit |
Create/open a certificate store.
| db | underlying database storage |
| 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 17 of file certstor_sql.cpp.
| void Botan::Certificate_Store_In_SQL::affirm_cert | ( | const X509_Certificate & | cert | ) |
Reverses the revokation for "cert".
Definition at line 291 of file certstor_sql.cpp.
References Botan::X509_Certificate::fingerprint().
|
overridevirtual |
Returns all subject DNs known to the store instance.
Implements Botan::Certificate_Store.
Definition at line 137 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().
|
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 79 of file certstor_sql.cpp.
References Botan::ASN1_Object::BER_encode().
|
overridevirtual |
Returns the first certificate with matching subject DN and optional key ID.
Implements Botan::Certificate_Store.
Definition at line 47 of file certstor_sql.cpp.
References Botan::ASN1_Object::BER_encode().
Referenced by remove_cert().
|
overridevirtual |
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 112 of file certstor_sql.cpp.
|
overridevirtual |
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 118 of file certstor_sql.cpp.
| std::vector< std::shared_ptr< const X509_Certificate > > Botan::Certificate_Store_In_SQL::find_certs_for_key | ( | const Private_Key & | key | ) | const |
Returns all certificates for private key "key".
Definition at line 215 of file certstor_sql.cpp.
References Botan::Private_Key::fingerprint_private().
|
overridevirtual |
Generates a CRL for all certificates issued by the given issuer.
Reimplemented from Botan::Certificate_Store.
Definition at line 124 of file certstor_sql.cpp.
References generate_crls(), and Botan::X509_Certificate::issuer_dn().
| std::shared_ptr< const Private_Key > Botan::Certificate_Store_In_SQL::find_key | ( | const X509_Certificate & | cert | ) | const |
Returns the private key for "cert" or an empty shared_ptr if none was found.
Definition at line 195 of file certstor_sql.cpp.
References Botan::X509_Certificate::fingerprint(), and Botan::PKCS8::load_key().
Referenced by insert_key().
| std::vector< X509_CRL > Botan::Certificate_Store_In_SQL::generate_crls | ( | ) | const |
Generates Certificate Revocation Lists for all certificates marked as revoked. A CRL is returned for each unique issuer DN.
Definition at line 299 of file certstor_sql.cpp.
Referenced by find_crl_for().
| bool Botan::Certificate_Store_In_SQL::insert_cert | ( | const X509_Certificate & | cert | ) |
Inserts "cert" into the store, returns false if the certificate is already known and true if insertion was successful.
Definition at line 156 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 insert_key(), and revoke_cert().
| bool Botan::Certificate_Store_In_SQL::insert_key | ( | const X509_Certificate & | cert, |
| const Private_Key & | key | ||
| ) |
Inserts "key" for "cert" into the store, returns false if the key is already known and true if insertion was successful.
Definition at line 233 of file certstor_sql.cpp.
References Botan::PKCS8::BER_encode(), find_key(), Botan::X509_Certificate::fingerprint(), Botan::Private_Key::fingerprint_private(), and insert_cert().
| bool Botan::Certificate_Store_In_SQL::remove_cert | ( | const X509_Certificate & | cert | ) |
Removes "cert" from the store. Returns false if the certificate could not be found and true if removal was successful.
Definition at line 181 of file certstor_sql.cpp.
References find_cert(), Botan::X509_Certificate::fingerprint(), Botan::X509_Certificate::subject_dn(), and Botan::X509_Certificate::subject_key_id().
| void Botan::Certificate_Store_In_SQL::remove_key | ( | const Private_Key & | key | ) |
Removes "key" from the store.
Definition at line 259 of file certstor_sql.cpp.
References Botan::Private_Key::fingerprint_private().
| void Botan::Certificate_Store_In_SQL::revoke_cert | ( | const X509_Certificate & | cert, |
| CRL_Code | code, | ||
| const X509_Time & | time = X509_Time() |
||
| ) |
Marks "cert" as revoked starting from "time".
Definition at line 269 of file certstor_sql.cpp.
References Botan::ASN1_Object::BER_encode(), Botan::X509_Certificate::fingerprint(), insert_cert(), and Botan::X509_Time::time_is_set().
1.8.9.1