Your own certificate and its RSA private key.
An identity signs what you send (from: in Sinetex.seal/2) and decrypts
what you receive (as: in Sinetex.open/2).
The private key is loaded from PEM (PKCS#1 or PKCS#8, optionally encrypted) or DER. Keeping the key safe (HSM, vault, file permissions) is up to the caller. The struct does not show the key when inspected.
Summary
Functions
Loads a certificate and its private key.
Types
@type load_error() :: Sinetex.Certificate.load_error() | :invalid_private_key | :key_mismatch
@type t() :: %Sinetex.Identity{ certificate: Sinetex.Certificate.t(), private_key: :public_key.rsa_private_key() }
Functions
@spec load(binary(), binary(), keyword()) :: {:ok, t()} | {:error, load_error()}
Loads a certificate and its private key.
Both are binaries in PEM or DER. The certificate goes through the checks of
Sinetex.Certificate.load/2, and the key must match the certificate.
Options
:pc- seeSinetex.Certificate.load/2.:password- password of an encrypted PEM key.
Examples
{:ok, me} = Sinetex.Identity.load(File.read!("me.pem"), File.read!("me.key"))
{:ok, me} = Sinetex.Identity.load(cert, key, pc: 0x06, password: "secret")