Encryption
Last updated
Last updated
This page contains recommendations for choosing an encryption algorithm, key length, cryptographic parameters and materials, and implementation features.
Do not implement custom cryptographic algorithms.
Use only public algorithms that have been proven to be strong, such as AES
, RSA
or Curve25519
.
The implementation of a cryptographic algorithm should be widely distributed and developed with the involvement of a cryptographic expert.
Use nonces, initialization vectors, and other single-use numbers only once with a given encryption key.
The minimum allowed symmetric encryption algorithm is AES/128/GCM
.
When using Authenticated Encryption and Authenticated Encryption with Associated Data encryption forms:
Use CCM
or GCM
encryption modes.
If CCM
and GCM
modes are not available:
Use nonces, initialization vectors, and other single-use numbers only once with a given encryption key.
Use PKCS7
padding.
The minimum allowed symmetric encryption algorithm is AES/256/GCM
.
Use Authenticated Encryption and Authenticated Encryption with Associated Data encryption forms.
The minimum allowed asymmetric encryption algorithm is RSA/2048/SHA256
.
Use elliptical curve cryptography (ECC) with a secure curve that provides at least 128 bits of security strength, such as secp256r1
.
The minimum allowed asymmetric encryption algorithm is RSA/3072/SHA256
.
Use elliptical curve cryptography (ECC) with a secure curve that provides at least 256 bits of security strength, such as secp521r1
.
AES/256/GCM encryption and decryption
RSA/2048/SHA256 encryption and decryption
The main criterion for choosing an encryption algorithm and the key length is the required level of security. That is, the longer data must remain encrypted, the stronger algorithm must be used. The strength of an algorithm is determined by the presence of effective attacks on it and the key length used. Table 2: Comparable strengths
from the compares security levels for approved algorithms and key lengths.
Use cryptographically strong random number generators to generate all random values that are used as cryptographic parameters such as initialization vectors, nonces, keys, etc., see the page.
Comply with requirements from the page.
Log errors in cryptography components, see the page.
Comply with requirements from the page.
Use or certified implementations of cryptographic algorithms.
Use only encryption modes such as CCM
, GCM
, CTR
, or CBC
.
Do not use .
Use block encryption in CBC
mode and the Encrypt-then-MAC
technique with the .
Do not use CBC-MAC
with .
Use the package to implement cryptographic operations.