# p11ex v0.4.0 - Table of Contents

> PKCS#11 interface for Elixir

## Pages

- [README](readme.md)
- [CLI Tool Documentation](cli_documentation.md)
- [Changelog](changelog.md)

## Modules

- [P11ex.ECSignature](P11ex.ECSignature.md): This module provides functions to convert between the raw signature
bytes and the ASN.1 encoding of the signature.

- Core Modules
  - [P11ex.Module](P11ex.Module.md): A module is a `GenServer` that manages a PKCS#11 module and its loading state. A PKCS#11 module is a
shared library that implements a PKCS#11 provider.  A module should be loaded only once per application
or beam virtual machine. That is, you should only create one instance of `P11ex.Module` in your application
and add it to your supervision tree. Operations on the module should be performed through the `GenServer`
callbacks so that they are serialized.
  - [P11ex.Session](P11ex.Session.md): This module is a `GenServer` that manages a PKCS#11 session. A session is used
to interact with a token, e.g. generate keys, encrypt data, decrypt data, etc. Sessions
are created by the `P11ex.Module` module using the `open_session/3` function. Depending on
the type of token multiple for the same token can be opened in parallel (e.g. if the token is
a network HSM). One session can only be used in a serialised way, i.e. only one operation can be
performed at a time. Additionally, sessions have a state. This state can be non-persistent keys associated
with the session or the state of an encryption or decryption operation.

- Data Structures
  - [P11ex.Lib](P11ex.Lib.md): This module contains the core functionality for the `P11ex` library and provides
the low-level API for interacting with PKCS#11 modules. In general, you should not
use this module directly. Instead, use the higher-level `P11ex.Module` and `P11ex.Session`
modules instead.

  - [P11ex.Lib.ModuleHandle](P11ex.Lib.ModuleHandle.md): Represents a reference to a dynamically loaded PKCS#11 module.

  - [P11ex.Lib.ObjectAttributes](P11ex.Lib.ObjectAttributes.md): This module defines sets of attributes for PKCS#11 objects.

  - [P11ex.Lib.ObjectHandle](P11ex.Lib.ObjectHandle.md): Represents a PKCS#11 object. This can be a key, a certificate, a secret key, etc. Note
that the object handle may be only valid in the context of the session that created it.
For example, a session key (`:cka_token` is `false`) is only visible and usable within the
context of the session that generates it. Other handles may be visible and usable over multiple
sessions, such as handles to token objects.

  - [P11ex.Lib.SessionHandle](P11ex.Lib.SessionHandle.md): Represents a PKCS#11 session. A session is used to interact with a token.

  - [P11ex.Lib.Slot](P11ex.Lib.Slot.md): Represents a PKCS#11 slot. A slot can contain a token (e.g. a smart card) or a token emulator
(e.g. a software token).

- Flags and Parameters
  - [P11ex.ECParam](P11ex.ECParam.md): This module provides functions to encode and decode elliptic curve parameters.

  - [P11ex.Flags](P11ex.Flags.md): Handles conversion between PKCS#11 flags (CK_FLAGS) and MapSets of atoms.

