Botan 3.6.1
Crypto and TLS for C&
|
#include <x509_obj.h>
Public Member Functions | |
virtual std::vector< std::string > | alternate_PEM_labels () const |
std::vector< uint8_t > | BER_encode () const |
bool | check_signature (const Public_Key &key) const |
void | decode_from (BER_Decoder &from) override |
void | encode_into (DER_Encoder &to) const override |
X509_Object & | operator= (const X509_Object &)=default |
std::string | PEM_encode () const |
virtual std::string | PEM_label () const =0 |
const std::vector< uint8_t > & | signature () const |
const AlgorithmIdentifier & | signature_algorithm () const |
const std::vector< uint8_t > & | signed_body () const |
std::vector< uint8_t > | tbs_data () const |
std::pair< Certificate_Status_Code, std::string > | verify_signature (const Public_Key &key) const |
X509_Object (const X509_Object &)=default | |
~X509_Object () override=default | |
Static Public Member Functions | |
static std::unique_ptr< PK_Signer > | choose_sig_format (const Private_Key &key, RandomNumberGenerator &rng, std::string_view hash_fn, std::string_view padding_algo) |
static std::vector< uint8_t > | make_signed (PK_Signer &signer, RandomNumberGenerator &rng, const AlgorithmIdentifier &alg_id, const secure_vector< uint8_t > &tbs) |
Protected Member Functions | |
void | load_data (DataSource &src) |
X509_Object ()=default | |
This class represents abstract X.509 signed objects as in the X.500 SIGNED macro
Definition at line 26 of file x509_obj.h.
|
default |
|
overridedefault |
|
protecteddefault |
|
inlinevirtual |
Definition at line 101 of file x509_obj.h.
Referenced by load_data().
|
inherited |
Return the encoding of this object. This is a convenience method when just one object needs to be serialized. Use DER_Encoder for complicated encodings.
Definition at line 19 of file asn1_obj.cpp.
References Botan::ASN1_Object::encode_into().
Referenced by Botan::PSS_Params::decode_from(), Botan::Certificate_Store_In_SQL::find_all_certs(), Botan::Certificate_Store_In_SQL::find_cert(), Botan::X509_Certificate::fingerprint(), Botan::Certificate_Store_In_SQL::insert_cert(), PEM_encode(), and Botan::Certificate_Store_In_SQL::revoke_cert().
bool Botan::X509_Object::check_signature | ( | const Public_Key & | key | ) | const |
Check the signature on this data
key | the public key purportedly used to sign this data |
Definition at line 97 of file x509_obj.cpp.
References Botan::VERIFIED, and verify_signature().
|
static |
Choose and return a signature scheme appropriate for X.509 signing using the provided parameters.
key | will be the key to choose a padding scheme for |
rng | the random generator to use |
hash_fn | is the desired hash function |
padding_algo | specifies the padding method |
Definition at line 209 of file x509_obj.cpp.
References Botan::Asymmetric_Key::algo_name(), and Botan::Public_Key::default_x509_signature_format().
Referenced by Botan::PKCS10_Request::create(), Botan::X509::create_self_signed_cert(), and Botan::X509_CA::X509_CA().
|
overridevirtual |
Decode a BER encoded X509_Object See ASN1_Object::decode_from()
Implements Botan::ASN1_Object.
Definition at line 68 of file x509_obj.cpp.
References Botan::BitString, Botan::BER_Decoder::decode(), Botan::BER_Decoder::end_cons(), Botan::BER_Decoder::raw_bytes(), and Botan::BER_Decoder::start_sequence().
Referenced by load_data().
|
overridevirtual |
DER encode an X509_Object See ASN1_Object::encode_into()
Implements Botan::ASN1_Object.
Definition at line 55 of file x509_obj.cpp.
References Botan::BitString, Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::raw_bytes(), signature(), signature_algorithm(), signed_body(), and Botan::DER_Encoder::start_sequence().
|
protected |
Decodes from src as either DER or PEM data, then calls force_decode()
Definition at line 24 of file x509_obj.cpp.
References alternate_PEM_labels(), Botan::PEM_Code::decode(), decode_from(), Botan::PEM_Code::matches(), Botan::ASN1::maybe_BER(), and PEM_label().
Referenced by Botan::PKCS10_Request::PKCS10_Request(), Botan::PKCS10_Request::PKCS10_Request(), Botan::X509_Certificate::X509_Certificate(), Botan::X509_Certificate::X509_Certificate(), Botan::X509_Certificate::X509_Certificate(), Botan::X509_CRL::X509_CRL(), and Botan::X509_CRL::X509_CRL().
|
static |
Create a signed X509 object.
signer | the signer used to sign the object |
rng | the random number generator to use |
alg_id | the algorithm identifier of the signature scheme |
tbs | the tbs bits to be signed |
Definition at line 125 of file x509_obj.cpp.
References Botan::BitString, Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::raw_bytes(), Botan::PK_Signer::sign_message(), signature(), and Botan::DER_Encoder::start_sequence().
Referenced by Botan::PKCS10_Request::create(), and Botan::X509_CA::make_cert().
|
default |
std::string Botan::X509_Object::PEM_encode | ( | ) | const |
Definition at line 83 of file x509_obj.cpp.
References Botan::ASN1_Object::BER_encode(), Botan::PEM_Code::encode(), and PEM_label().
|
pure virtual |
Referenced by load_data(), and PEM_encode().
|
inline |
Definition at line 37 of file x509_obj.h.
Referenced by encode_into(), make_signed(), Botan::X509_Certificate::operator<(), Botan::X509_Certificate::operator==(), and verify_signature().
|
inline |
Definition at line 47 of file x509_obj.h.
Referenced by Botan::PKIX::check_chain(), encode_into(), Botan::X509_Certificate::operator==(), Botan::X509_Certificate::to_string(), and verify_signature().
|
inline |
Definition at line 42 of file x509_obj.h.
Referenced by encode_into(), Botan::X509_Certificate::operator<(), and Botan::X509_Certificate::operator==().
std::vector< uint8_t > Botan::X509_Object::tbs_data | ( | ) | const |
The underlying data that is to be or was signed
Definition at line 90 of file x509_obj.cpp.
References Botan::ASN1::put_in_sequence().
Referenced by verify_signature().
std::pair< Certificate_Status_Code, std::string > Botan::X509_Object::verify_signature | ( | const Public_Key & | key | ) | const |
Check the signature on this data
key | the public key purportedly used to sign this data |
Definition at line 102 of file x509_obj.cpp.
References Botan::PK_Verifier::hash_function(), signature(), Botan::SIGNATURE_ALGO_BAD_PARAMS, Botan::SIGNATURE_ALGO_UNKNOWN, signature_algorithm(), Botan::SIGNATURE_ERROR, tbs_data(), Botan::VERIFIED, and Botan::PK_Verifier::verify_message().
Referenced by Botan::PKIX::check_chain(), and check_signature().