Botan 3.0.0
Crypto and TLS for C&
Public Member Functions | List of all members
Botan::PKCS11::StorageObjectProperties Class Reference

Common attributes of all storage objects. More...

#include <p11_object.h>

Inheritance diagram for Botan::PKCS11::StorageObjectProperties:
Botan::PKCS11::ObjectProperties Botan::PKCS11::AttributeContainer Botan::PKCS11::CertificateProperties Botan::PKCS11::DataObjectProperties Botan::PKCS11::DomainParameterProperties Botan::PKCS11::KeyProperties Botan::PKCS11::PrivateKeyProperties Botan::PKCS11::PublicKeyProperties Botan::PKCS11::SecretKeyProperties

Public Member Functions

template<typename TAlloc >
void add_binary (AttributeType attribute, const std::vector< uint8_t, TAlloc > &binary)
 
void add_binary (AttributeType attribute, const uint8_t *value, size_t length)
 
void add_bool (AttributeType attribute, bool value)
 
void add_class (ObjectClass object_class)
 
void add_string (AttributeType attribute, std::string_view value)
 
const std::vector< Attribute > & attributes () const
 
size_t count () const
 
Attributedata () const
 
ObjectClass object_class () const
 
void set_copyable (bool value)
 
void set_destroyable (bool value)
 
void set_label (std::string_view label)
 
void set_modifiable (bool value)
 
void set_private (bool value)
 
void set_token (bool value)
 
 StorageObjectProperties (ObjectClass object_class)
 

Detailed Description

Common attributes of all storage objects.

Definition at line 185 of file p11_object.h.

Constructor & Destructor Documentation

◆ StorageObjectProperties()

Botan::PKCS11::StorageObjectProperties::StorageObjectProperties ( ObjectClass  object_class)
Parameters
object_classthe CK_OBJECT_CLASS this storage object belongs to

Definition at line 138 of file p11_object.cpp.

140 {}
ObjectClass object_class() const
Definition: p11_object.h:175
ObjectProperties(ObjectClass object_class)
Definition: p11_object.cpp:132

Member Function Documentation

◆ add_binary() [1/2]

template<typename TAlloc >
void Botan::PKCS11::AttributeContainer::add_binary ( AttributeType  attribute,
const std::vector< uint8_t, TAlloc > &  binary 
)
inlineinherited

Add a binary attribute (e.g. CKA_ID / AttributeType::Id).

Parameters
attributeattribute type
binarybinary attribute value to add

Definition at line 90 of file p11_object.h.

91 {
92 add_binary(attribute, binary.data(), binary.size());
93 }
void add_binary(AttributeType attribute, const uint8_t *value, size_t length)
Definition: p11_object.cpp:33

◆ add_binary() [2/2]

void Botan::PKCS11::AttributeContainer::add_binary ( AttributeType  attribute,
const uint8_t *  value,
size_t  length 
)
inherited

Add a binary attribute (e.g. CKA_ID / AttributeType::Id).

Parameters
attributeattribute type
valuebinary attribute value to add
lengthsize of the binary attribute value in bytes

Definition at line 33 of file p11_object.cpp.

34 {
35 m_vectors.push_back(secure_vector<uint8_t>(value, value + length));
36 add_attribute(attribute, reinterpret_cast< const uint8_t* >(m_vectors.back().data()), static_cast<Ulong>(length));
37 }
CK_ULONG Ulong
Definition: p11.h:838

Referenced by Botan::PKCS11::Object::search().

◆ add_bool()

void Botan::PKCS11::AttributeContainer::add_bool ( AttributeType  attribute,
bool  value 
)
inherited

Add a bool attribute (e.g. CKA_SENSITIVE / AttributeType::Sensitive).

Parameters
attributeattribute type
valueboolean value to add

Definition at line 39 of file p11_object.cpp.

40 {
41 m_numerics.push_back(value ? True : False);
42 add_attribute(attribute, reinterpret_cast< uint8_t* >(&m_numerics.back()), sizeof(Bbool));
43 }
CK_BBOOL Bbool
Definition: p11.h:836
const Bbool True
Definition: p11.h:857
const Bbool False
Definition: p11.h:858

References Botan::PKCS11::False, and Botan::PKCS11::True.

