AWS IoT Device SDK C++ v2 1.44.2
AWS IoT Device SDK C++ v2
Loading...
Searching...
No Matches
Aws::Crt::Io::Pkcs11Lib Class Reference

#include <Pkcs11.h>

Public Types

enum class  InitializeFinalizeBehavior { Default , Omit , Strict }

Public Member Functions

 ~Pkcs11Lib ()

Static Public Member Functions

static std::shared_ptr< Pkcs11Lib > Create (const String &filename, Allocator *allocator=ApiAllocator())
static std::shared_ptr< Pkcs11Lib > Create (const String &filename, InitializeFinalizeBehavior initializeFinalizeBehavior, Allocator *allocator=ApiAllocator())

Detailed Description

Handle to a loaded PKCS#11 library.

For most use cases, a single instance of Pkcs11Lib should be used for the lifetime of your application.

Member Enumeration Documentation

◆ InitializeFinalizeBehavior

Controls how Pkcs11Lib calls C_Initialize() and C_Finalize() on the PKCS#11 library.

Enumerator
Default 

Default behavior that accommodates most use cases.

C_Initialize() is called on creation, and "already-initialized" errors are ignored. C_Finalize() is never called, just in case another part of your application is still using the PKCS#11 library.

Omit 

Skip calling C_Initialize() and C_Finalize().

Use this if your application has already initialized the PKCS#11 library, and you do not want C_Initialize() called again.

Strict 

C_Initialize() is called on creation and C_Finalize() is called on cleanup.

If C_Initialize() reports that's it's already initialized, this is treated as an error. Use this if you need perfect cleanup (ex: running valgrind with –leak-check).

Constructor & Destructor Documentation

◆ ~Pkcs11Lib()

Aws::Crt::Io::Pkcs11Lib::~Pkcs11Lib ( )

Member Function Documentation

◆ Create() [1/2]

std::shared_ptr< Pkcs11Lib > Aws::Crt::Io::Pkcs11Lib::Create ( const String & filename,
Allocator * allocator = ApiAllocator() )
static

Load and initialize a PKCS#11 library.

C_Initialize() and C_Finalize() are called on the PKCS#11 library in the InitializeFinalizeBehavior::Default way.

Parameters
filenameName or path of PKCS#11 library file to load (UTF-8). Pass an empty string if your application already has PKCS#11 symbols linked in.
allocatorMemory allocator to use.
Returns
If successful a shared_ptr containing the Pkcs11Lib is returned. If unsuccessful the shared_ptr will be empty, and Aws::Crt::LastError() will contain the error that occurred.

◆ Create() [2/2]

std::shared_ptr< Pkcs11Lib > Aws::Crt::Io::Pkcs11Lib::Create ( const String & filename,
InitializeFinalizeBehavior initializeFinalizeBehavior,
Allocator * allocator = ApiAllocator() )
static

Load a PKCS#11 library, specifying how C_Initialize() and C_Finalize() will be called.

Parameters
filenameName or path of PKCS#11 library file to load (UTF-8). Pass an empty string if your application already has PKCS#11 symbols linked in.
initializeFinalizeBehaviorSpecifies how C_Initialize() and C_Finalize() will be called on the PKCS#11 library.
allocatorMemory allocator to use.
Returns
If successful a shared_ptr containing the Pkcs11Lib is returned. If unsuccessful the shared_ptr will be empty, and Aws::Crt::LastError() will contain the error that occurred.

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