Botan 3.14.1
Crypto and TLS for C&
Botan::PKCS11::Object_Creation_Guard Class Referencefinal

#include <p11_object_guard.h>

Public Member Functions

 Object_Creation_Guard (const Object_Creation_Guard &)=delete
 Object_Creation_Guard (Object_Creation_Guard &&)=delete
 Object_Creation_Guard (Session &session, std::initializer_list< ObjectHandle > handles)
Object_Creation_Guard & operator= (const Object_Creation_Guard &)=delete
Object_Creation_Guard & operator= (Object_Creation_Guard &&)=delete
void release ()
 Call once construction has succeeded.
 ~Object_Creation_Guard () noexcept

Detailed Description

Destroys newly created token objects unless released, so that a failure after creating an object (for example while reading back its attributes) does not leave an unreachable object behind on the token.

Definition at line 22 of file p11_object_guard.h.

Constructor & Destructor Documentation

◆ Object_Creation_Guard() [1/3]

Botan::PKCS11::Object_Creation_Guard::Object_Creation_Guard ( Session & session,
std::initializer_list< ObjectHandle > handles )
inline

Definition at line 24 of file p11_object_guard.h.

24 :
25 m_session(session), m_handles(handles) {}

Referenced by Object_Creation_Guard(), Object_Creation_Guard(), operator=(), and operator=().

◆ ~Object_Creation_Guard()

Botan::PKCS11::Object_Creation_Guard::~Object_Creation_Guard ( )
inlinenoexcept

Definition at line 27 of file p11_object_guard.h.

27 {
28 for(const auto handle : m_handles) {
29 try {
30 m_session.module()->C_DestroyObject(m_session.handle(), handle, nullptr);
31 } catch(...) { // NOLINT(*-empty-catch)
32 }
33 }
34 }

◆ Object_Creation_Guard() [2/3]

Botan::PKCS11::Object_Creation_Guard::Object_Creation_Guard ( const Object_Creation_Guard & )
delete

◆ Object_Creation_Guard() [3/3]

Botan::PKCS11::Object_Creation_Guard::Object_Creation_Guard ( Object_Creation_Guard && )
delete

Member Function Documentation

◆ operator=() [1/2]

Object_Creation_Guard & Botan::PKCS11::Object_Creation_Guard::operator= ( const Object_Creation_Guard & )
delete

◆ operator=() [2/2]

Object_Creation_Guard & Botan::PKCS11::Object_Creation_Guard::operator= ( Object_Creation_Guard && )
delete

◆ release()

void Botan::PKCS11::Object_Creation_Guard::release ( )
inline

Call once construction has succeeded.

Definition at line 37 of file p11_object_guard.h.

37{ m_handles.clear(); }

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