Skip to content

:crypto.strong_rand_bytes/1 can throw a low_entropy exception #1

Description

@igalic

according to its documentation, :crypto.strong_rand_bytes/1 can throw an exception:

May throw exception low_entropy in case the random generator failed due to lack of secure "randomness".

we should at least document that this can happen

there's some options beyond that:

  • do/try around :crypto.strong_rand_bytes(16) to optionally return an error
  • have an weak_entropy_init/1 helper that can be used on potentially low entropy systems

this kind of issue will generally happens early after startup when not enough entropy hasn't been gathered, or if the system doesn't implement a sensible PRNG (a CSPRNG, that is;)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions