Univrse.Alg.ECDH_AES (Univrse v0.2.0) View Source

ECDH_AES algorithm module.

Implements ECDH-ES+AES_GCM encryption and decryption. https://tools.ietf.org/html/rfc7518#section-4.6

Link to this section Summary

Functions

Decrypts the cyphertext with the key using the specified algorithm.

Encrypts the message with the key using the specified algorithm. Returns a three part tuple containing the encrypted cyphertext and any headers to add to the Recipient.

Link to this section Functions

Link to this function

decrypt(alg, encrypted, key, opts \\ [])

View Source

Specs

decrypt(String.t(), binary(), Univrse.Key.t(), keyword()) ::
  {:ok, binary()} | {:error, any()}

Decrypts the cyphertext with the key using the specified algorithm.

Accepted options:

  • epk - Ephemeral public key
  • apu - Agreement PartyUInfo
  • apv - Agreement PartyVInfo
  • Any accepted AES_GCM options
Link to this function

encrypt(alg, message, key, opts \\ [])

View Source

Specs

encrypt(String.t(), binary(), Univrse.Key.t(), keyword()) ::
  {:ok, binary(), map()} | {:error, any()}

Encrypts the message with the key using the specified algorithm. Returns a three part tuple containing the encrypted cyphertext and any headers to add to the Recipient.

Accepted options:

  • apu - Agreement PartyUInfo
  • apv - Agreement PartyVInfo
  • Any accepted AES_GCM options