20142018 Ericsson AB. All Rights Reserved. The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Algorithm Details Hans Nilsson 2018-08-22 A algorithm_details.xml

This chapter describes details of algorithms in the crypto application.

The tables only documents the supported cryptos and key lengths. The user should not draw any conclusion on security from the supplied tables.

Ciphers
Block Ciphers

To be used in block_encrypt/3, block_encrypt/4, block_decrypt/3 and block_decrypt/4.

Available in all OpenSSL compatible with Erlang CRYPTO if not disabled by configuration.

To dynamically check availability, check that the name in the Cipher and Mode column is present in the list with the cipher tag in the return value of crypto:supports().

Cipher and ModeKey length
[bytes]
IV length
[bytes]
Block size
[bytes]
aes_cbc 16, 24, 321616aes_cbc128161616aes_cbc256321616aes_cfb8 16, 24, 3216anyaes_ecb16, 24, 32 16aes_ige256163216blowfish_cbc 4-56 8 8blowfish_cfb64 1- 8 anyblowfish_ecb1- 8blowfish_ofb641-8anydes3_cbc
(=DES EDE3 CBC)
[8,8,8]88
des3_cfb
(=DES EDE3 CFB)
[8,8,8]8any
des_cbc88 8des_cfb88anydes_ecb8 8des_ede3
(=DES EDE3 CBC)
[8,8,8]88
rc2_cbc1-88Block cipher key lengths
AEAD Ciphers

To be used in block_encrypt/4 and block_decrypt/4.

To dynamically check availability, check that the name in the Cipher and Mode column is present in the list with the cipher tag in the return value of crypto:supports().

Cipher and ModeKey length
[bytes]
IV length
[bytes]
AAD length
[bytes]
Tag length
[bytes]
Block size
[bytes]
Supported with
OpenSSL versions
aes_ccm 16,24,32 7-13 any even 4-16
default: 12
any1.1.0 -
aes_gcm 16,24,32 1- any 1-16
default: 16
any1.1.0 -
chacha20_poly130532 1-16 any 16 any1.1.0 -AEAD cipher key lengths
Stream Ciphers

To be used in stream_init/2 and stream_init/3.

To dynamically check availability, check that the name in the Cipher and Mode column is present in the list with the cipher tag in the return value of crypto:supports().

Cipher and ModeKey length
[bytes]
IV length
[bytes]
Supported with
OpenSSL versions
aes_ctr16, 24, 32161.0.1 -rc41- allStream cipher key lengths
Message Authentication Codes (MACs)
CMAC

To be used in cmac/3 and cmac/4.

CMAC with the following ciphers are available with OpenSSL 1.0.1 or later if not disabled by configuration.

To dynamically check availability, check that the name cmac is present in the list with the macs tag in the return value of crypto:supports(). Also check that the name in the Cipher and Mode column is present in the list with the cipher tag in the return value.

Cipher and ModeKey length
[bytes]
Max Mac Length
[bytes]
aes_cbc 16, 24, 3216aes_cbc1281616aes_cbc2563216aes_cfb8 161blowfish_cbc 4-56 8blowfish_cfb64 1- 1blowfish_ecb1- 8blowfish_ofb641- 1des3_cbc
(=DES EDE3 CBC)
[8,8,8]8
des3_cfb
(=DES EDE3 CFB)
[8,8,8]1
des_cbc88des_cfb81des_ecb81rc2_cbc1-8CMAC cipher key lengths
HMAC

Available in all OpenSSL compatible with Erlang CRYPTO if not disabled by configuration.

To dynamically check availability, check that the name hmac is present in the list with the macs tag in the return value of crypto:supports().

POLY1305

POLY1305 is available with OpenSSL 1.1.1 or later if not disabled by configuration.

To dynamically check availability, check that the name poly1305 is present in the list with the macs tag in the return value of crypto:supports().

Hash

To dynamically check availability, check that the wanted name in the Names column is present in the list with the hashs tag in the return value of crypto:supports().

Type Names Supported with
OpenSSL versions
SHA1shaallSHA2sha224, sha256, sha384, sha512allSHA3sha3_224, sha3_256, sha3_384, sha3_5121.1.1 -MD4md4allMD5md5allRIPEMDripemd160all
Public Key Cryptography
RSA

RSA is available with all OpenSSL versions compatible with Erlang CRYPTO if not disabled by configuration. To dynamically check availability, check that the atom rsa is present in the list with the public_keys tag in the return value of crypto:supports().

The RSA options are experimental.

The exact set of options and there syntax may be changed without prior notice.

Option sign/verify encrypt/decrypt Supported with
OpenSSL versions
{rsa_mgf1_md,atom()} x x 1.0.1{rsa_oaep_label, binary()} x {rsa_oaep_md, atom()} x {rsa_padding,rsa_pkcs1_pss_padding} x 1.0.0{rsa_pss_saltlen, -2..} x 1.0.0{rsa_padding,rsa_no_padding} x x {rsa_padding,rsa_pkcs1_padding} x x {rsa_padding,rsa_sslv23_padding} x {rsa_padding,rsa_x931_padding} x
DSS

DSS is available with OpenSSL versions compatible with Erlang CRYPTO if not disabled by configuration. To dynamically check availability, check that the atom dss is present in the list with the public_keys tag in the return value of crypto:supports().

ECDSA

ECDSA is available with OpenSSL 0.9.8o or later if not disabled by configuration. To dynamically check availability, check that the atom ecdsa is present in the list with the public_keys tag in the return value of crypto:supports(). If the atom ec_gf2m characteristic two field curves are available.

The actual supported named curves could be checked by examining the list with the curves tag in the return value of crypto:supports().

Diffie-Hellman

Diffie-Hellman computations are available with OpenSSL versions compatible with Erlang CRYPTO if not disabled by configuration. To dynamically check availability, check that the atom dh is present in the list with the public_keys tag in the return value of crypto:supports().

Elliptic Curve Diffie-Hellman

Elliptic Curve Diffie-Hellman is available with OpenSSL 0.9.8o or later if not disabled by configuration. To dynamically check availability, check that the atom ecdh is present in the list with the public_keys tag in the return value of crypto:supports().

The Edward curves x25519 and x448 are supported with OpenSSL 1.1.1 or later if not disabled by configuration.

The actual supported named curves could be checked by examining the list with the curves tag in the return value of crypto:supports().