◆ add_class()

void Botan::PKCS11::AttributeContainer::add_class ( ObjectClass  object_class)
inherited

Add a class attribute (CKA_CLASS / AttributeType::Class).

Parameters
object_classclass attribute to add

Definition at line 19 of file p11_object.cpp.

20 {
21 m_numerics.emplace_back(static_cast< uint64_t >(object_class));
22 add_attribute(AttributeType::Class,
23 reinterpret_cast< uint8_t* >(&m_numerics.back()),
24 static_cast<Ulong>(sizeof(ObjectClass)));
25 }

References Botan::PKCS11::Class.

Referenced by Botan::PKCS11::AttributeContainer::AttributeContainer().

◆ add_string()

void Botan::PKCS11::AttributeContainer::add_string ( AttributeType  attribute,
std::string_view  value 
)
inherited

Add a string attribute (e.g. CKA_LABEL / AttributeType::Label).

Parameters
attributeattribute type
valuestring value to add

Definition at line 27 of file p11_object.cpp.

28 {
29 m_strings.push_back(std::string(value));
30 add_attribute(attribute, reinterpret_cast<const uint8_t*>(m_strings.back().data()), static_cast<Ulong>(value.size()));
31 }

Referenced by Botan::PKCS11::Object::search().

◆ attributes()

const std::vector< Attribute > & Botan::PKCS11::AttributeContainer::attributes ( ) const
inlineinherited
Returns
the attributes this container contains

Definition at line 46 of file p11_object.h.

47 {
48 return m_attributes;
49 }

Referenced by Botan::PKCS11::Object::search().

◆ count()

size_t Botan::PKCS11::AttributeContainer::count ( ) const
inlineinherited
Returns
the number of attributes in this container

Definition at line 58 of file p11_object.h.

59 {
60 return m_attributes.size();
61 }

Referenced by Botan::PKCS11::Object::copy(), and Botan::PKCS11::Object::Object().

◆ data()

Attribute * Botan::PKCS11::AttributeContainer::data ( ) const
inlineinherited
Returns
raw attribute data

Definition at line 52 of file p11_object.h.

53 {
54 return const_cast< Attribute* >(m_attributes.data());
55 }
CK_ATTRIBUTE Attribute
Definition: p11.h:847

Referenced by Botan::PKCS11::Object::copy(), and Botan::PKCS11::Object::Object().

◆ object_class()

ObjectClass Botan::PKCS11::ObjectProperties::object_class ( ) const
inlineinherited
Returns
the object class of this object

Definition at line 175 of file p11_object.h.

176 {
177 return m_object_class;
178 }

◆ set_copyable()

void Botan::PKCS11::StorageObjectProperties::set_copyable ( bool  value)
inline
Parameters
valueif true the object can be copied using C_CopyObject

Definition at line 219 of file p11_object.h.

220 {
222 }
void add_bool(AttributeType attribute, bool value)
Definition: p11_object.cpp:39

◆ set_destroyable()

void Botan::PKCS11::StorageObjectProperties::set_destroyable ( bool  value)
inline
Parameters
valueif true the object can be destroyed using C_DestroyObject

Definition at line 225 of file p11_object.h.

◆ set_label()

void Botan::PKCS11::StorageObjectProperties::set_label ( std::string_view  label)
inline
Parameters
labeldescription of the object (RFC2279 string)

Definition at line 192 of file p11_object.h.

193 {
195 }
void add_string(AttributeType attribute, std::string_view value)
Definition: p11_object.cpp:27

◆ set_modifiable()

void Botan::PKCS11::StorageObjectProperties::set_modifiable ( bool  value)
inline
Parameters
valueif true the object can be modified, otherwise it is read-only

Definition at line 213 of file p11_object.h.

◆ set_private()

void Botan::PKCS11::StorageObjectProperties::set_private ( bool  value)
inline
Parameters
valueif true the object is a private object; otherwise the object is a public object When private, a user may not access the object until the user has been authenticated to the token

Definition at line 207 of file p11_object.h.

◆ set_token()

void Botan::PKCS11::StorageObjectProperties::set_token ( bool  value)
inline
Parameters
valueif true the object is a token object; otherwise the object is a session object

Definition at line 198 of file p11_object.h.


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