AshVault.Errors.CiphertextIntegrityFailed exception (AshVault v0.2.0)

Copy Markdown View Source

Raised when the AEAD authentication tag does not verify.

The "authentication" here is the authenticated in authenticated encryption: a cryptographic check that the stored bytes are the bytes AshVault wrote, under the key and the associated data it wrote them with. Causes are tampering with the stored ciphertext, decrypting with the wrong key, or decrypting under different associated data (a different scope, resource or field).

It is not an authorization or sign-in failure, and has nothing to do with AshAuthentication or Ash.Policy.Authorizer. AshVault performs no authorization at all; by the time a value reaches the crypto layer Ash has already decided the caller may have it. This error is named for ciphertext integrity for exactly that reason: an earlier name borrowed the word "authentication", and read as an access-control error it gets triaged as a routine permissions problem, when it in fact means someone or something is writing to your ciphertext columns.

A destroyed key must never surface here: destruction is checked before any decryption is attempted, and reports AshVault.Errors.KeyDestroyed.

Summary

Functions

exception(args)

@spec exception(opts :: Keyword.t()) :: %AshVault.Errors.CiphertextIntegrityFailed{
  __exception__: true,
  bread_crumbs: term(),
  class: term(),
  field: term(),
  key_version: term(),
  path: term(),
  resource: term(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}

Create an Elixir.AshVault.Errors.CiphertextIntegrityFailed without raising it.

Keys

  • :resource
  • :field
  • :key_version