crypto(7)

✨ crypto β€” the Crypto Application ✨

okay bestie, gather round, because this is the manual page for crypto, aka the Crypto Application, and it's lowkey one of the most important little apps in the whole Erlang/OTP universe. it's from the Erlang Application Definition family, so you already know it's giving "official documentation, but make it serve." πŸ’…


πŸ¦‹ NAME πŸ¦‹

crypto β€” The Crypto Application. that's her. that's the name. no notes. πŸ’–


🌸 DESCRIPTION 🌸

so the whole purpose of the Crypto application is to hand you an Erlang API to cryptographic functions β€” you can peep the actual function list in crypto(3erl). πŸŽ€

real talk though: that API is on a fairly low level. like, it's not gonna hold your hand.

and here's the tea β€” there are some corresponding API functions chillin' in public_key(3erl) that live on a higher abstraction level</>, and those ones actually use the crypto application under the hood to do their thing. so crypto is basically the backstage icon making the whole show work. πŸ‘‘


🌈 DEPENDENCIES 🌈

okay so this is where it gets a lil technical but stay with me bestie. the current crypto implementation uses nifs to interface with OpenSSL's crypto library, and it may work with limited functionality with versions as old as OpenSSL 0.9.8c. like, she'll try, but don't expect the full menu. πŸ™ˆ

FIPS mode support requires at least version 1.0.1 and a FIPS capable OpenSSL installation. both. you need both. βœ‹

we recommend using a version that is officially supported by the OpenSSL project, because obviously. and API compatible backends like LibreSSL should also work, which is slay of them. 🫢


the crypto app is tested daily with at least one version of each of these:

  • OpenSSL 1.0.1
  • OpenSSL 1.0.2
  • OpenSSL 1.1.0
  • OpenSSL 1.1.1
  • OpenSSL 3.0

and FIPS mode is also tested for 1.0.1 and 1.0.2. consistency? we love to see it. ⭐

⚠️ IMPORTANT BESTIE: using OpenSSL 3.0 with Engines or in FIPS mode is not yet supported by the OTP/crypto app. so like, don't do that yet. fr fr. πŸ’€

source releases of OpenSSL can be downloaded from the OpenSSL project home page, or from mirror sites listed there. go get 'em. πŸ¦‹


πŸŽ€ CONFIGURATION πŸŽ€

these are the configuration parameters defined for the crypto application. if you wanna know more about configuration parameters in general, check out app(3erl). iykyk. ✨

fips_mode = boolean():

specifies whether to run crypto in FIPS mode. this setting takes effect when the nif module is loaded β€” so timing matters, babes. ⏰

and here's the dramatic part: if FIPS mode is requested but not available at run time, the nif module β€” and thus the crypto module β€” will fail to load. not a warning, not a little hint. it just fails. 😭

but honestly? that's the point. this mechanism prevents the accidental use of non-validated algorithms. it's a safety feature, not a bug, and honestly it's giving protective bestie energy. πŸ›‘οΈπŸ’–

rand_cache_size = integer():

sets the cache size in bytes to use by crypto:rand_seed_alg(crypto_cache) and crypto:rand_seed_alg_s(crypto_cache). πŸ‘‘

this parameter is read when a seed function is called, and then kept in the generator's state object. so it's a set-it-and-it-remembers-it kinda situation. πŸ’…

it has a rather small default value, which causes reads of strong random bytes about once per hundred calls for a random value. the set value is rounded up to an integral number of words of the size these seed functions use. math! we love her! 🧚


πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, gorgeous. this little legend was brought to you by Ericsson AB, and it's crypto 5.1.4.1 β€” the crypto(7) manual page. mwah. πŸ’‹βœ¨πŸŽ€

πŸ“¦ where this page comes from