9#include <botan/p11_types.h>
18 m_slot(slot), m_handle(0), m_logged_in(false) {
48 std::swap(
handle, m_handle);
bool C_GetSessionInfo(SessionHandle session, SessionInfo *info_ptr, ReturnValue *return_value=ThrowException) const
bool C_Logout(SessionHandle session, ReturnValue *return_value=ThrowException) const
bool C_OpenSession(SlotId slot_id, Flags flags, VoidPtr application, Notify notify, SessionHandle *session_ptr, ReturnValue *return_value=ThrowException) const
bool C_InitPIN(SessionHandle session, Utf8Char *pin_ptr, Ulong pin_len, ReturnValue *return_value=ThrowException) const
bool C_CloseSession(SessionHandle session, ReturnValue *return_value=ThrowException) const
bool C_Login(SessionHandle session, UserType user_type, Utf8Char *pin_ptr, Ulong pin_len, ReturnValue *return_value=ThrowException) const
bool C_SetPIN(SessionHandle session, Utf8Char *old_pin_ptr, Ulong old_len, Utf8Char *new_pin_ptr, Ulong new_len, ReturnValue *return_value=ThrowException) const
Represents a PKCS#11 session.
void set_pin(const secure_string &old_pin, const secure_string &new_pin)
Calls C_SetPIN to change the PIN using the old PIN (requires a logged in session)
void logoff()
Logout from this session.
SessionHandle handle() const
SessionInfo get_info() const
Session(Slot &slot, bool read_only)
void init_pin(const secure_string &new_pin)
Calls C_InitPIN to change or initialize the PIN using the SO_PIN (requires a logged in session)
void login(UserType userType, const secure_string &pin)
~Session() noexcept
Logout user and close the session on destruction.
Represents a PKCS#11 Slot, i.e., a card reader.
secure_vector< uint8_t > secure_string
CK_SESSION_HANDLE SessionHandle