This module provides a set of cryptographic functions.
Hash functions -
Hmac functions -
Block ciphers -
Digital signatures
byte() = 0 ... 255
ioelem() = byte() | binary() | iolist()
iolist() = [ioelem()]
key_value() = integer() | binary()
rsa_public() = [key_value()] = [E, N]
Where E is the public exponent and N is public modulus.
rsa_private() = [key_value()] = [E, N, D] | [E, N, D, P1, P2, E1, E2, C]
Where E is the public exponent, N is public modulus and D is the private exponent.The longer key format contains redundant information that will make the calculation faster. P1,P2 are first and second prime factors. E1,E2 are first and second exponents. C is the CRT coefficient. Terminology is taken from RFC 3447.
dss_public() = [key_value()] = [P, Q, G, Y]
Where P, Q and G are the dss parameters and Y is the public key.
dss_private() = [key_value()] = [P, Q, G, X]
Where P, Q and G are the dss parameters and X is the private key.
dss_public() = [key_value()] =[P, Q, G, Y]
srp_public() = key_value()
Where is
srp_private() = key_value()
Where is
srp_params() = {user, [Generator::binary(), Prime::binary(), Version::atom()]} |
{host, [Verifier::binary(), Generator::binary(), Prime::binary(), Version::atom()]}
| {user, [DerivedKey::binary(), Prime::binary(), Generator::binary(), Version::atom() | [Scrambler:binary()]]}
| {host,[Verifier::binary(), Prime::binary(), Version::atom() | [Scrambler::binary]]}
Where Verifier is
dh_public() = key_value()
dh_private() = key_value()
dh_params() = [key_value()] = [P, G]
ecdh_public() = key_value()
ecdh_private() = key_value()
ecdh_params() = ec_named_curve() |
{ec_field(), Prime :: key_value(), Point :: key_value(), Order :: integer(), CoFactor :: none | integer()}
ec_field() = {prime_field, Prime :: integer()} |
{characteristic_two_field, M :: integer(), Basis :: ec_basis()}
ec_basis() = {tpbasis, K :: non_neg_integer()} |
{ppbasis, K1 :: non_neg_integer(), K2 :: non_neg_integer(), K3 :: non_neg_integer()} |
onbasis
ec_named_curve() ->
sect571r1| sect571k1| sect409r1| sect409k1| secp521r1| secp384r1| secp224r1| secp224k1|
secp192k1| secp160r2| secp128r2| secp128r1| sect233r1| sect233k1| sect193r2| sect193r1|
sect131r2| sect131r1| sect283r1| sect283k1| sect163r2| secp256k1| secp160k1| secp160r1|
secp112r2| secp112r1| sect113r2| sect113r1| sect239k1| sect163r1| sect163k1| secp256r1|
secp192r1
stream_cipher() = rc4 | aes_ctr
block_cipher() = aes_cbc128 | aes_cfb128 | blowfish_cbc |
blowfish_cfb64 | des_cbc | des_cfb | des3_cbc | des3_cbf
| des_ede3 | rc2_cbc
stream_key() = aes_key() | rc4_key()
block_key() = aes_key() | blowfish_key() | des_key()| des3_key()
aes_key() = binary()
Key length is 128, 192 or 256 bits
rc4_key() = binary()
Variable key length from 8 bits up to 2048 bits (usually between 40 and 256)
blowfish_key() = binary()
Variable key length from 32 bits up to 448 bits
des_key() = binary()
Key length is 64 bits (in CBC mod only 8 bits are used)
des3_key() = [binary(), binary(), binary()]
Each key part is 64 bits (in CBC mod only 8 bits are used)
Provides the available crypto algorithms in terms of a list of atoms. This is interesting as older versions of the openssl crypto library may not support all algorithms used in the crypto API.
Encrypt
Decrypt
Computes the shared secret from the private key and the other party's public key.
Performs bit-wise XOR (exclusive or) on the data supplied.
Generates public keys of type
Computes a message digest of type
May throw exception
Initializes the context for streaming hash operations.
May throw exception
Updates the digest represented by
Finalizes the hash operation referenced by
Computes a HMAC of type
Initializes the context for streaming HMAC operations.
Updates the HMAC represented by
Finalizes the HMAC operation referenced by
Finalizes the HMAC operation referenced by
Provides the name and version of the libraries used by crypto.
> info_lib(). [{<<"OpenSSL">>,9469983,<<"OpenSSL 0.9.8a 11 Oct 2005">>}]
From OTP R16 the numeric version represents the version of the OpenSSL
header files (
Computes the function
Returns the initialization vector to be used in the next
iteration of encrypt/decrypt of type
Decrypts the
Encrypts the
Decrypts the
Encrypts the
Generates N bytes randomly uniform 0..255, and returns the
result in a binary. Uses the
Generate a random number
Creates a digital signature.
Equivalent to application:start(crypto).
Equivalent to application:stop(crypto).
Generates N bytes randomly uniform 0..255, and returns the
result in a binary. Uses a cryptographically secure prng seeded and
periodically mixed with operating system provided entropy. By default
this is the
May throw exception
Initializes the state for use in RC4 stream encryption
Initializes the state for use in streaming AES encryption using Counter mode (CTR).
Encrypts
Decrypts
Verifies a digital signature