View Source Cryppo.EncryptionKey (CryppoEx v0.2.3)

A struct to wrap an encryption key

An EncryptionKey struct may be marked as belonging to a certain encryption strategy using field encryption_strategy_module containing the module of the encryption strategy.

Depending on the encryption strategy the key can be a binary or a tuple.

Keys must be guarded and protected, that is why the Inspect protocol has been overridden for this struct to disable pretty-printing.

Should you need to access the key, access it via field key.

Summary

Types

A binary key

Encryption key

t()

Struct EncryptionKey

Functions

Initialize a struct with an encryption key

Initialize a struct with an encryption key and the module of an encryption strategy

Types

@type binary_key() :: binary()

A binary key

@type internal_key() :: binary_key() | tuple()

Encryption key

An encryption key may me a tuple or a binary depending on the encryption strategy

@type t() :: %Cryppo.EncryptionKey{
  encryption_strategy_module: Cryppo.encryption_strategy_module(),
  key: internal_key()
}

Struct EncryptionKey

A Cryppo.EncryptionKey struct contains

  • key: the key itself
  • encryption_strategy_module: module of the encryption strategy to which the key belongs

Functions

@spec new(internal_key()) :: t()

Initialize a struct with an encryption key

Initialize a struct with an encryption key and the module of an encryption strategy