CryppoEx v0.1.0 Cryppo.DerivedKey View Source

A struct for a derived encryption key and its derivation artefacts

A Cryppo.EncryptedData struct may be marked as belonging to a certain key derivation strategy using field key_derivation_strategy containing the module of the key derivation.

A Cryppo.DerivedKey comes in 2 flavors:

  • With a derived encryption key. When used for encryption or decryption this key will be used
  • Without an encryption key. Encrypting or decrypting with this struct requires a passphrase to derive the key

Link to this section Summary

Link to this section Types

Specs

t() :: %Cryppo.DerivedKey{
  encryption_key: Cryppo.EncryptionKey.t() | nil,
  hash: String.t(),
  iter: integer(),
  key_derivation_strategy: Cryppo.encryption_strategy_module(),
  length: integer(),
  salt: binary()
}

Struct Cryppo.DerivedKey

A Cryppo.DerivedKey struct contains

  • encryption_key - nil or a Cryppo.EncryptionKey
  • key_derivation_strategy - module of the key derivation strategy
  • salt - salt used for key derivation
  • iter - number of iterations for key derivation
  • length - key length
  • hash - hash function for key derivation

Link to this section Functions

Specs

current_version() :: <<_::8>>

Specs

load_artefacts(binary()) ::
  {:error, :invalid_bson | :invalid_derivation_artefacts | :invalid_yaml}
  | {:ok, binary(), integer(), integer()}