saltpack v1.2.8 Saltpack View Source

saltpack implementation

https://saltpack.org/

Handling complete, ASCII-armored messages at rest.

Link to this section Summary

Types

a public or private key

desired key variety

signature mode

Link to this section Types

a public or private key

Link to this type

key_variety()

View Source
key_variety() :: :encrypt | :sign

desired key variety

Link to this type

signature_mode()

View Source
signature_mode() :: :attached | :detached

signature mode

Link to this section Functions

Link to this function

armor_message(message, opts \\ [])

View Source

armor a new message

Link to this function

encrypt_message(message, recipients, private, public \\ nil, opts \\ [])

View Source
encrypt_message(
  binary(),
  [key()],
  key(),
  key(),
  Saltpack.Armor.formatting_options()
) :: binary()

encrypt a new message

recipients should contain a list of all recipient public keys. An entry may be nil for anonymous recipients.

Link to this function

new_key_pair(kv \\ :encrypt)

View Source
new_key_pair(key_variety()) :: {key(), key()}

generate a new {private, public} key pair

Link to this function

open_message(message, key \\ nil, plaintext \\ nil)

View Source
open_message(binary(), key(), binary()) :: binary()

open a saltpack message

This may fail in spectacular ways with messages which are not properly formatted for the supplied key.

Opening a detached signature with plaintext will return the signing public key. All other forms return the decoded contents upon validation.

Link to this function

sign_message(message, private, public \\ nil, mode \\ :attached, opts \\ [])

View Source

sign a new message

This is presently considerably slower than encrypting a same-sized message and has slightly different calling semantics. Where possible, encrypt_message/5 should be preferred.