P11ex.Lib.SessionHandle (p11ex v0.5.0)

Copy Markdown View Source

Represents a PKCS#11 session. A session is used to interact with a token.

Summary

Types

The handle of the session.

The PKCS#11 module that the session belongs to.

Information about a PKCS#11 session, as returned by P11ex.Lib.session_info/1. Corresponds to the PKCS#11 CK_SESSION_INFO structure.

The slot identifier of the session.

t()

A struct representing a PKCS#11 session.

Functions

Create a new session handle.

Types

handle()

@type handle() :: non_neg_integer()

The handle of the session.

pkcs11_module()

@type pkcs11_module() :: P11ex.Lib.ModuleHandle.t()

The PKCS#11 module that the session belongs to.

session_info()

@type session_info() :: %{
  slot_id: slot_id(),
  state: MapSet.t(atom()),
  flags: MapSet.t(atom()),
  device_error: non_neg_integer()
}

Information about a PKCS#11 session, as returned by P11ex.Lib.session_info/1. Corresponds to the PKCS#11 CK_SESSION_INFO structure.

Fields:

  • slot_id (non_neg_integer()): The slot that the session is bound to.
  • state (MapSet.t(atom())): The session state flags, see P11ex.Flags for the recognized session state flags.
  • flags (MapSet.t(atom())): The flags the session was opened with, see P11ex.Flags for the recognized session flags.
  • device_error (non_neg_integer()): A device-specific error code, or 0 if the last operation on the token was successful.

slot_id()

@type slot_id() :: non_neg_integer()

The slot identifier of the session.

t()

@type t() :: %P11ex.Lib.SessionHandle{
  handle: handle(),
  module: pkcs11_module(),
  slot_id: slot_id()
}

A struct representing a PKCS#11 session.

Functions

new(module, handle, slot_id)

@spec new(pkcs11_module(), handle(), slot_id()) :: t()

Create a new session handle.