Botan  2.8.0
Crypto and TLS for C++11
Public Member Functions | Static Public Member Functions | List of all members
Botan::Cert_Extension::Subject_Key_ID Class Referencefinal

#include <x509_ext.h>

Inheritance diagram for Botan::Cert_Extension::Subject_Key_ID:
Botan::Certificate_Extension

Public Member Functions

Subject_Key_IDcopy () const override
 
const std::vector< uint8_t > & get_key_id () const
 
OID oid_of () const override
 
 Subject_Key_ID ()=default
 
 Subject_Key_ID (const std::vector< uint8_t > &k)
 
 Subject_Key_ID (const std::vector< uint8_t > &public_key, const std::string &hash_fn)
 
virtual void validate (const X509_Certificate &subject, const X509_Certificate &issuer, const std::vector< std::shared_ptr< const X509_Certificate >> &cert_path, std::vector< std::set< Certificate_Status_Code >> &cert_status, size_t pos)
 

Static Public Member Functions

static OID static_oid ()
 

Detailed Description

Subject Key Identifier Extension

Definition at line 349 of file x509_ext.h.

Constructor & Destructor Documentation

◆ Subject_Key_ID() [1/3]

Botan::Cert_Extension::Subject_Key_ID::Subject_Key_ID ( )
default

◆ Subject_Key_ID() [2/3]

Botan::Cert_Extension::Subject_Key_ID::Subject_Key_ID ( const std::vector< uint8_t > &  k)
inlineexplicit

Definition at line 354 of file x509_ext.h.

354 : m_key_id(k) {}

◆ Subject_Key_ID() [3/3]

Botan::Cert_Extension::Subject_Key_ID::Subject_Key_ID ( const std::vector< uint8_t > &  public_key,
const std::string &  hash_fn 
)

Definition at line 433 of file x509_ext.cpp.

References Botan::HashFunction::create_or_throw(), and hash.

434  {
435  std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_name));
436 
437  m_key_id.resize(hash->output_length());
438 
439  hash->update(pub_key);
440  hash->final(m_key_id.data());
441 
442  // Truncate longer hashes, 192 bits here seems plenty
443  const size_t max_skid_len = (192 / 8);
444  if(m_key_id.size() > max_skid_len)
445  m_key_id.resize(max_skid_len);
446  }
static std::unique_ptr< HashFunction > create_or_throw(const std::string &algo_spec, const std::string &provider="")
Definition: hash.cpp:359
MechanismType hash

Member Function Documentation

◆ copy()

Subject_Key_ID* Botan::Cert_Extension::Subject_Key_ID::copy ( ) const
inlineoverridevirtual

Make a copy of this extension

Returns
copy of this

Implements Botan::Certificate_Extension.

Definition at line 359 of file x509_ext.h.

360  { return new Subject_Key_ID(m_key_id); }

◆ get_key_id()

const std::vector<uint8_t>& Botan::Cert_Extension::Subject_Key_ID::get_key_id ( ) const
inline

Definition at line 362 of file x509_ext.h.

362 { return m_key_id; }

◆ oid_of()

OID Botan::Cert_Extension::Subject_Key_ID::oid_of ( ) const
inlineoverridevirtual
Returns
OID representing this extension

Implements Botan::Certificate_Extension.

Definition at line 365 of file x509_ext.h.

365 { return static_oid(); }

◆ static_oid()

static OID Botan::Cert_Extension::Subject_Key_ID::static_oid ( )
inlinestatic

Definition at line 364 of file x509_ext.h.

364 { return OID("2.5.29.14"); }

◆ validate()

void Botan::Certificate_Extension::validate ( const X509_Certificate subject,
const X509_Certificate issuer,
const std::vector< std::shared_ptr< const X509_Certificate >> &  cert_path,
std::vector< std::set< Certificate_Status_Code >> &  cert_status,
size_t  pos 
)
virtualinherited

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