Botan 3.13.0
Crypto and TLS for C&
p11_x509.cpp
Go to the documentation of this file.
1/*
2* PKCS#11 X.509
3* (C) 2016 Daniel Neus, Sirrix AG
4* (C) 2016 Philipp Weber, Sirrix AG
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8
9#include <botan/p11_x509.h>
10
11#if defined(BOTAN_HAS_X509_CERTIFICATES)
12
13namespace Botan::PKCS11 {
14
15const X509_Certificate& PKCS11_X509_Certificate::certificate() const {
16 // TODO(Botan4) this should instead return a ref to a member variable
17 return (*this);
18}
19
20X509_CertificateProperties::X509_CertificateProperties(const std::vector<uint8_t>& subject,
21 const std::vector<uint8_t>& value) :
22 CertificateProperties(CertificateType::X509), m_subject(subject), m_value(value) {
23 add_binary(AttributeType::Subject, m_subject);
24 add_binary(AttributeType::Value, m_value);
25}
26
27PKCS11_X509_Certificate::PKCS11_X509_Certificate(Session& session, ObjectHandle handle) :
28 Object(session, handle), X509_Certificate(unlock(get_attribute_value(AttributeType::Value))) {}
29
30PKCS11_X509_Certificate::PKCS11_X509_Certificate(Session& session, const X509_CertificateProperties& props) :
31 Object(session, props), X509_Certificate(props.value()) {}
32
33} // namespace Botan::PKCS11
34
35#endif
Common attributes of all certificate objects.
Definition p11_object.h:212
AttributeType
Definition p11.h:50
CertificateType
Definition p11.h:213
std::vector< T > unlock(const secure_vector< T > &in)
Definition secmem.h:155