Recent from talks
Nothing was collected or created yet.
Comparison of cryptography libraries
View on Wikipedia
The tables below compare cryptography libraries that deal with cryptography algorithms and have application programming interface (API) function calls to each of the supported features.
Cryptography libraries
[edit]| Name of implementation | Initiative | Main implementation language | Open-source software | Software license | Latest release | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Botan | Jack Lloyd | C++ | Yes | Simplified BSD | 3.8.1 (May 7, 2025[1]) [±] | ||||||||||
| Bouncy Castle | Legion of the Bouncy Castle Inc. | Java, C# | Yes | MIT License |
| ||||||||||
| BSAFE | Dell, formerly RSA Security | Java, C, Assembly | No | Proprietary | Crypto-C Micro Edition: 4.1.5 (December 17, 2020[7]) [±]
| ||||||||||
| cryptlib | Peter Gutmann | C | Yes | Sleepycat License or commercial license | 3.4.8 (April 30, 2025[11]) [±] | ||||||||||
| Crypto++ | The Crypto++ project | C++ | Yes | Boost (all individual files are public domain) | Jan 10, 2023 (8.9.0) | ||||||||||
| GnuTLS | Nikos Mavrogiannopoulos, Simon Josefsson | C | Yes | LGPL-2.1-or-later | 3.8.10[12] | ||||||||||
| Intel Cryptography Primitives Library | Intel | C, ASM | Yes | Apache 2.0 | March 2025 (2025.1.0 / 1.1.0) | ||||||||||
| Java's default JCA/JCE providers | Oracle | Java | Yes | GNU GPL v2 and commercial license |
25 LTS (September 16, 2025[13]) [±] | ||||||||||
| LibreSSL | OpenBSD Foundation | C | Yes | Apache 1.0 | 4.2.1[18] | ||||||||||
| Libgcrypt | GnuPG community and g10code | C | Yes | GNU LGPL v2.1+ |
| ||||||||||
| libsodium | Frank Denis | C | Yes | ISC | Sep 13, 2023 (1.0.19) | ||||||||||
| Mbed TLS | Arm Limited | C | Yes | Apache 2.0 | 3.0.0 (July 7, 2021[21]) [±] | ||||||||||
| NaCl | Daniel J. Bernstein, Tanja Lange, Peter Schwabe | C | Yes | Public domain | February 21, 2011[22] | ||||||||||
| Nettle | C | Yes | GNU GPL v2+ or GNU LGPL v3 |
3.10.2[23] | |||||||||||
| Network Security Services (NSS) | Mozilla | C | Yes | MPL 2.0 |
| ||||||||||
| OpenSSL | The OpenSSL Project | C | Yes | Apache 2.0 | 3.6.0[25] | ||||||||||
| wolfCrypt | wolfSSL, Inc. | C | Yes | GNU GPL v3 or commercial license | 5.8.2 (July 17, 2025[26]) [±] |
FIPS 140
[edit]This table denotes, if a cryptography library provides the technical requisites for FIPS 140, and the status of their FIPS 140 certification (according to NIST's CMVP search,[27] modules in process list[28] and implementation under test list).[29]
| Implementation | FIPS 140-2 mode | FIPS 140-2 validated | FIPS 140-3 validated |
|---|---|---|---|
| Botan | No | No | No |
| Bouncy Castle | Yes | Yes[30] | Yes[31] |
| BSAFE | Yes | Yes[32][33] | Yes[34] |
| cryptlib | Yes | No | No |
| Crypto++ | No | No[a] | No |
| GnuTLS | No | Yes[35][b] | In process[36] |
| Intel Cryptography Primitives Library | No [c] | No [c] | No [c] |
| Java's default JCA/JCE providers | No | No[37][d] | No |
| Libgcrypt | Yes | Yes[38][e] | In process[36] |
| libsodium | No | No | No |
| Mbed TLS | No | No | No |
| NaCl | No | No | No |
| Nettle | No | No | No |
| Network Security Services (NSS) | Yes | Yes[39][f] | In process[36] |
| OpenSSL | Yes | Yes[40][g] | Yes[41] |
| wolfCrypt | Yes | Yes[42] | Yes[43] |
- ^ Crypto++ received three FIPS 140 validations from 2003 through 2008. In 2016 NIST moved Crypto++ to the Historical Validation List.
- ^ While GnuTLS is not FIPS 140-2 validated by GnuTLS.org, validations exist for versions from Amazon Web Services Inc., Oracle Corporation, Red Hat Inc. and SUSE LLC.
- ^ a b c Intel Cryptography Primitives Library is not FIPS 140-3 validated but FIPS 140-3 compliant.
- ^ While none of default JDK JCA/JCE providers is FIPS 140-2 validated, there are other JCE/JCA third party providers which are FIPS 140-2 validated.
- ^ While Libgcrypt is not FIPS 140-2 validated by g10code, validations exist for versions from Amazon Web Services Inc., Canonical Ltd., Oracle Corporation, Red Hat Inc. and SUSE LLC.
- ^ While the Network Security Services (NSS) are not FIPS 140-2 validated by the Mozilla Foundation, validations exist for versions from Amazon Web Services Inc., Canonical Ltd., Cisco Systems Inc., Hewlett Packard Enterprise, Oracle Corporation, Red Hat Inc., SafeLogic Inc., SUSE LLC and Trend Micro Inc.
- ^ While OpenSSL is not FIPS 140-2 validated by OpenSSL.org, validations exist for versions from Amazon Web Services Inc., Aqua Security Software Ltd., Broadcom Inc., Canonical Ltd., Cisco Systems Inc., Cohesity Inc., ControlUp Technologies Inc., Crestron Electronics Inc., Dell Inc., Gallagher Group, Hewlett Packard Enterprise, IBM Corporation, ICU Medical Inc., Intelligent Waves, Ixia, KeyPair Consulting Inc., Koninklijke Philips N.V., Lenovo Group Limited, LG Electronics Inc., LogRhythm, McAfee LLC, Metaswitch Networks Ltd, NetBrain Technologies Inc., Nutanix Inc., Onclave Networks Inc., Oracle Corporation, REDCOM Laboratories Inc., Red Hat Inc., SafeLogic Inc., Super Micro Computer Inc., SUSE LLC, Tanium Inc., Trend Micro Inc., Unisys Corporation, Verizon, VMware Inc. and Wickr Inc.
Key operations
[edit]Key operations include key generation algorithms, key exchange agreements, and public key cryptography standards.
Public key algorithms
[edit]| Implementation | RSA | DSA | ECDSA | EdDSA | Ed448 | DH | ECDH | ECIES | ElGamal | NTRU (IEEE P1363.1) |
DSS |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Botan | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes |
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| BSAFE | Yes | Yes | Yes | No | No | Yes | Yes | Yes | No | No | No |
| cryptlib | Yes | Yes | Yes | No | No | Yes | Yes | No | Yes | No | Yes |
| Crypto++ | Yes | Yes | Yes | No | No | Yes | Yes | Yes | Yes | No | Yes |
| GnuTLS | Yes | No | No | No | No | No | No | No | No | No | No |
| Intel Cryptography Primitives Library | Yes | Yes | Yes | Yes | No | Yes | Yes | No | No | No | Yes |
| Java's default JCA/JCE providers | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No | No | Yes |
| Libgcrypt | Yes | Yes | Yes | Yes | Yes | Yes | Yes[a] | No | Yes | No | Yes |
| libsodium | No | No | No | Yes | No | No | No | No | No | No | No |
| Mbed TLS | Yes | Yes | Yes | No | No | Yes | Yes | No | No | No | No |
| Nettle | Yes | Yes | No | Yes | No | No | No | No | No | No | No |
| OpenSSL | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No | No | No |
| wolfCrypt | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes |
- ^ By using the lower level interface.
Elliptic-curve cryptography (ECC) support
[edit]| Implementation | NIST | SECG | ECC Brainpool | Curve25519 | Curve448 | GOST R 34.10[44] | SM2 |
|---|---|---|---|---|---|---|---|
| Botan | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| BSAFE | Yes | Yes | No | No | No | No | No |
| cryptlib | Yes | Yes | Yes | No | No | No | No |
| Crypto++ | Yes | Yes | Yes | Yes | No | No | No |
| GnuTLS | Yes | No | No | No | No | No | No |
| Intel Cryptography Primitives Library | Yes | No | No | Yes [a] | No | No | Yes |
| Java's default JCA/JCE providers | Yes | Yes | No | Yes | Yes | No | No |
| Libgcrypt | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| libsodium | Yes | No | No | Yes | Yes | No | No |
| Mbed TLS | Yes | Yes | Yes | Yes | No | No | No |
| Nettle | Yes | Partial | No | Yes | No | No | No |
| OpenSSL | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| wolfCrypt | Yes | Yes | Yes | Yes | Yes | No | Yes |
- ^ Supported in Intel Cryptography Primitives Library multi-buffer API only (not supported in single-buffer API).
Public key cryptography standards
[edit]| Implementation | PKCS #1 | PKCS #5,[45] PBKDF2 | PKCS #8 | PKCS #12 | IEEE P1363 | ASN.1 |
|---|---|---|---|---|---|---|
| Botan | Yes | Yes | Yes | No | Yes | Yes |
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes | Yes |
| BSAFE Crypto-J | Yes | Yes | Yes | Yes | No | Yes |
| cryptlib | Yes | Yes | Yes | Yes | No | Yes |
| Crypto++ | Yes | Yes | Yes[a] | No | Yes | Yes |
| GnuTLS | ||||||
| Intel Cryptography Primitives Library | Yes | No | No | No | Yes | No |
| Java's default JCA/JCE providers | Yes | Yes | Yes | Yes | Yes | Yes |
| Libgcrypt | Yes | Yes[b] | Yes[b] | Yes[b] | Yes[b] | Yes[b] |
| libsodium | No | No | No | No | No | No |
| Mbed TLS | Yes | No | Yes | Yes | No | Yes |
| Nettle | Yes | Yes | No | No | No | No |
| OpenSSL | Yes | Yes | Yes | Yes | No | Yes |
| wolfCrypt | Yes | Yes | Yes | Yes | No | Yes |
- ^ The library offers X.509 and PKCS #8 encoding without PEM by default. For PEM encoding of public and private keys the PEM Pack is needed.
- ^ a b c d e These Public Key Cryptographic Standards (PKCS) are supported by accompanying libraries and tools, which are also part of the GnuPG framework, although not by the actual libgcrypt library.
Hash functions
[edit]Comparison of supported cryptographic hash functions. Here hash functions are defined as taking an arbitrary length message and producing a fixed size output that is virtually impossible to use for recreating the original message.
| Implementation | MD5 | SHA-1 | SHA-2 | SHA-3 | RIPEMD-160 | Tiger | Whirlpool | BLAKE2 | GOST R 34.11-94[46] (aka GOST 34.311-95) |
GOST R 34.11-2012 (Stribog)[47] |
SM3 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Botan | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| BSAFE Crypto-J | Yes | Yes | Yes | Yes | Yes | No | No | No | No | No | No |
| cryptlib | Yes | Yes | Yes | Yes | Yes | No | Yes | No | No | No | No |
| Crypto++ | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes |
| GnuTLS | |||||||||||
| Intel Cryptography Primitives Library | Yes | Yes | Yes | Yes | No | No | No | No | No | No | Yes |
| Java's default JCA/JCE providers | Yes | Yes | Yes | Yes | No | No | No | No | No | No | No |
| Libgcrypt | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| libsodium | No | No | Yes | No | No | No | No | Yes | No | No | No |
| Mbed TLS | Yes | Yes | Yes | Yes | Yes | No | No | No | No | No | No |
| Nettle | Yes | Yes | Yes | Yes | Yes | No | No | No | Yes | No | No |
| OpenSSL | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes |
| wolfCrypt | Yes | Yes | Yes | Yes | Yes | No | No | Yes | No | No | Yes |
MAC algorithms
[edit]Comparison of implementations of message authentication code (MAC) algorithms. A MAC is a short piece of information used to authenticate a message—in other words, to confirm that the message came from the stated sender (its authenticity) and has not been changed in transit (its integrity).
| Implementation | HMAC-MD5 | HMAC-SHA1 | HMAC-SHA2 | Poly1305 | BLAKE2-MAC |
|---|---|---|---|---|---|
| Botan | Yes | Yes | Yes | Yes | Yes |
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes |
| BSAFE Crypto-J | Yes | Yes | Yes | Yes | No |
| cryptlib | Yes | Yes | Yes | Yes | No |
| Crypto++ | Yes | Yes | Yes | Yes | Yes |
| GnuTLS | |||||
| Intel Cryptography Primitives Library | Yes | Yes | Yes | No | No |
| Java's default JCA/JCE providers | Yes | Yes | Yes | No | No |
| Libgcrypt | Yes | Yes | Yes | Yes | Yes |
| libsodium | No | No | Yes | Yes | Yes |
| Mbed TLS | Yes | Yes | Yes | No | No |
| Nettle | Yes | Yes | Yes | Yes | No |
| OpenSSL | Yes | Yes | Yes | Yes | Yes |
| wolfCrypt | Yes | Yes | Yes | Yes | Yes |
Block ciphers
[edit]Table compares implementations of block ciphers. Block ciphers are defined as being deterministic and operating on a set number of bits (termed a block) using a symmetric key. Each block cipher can be broken up into the possible key sizes and block cipher modes it can be run with.
Block cipher algorithms
[edit]| Implementation | AES | 3DES | Camellia | Blowfish | Twofish | IDEA | CAST5 | ARIA | GOST 28147-89[48] / GOST R 34.12-2015 (Magma[49] & Kuznyechik[50]) |
SM4 |
|---|---|---|---|---|---|---|---|---|---|---|
| Botan | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Bouncy Castle[51] | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| BSAFE Crypto-J | Yes | Yes | No | No | No | No | No | No | No | No |
| cryptlib[52] | Yes | Yes | No | Yes | No | Yes | Yes | No | No | No |
| Crypto++ | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Partial[a] | Yes |
| GnuTLS | Yes | No | Yes | No | No | No | No | No | No | No |
| Intel Cryptography Primitives Library | Yes | Yes | No | No | No | No | No | No | No | Yes |
| Java's default JCA/JCE providers | Yes | Yes | No | Yes | No | No | No | No | No | No |
| Libgcrypt | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| libsodium | Partial[b] | No | No | No | No | No | No | No | No | No |
| Mbed TLS | Yes | Yes | Yes | Yes | No | No | No | No | No | No |
| Nettle | Yes | Yes | Yes | Yes | No | No | No | No | No | No |
| OpenSSL | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes | Yes |
| wolfCrypt | Yes | Yes | Yes | No | No | Yes | No | Yes | No | Yes |
Cipher modes
[edit]| Implementation | ECB | CBC | OFB | CFB | CTR | CCM | GCM | OCB | XTS | AES-Wrap | Stream | EAX |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Botan | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes |
| BSAFE | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | No |
| cryptlib | Yes | Yes | Yes | Yes | Yes | No | Yes | No | No | No | No | No |
| Crypto++ | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | No | Yes | Yes |
| GnuTLS | ||||||||||||
| Intel Cryptography Primitives Library | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | No | Yes | No |
| Java's default JCA/JCE providers | Yes | Yes | Yes | Yes | Yes | No | Yes | No | No | Yes | Yes | No |
| Libgcrypt | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| libsodium | No | No | No | No | Yes | No | Yes | No | No | No | No | No |
| Mbed TLS | Yes | Yes | No | Yes | Yes | Yes | Yes | No | No | No | No | No |
| Nettle | Yes | Yes | No | No | Yes | Yes | Yes | No | No | No | No | No |
| OpenSSL | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
| wolfCrypt | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
Stream ciphers
[edit]The table below shows the support of various stream ciphers. Stream ciphers are defined as using plain text digits that are combined with a pseudorandom cipher digit stream. Stream ciphers are typically faster than block ciphers and may have lower hardware complexity, but may be more susceptible to attacks.
| Implementation | RC4 | HC-256 | Rabbit | Salsa20 | ChaCha | SEAL | Panama | WAKE | Grain | VMPC | ISAAC |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Botan | Yes | No | No | Yes | Yes | No | No | No | No | No | No |
| Bouncy Castle | Yes | Yes | No | Yes | Yes | No | No | No | Yes | Yes | Yes |
| BSAFE Crypto-J | Yes | No | No | No | Yes | No | No | No | No | No | No |
| cryptlib | Yes | No | No | No | Yes | No | No | No | No | No | No |
| Crypto++ | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | No | No |
| GnuTLS | |||||||||||
| Intel Cryptography Primitives Library | No | No | No | No | No | No | No | No | No | No | No |
| Java's default JCA/JCE providers | Yes | No | No | No | Yes | No | No | No | No | No | No |
| Libgcrypt | Yes | No | No | Yes | Yes | No | No | No | No | No | No |
| libsodium | No | No | No | Yes | Yes | No | No | No | No | No | No |
| Mbed TLS | Yes | No | No | No | Yes | No | No | No | No | No | No |
| Nettle | Yes | No | No | Yes | Yes | No | No | No | No | No | No |
| OpenSSL | Yes | No | No | No | Yes | No | No | No | No | No | No |
| wolfCrypt | Yes | No | No | Yes | Yes | No | No | No | No | No | No |
Hardware-assisted support
[edit]These tables compare the ability to use hardware enhanced cryptography. By using the assistance of specific hardware, the library can achieve greater speeds and/or improved security than otherwise.
Smart card, SIM, HSM protocol support
[edit]| Implementation | PKCS #11 | PC/SC | CCID |
|---|---|---|---|
| Botan | Yes | No | No |
| Bouncy Castle | Yes[a] | No | No |
| BSAFE | Yes[b] | No | No |
| cryptlib | Yes | No | No |
| Crypto++ | No | No | No |
| GnuTLS | Yes | No | No |
| Intel Cryptography Primitives Library | No | No | No |
| Java's default JCA/JCE providers | Yes | No[c] | No[c] |
| Libgcrypt | Yes[53] | Yes[54] | Yes[54] |
| libsodium | No | No | No |
| Mbed TLS | Yes[55] | No | No |
| OpenSSL | Yes[55] | No | No |
| wolfCrypt | Yes | No | No |
General purpose CPU, platform acceleration support
[edit]| Implementation | AES-NI | SSSE3, SSE4.1 | AVX, AVX2 | AVX-512 | RDRAND | VIA PadLock | Intel QuickAssist | ARMv7-A NEON | ARMv8-A cryptography instructions | Power ISA v2.03 (AltiVec[a]) | Power ISA v2.07 (e.g., POWER8 and later[a]) |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Botan | Yes | Yes | Yes | Yes | Yes | No | No | Yes | Yes | Yes | Yes |
| BSAFE | Yes[b] | Yes[b] | Yes[b] | No | Yes[b] | No | No | No | Yes[b] | No | No |
| cryptlib | Yes | Yes | Yes | No | Yes | Yes | No | No | No | No | No |
| Crypto++ | Yes | Yes | Yes | No | Yes | Yes[c] | No | Yes | Yes | Yes | Yes |
| GnuTLS | Yes | No | No | No | No | Yes | No | No | No | No | No |
| Intel Cryptography Primitives Library | Yes | Yes | Yes | Yes | Yes | No | No | No | No | No | No |
| Java's default JCA/JCE providers | Yes[d] | Yes[d] | Yes[d] | Yes[d] | Yes[d] | No | No | No | Yes[d] | No | Yes[d] |
| Libgcrypt[56] | Yes | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | No | Yes |
| libsodium | Yes | Yes | Yes | No | No | No | No | No | No | No | No |
| OpenSSL | Yes | Yes | Yes | Yes | Yes[e] | Yes | No | Yes | Yes | Yes | Yes |
| wolfCrypt | Yes | Yes | Yes | No | Yes | No | Yes[57] | Yes | Yes[58] | No | No |
- ^ a b AltiVec includes POWER4 through POWER8 SIMD processing. POWER8 added in-core crypto, which provides accelerated AES, SHA and PMUL similar to ARMv8.1.
- ^ a b c d e When using RSA BSAFE Crypto-J in native mode using BSAFE Crypto-C Micro Edition
- ^ Crypto++ only provides access to the Padlock random number generator. Other functions, like AES acceleration, are not provided.
- ^ a b c d e f g When using the HotSpot JVM
- ^ OpenSSL RDRAND support is provided through the ENGINE interface. The RDRAND generator is not used by default.
Code size and code to comment ratio
[edit]| Implementation | Source code size (kSLOC = 1000 lines of source code) |
Code to comment lines ratio |
|---|---|---|
| Botan | 133[59] | 4.55[59] |
| Bouncy Castle | 1359[60] | 5.26[60] |
| BSAFE Crypto-J | 271[a] | 1.3[a] |
| cryptlib | 241 | 2.66 |
| Crypto++ | 115[61] | 5.74[61] |
| GnuTLS | 363[62] | 7.30[62] |
| Java's default JCA/JCE providers | ||
| Libgcrypt | 216[63] | 6.27[63] |
| libsodium | 44[64] | 21.92[64] |
| Mbed TLS | 105[65] | 33.9[65] |
| Nettle | 111[66] | 4.08[66] |
| OpenSSL | 472[67] | 4.41[67] |
| wolfCrypt | 39 | 5.69 |
- ^ a b Based on Crypto-J 6.2.5, excluding tests source. Generated using https://github.com/XAMPPRocky/tokei
Portability
[edit]| Implementation | Supported operating system | Thread safe |
|---|---|---|
| Botan | Linux, Windows, macOS, Android, iOS, FreeBSD, NetBSD, OpenBSD, DragonflyBSD, Solaris, AIX, QNX, Haiku | Yes |
| Bouncy Castle | General Java API: J2ME, Java Runtime Environment 1.1+, Android. Java FIPS API: Java Runtime 1.5+, Android. C# API (General & FIPS): CLR 4. | |
| BSAFE Crypto-J | Solaris, Linux, Android, FreeBSD, AIX, 32 and 64-bit Windows, macOS (Darwin) | Yes |
| cryptlib | AMX, ARINC 653, BeOS, ChorusOS, CMSIS-RTOS/mbed-rtos, DOS, DOS32, eCOS, embOS, FreeRTOS/OpenRTOS, uItron, MQX, MVS, Nucleus, OS/2, Palm OS, QNX Neutrino, RTEMS, SMX, Tandem NonStop, Telit, ThreadX, uC/OS II, Unix (AIX, FreeBSD, HP-UX, Linux, macOS, Solaris, etc.), VDK, VM/CMS, VxWorks, Win16, Win32, Win64, WinCE/PocketPC/etc, XMK | Yes |
| Crypto++ | Unix (AIX, OpenBSD, Linux, MacOS, Solaris, etc.), Win32, Win64, Android, iOS, ARM | Yes[a] |
| GnuTLS | Runs on most Unix platforms and Windows[68] | ? |
| Intel Cryptography Primitives Library | Windows 10/11, Windows Server 2019/2022, Red Hat Enterprise Linux (RHEL) 8/9, SUSE Linux Enterprise Server (SLES) 15 SP4 / SP5 / SP6, Ubuntu 22.04 LTS / 24.04 LTS, Rocky Linux 9, Fedora 39 / 40, Debian 12 | Yes |
| Libgcrypt | All 32- and 64-bit Unix Systems (Linux, FreeBSD, NetBSD, macOS etc.), Win32, Win64, WinCE, and more | Yes[69] |
| libsodium | macOS, Linux, OpenBSD, NetBSD, FreeBSD, DragonflyBSD, Android, iOS, 32 and 64-bit Windows (Visual Studio, MinGW, C++ Builder), NativeClient, QNX, JavaScript, AIX, MINIX, Solaris | Yes |
| Mbed TLS | Win32/64, Unix Systems, embedded Linux, Micrium's μC/OS, FreeRTOS | ? |
| OpenSSL | Solaris, IRIX, HP-UX, MPE/iX, Tru64, Linux, Android, BSD (OpenBSD, NetBSD, FreeBSD, DragonflyBSD), NextSTEP, QNX, UnixWare, SCO, AIX, 32 and 64-bit Windows (Visual Studio, MinGW, UWIN, CygWin), UEFI, macOS (Darwin), iOS, HURD, VxWorks, uClinux, VMS, DJGPP (DOS), Haiku | Yes |
| wolfCrypt | Win32/64, Linux, macOS, Solaris, ThreadX, VxWorks, FreeBSD, NetBSD, OpenBSD, embedded Linux, Yocto Linux, OpenEmbedded, WinCE, Haiku, OpenWRT, iPhone (iOS), Android, Nintendo Wii and GameCube through DevKitPro, QNX, MontaVista, NonStop, TRON/ITRON/μITRON, Micrium's μC/OS, FreeRTOS, SafeRTOS, Freescale MQX, Nucleus, TinyOS, HP-UX, AIX, ARC MQX, TI-RTOS, uTasker, embOS, INtime, Mbed, uT-Kernel, RIOT, CMSIS-RTOS, FROSTED, Green Hills INTEGRITY, Keil RTX, TOPPERS, PetaLinux, Apache Mynewt, PikeOS, Deos, Azure Sphere OS, Zephyr | Yes |
- ^ Crypto++ is thread safe at the object level, i.e. there is no shared data among instances. If two different threads access the same object then the user is responsible for locking.
References
[edit]- ^ "Botan: Release Notes". Retrieved 2025-05-16.
- ^ "Download Bouncy Castle for Java - bouncycastle.org". 2025-08-04. Retrieved 2025-08-04.
- ^ "Download Bouncy Castle for Java LTS - bouncycastle.org". 2024-11-08. Retrieved 2024-11-29.
- ^ "Download Bouncy Castle for Java FIPS - bouncycastle.org". 2024-07-30. Retrieved 2024-11-29.
- ^ "Download Bouncy Castle for C# .NET - bouncycastle.org". 2025-08-04. Retrieved 2025-08-04.
- ^ "Download Bouncy Castle for C# .NET FIPS - bouncycastle.org". 2024-03-11. Retrieved 2024-11-29.
- ^ "Dell BSAFE Crypto-C Micro Edition 4.1.5 and Micro Edition Suite 4.6 Release Advisory".
- ^ "Dell BSAFE Micro Edition Suite 5.0.3 Release Advisory".
- ^ "Dell BSAFE Crypto-J 7.1 Release Advisory".
- ^ "Dell BSAFE Crypto-J 6.3.1 Release Advisory".
- ^ Gutmann, Peter (May 1, 2025). "cryptlib". Github. Retrieved 2025-08-02.
- ^ Daiki Ueno (9 July 2025). "gnutls 3.8.10". Retrieved 10 August 2025.
- ^ "Java Development Kit 25 Release Notes". Oracle Corporation. Retrieved 2025-06-09.
- ^ "Java™ SE Development Kit 21, 21.0.5 Release Notes". Oracle Corporation. Retrieved 2024-10-16.
- ^ "Java™ SE Development Kit 17, 17.0.13 Release Notes". Oracle Corporation. Retrieved 2024-10-16.
- ^ "Java™ SE Development Kit 11, 11.0.25 Release Notes". Oracle Corporation. Retrieved 2024-10-16.
- ^ "Java™ SE Development Kit 8, Update 431 Release Notes". Oracle Corporation. Retrieved 2024-10-16.
- ^ "LibreSSL 4.1.2 and 4.2.1 released". 31 October 2025. Retrieved 3 November 2025.
- ^ "Libgcrypt". gnupg.org. Retrieved 2025-08-18.
- ^ "Libgcrypt 1.8.11 released". dev.gnupg.org. 2023-11-16. Retrieved 2023-11-16.
- ^ "Mbed TLS releases". 2021-07-07. Retrieved 2021-10-14.
- ^ Downloading and installing NaCl, Bernstein, Lange, Schwabe, retrieved 2017-05-22
- ^ Niels Möller (26 June 2025). "ANNOUNCE: nettle-3.10.2". Retrieved 26 June 2025.
- ^ a b "NSS:Release versions". Mozilla Wiki. Retrieved 7 November 2022.
- ^ "OpenSSL 3.6.0". 1 October 2025. Retrieved 1 October 2025.
- ^ "wolfSSL ChangeLog". 2025-07-17. Retrieved 2025-07-17.
- ^ Computer Security Division, Information Technology Laboratory (2016-10-11). "Search - Cryptographic Module Validation Program | CSRC | CSRC". CSRC | NIST. Retrieved 2024-11-22.
- ^ Computer Security Division, Information Technology Laboratory (2016-10-11). "Modules In Process List - Cryptographic Module Validation Program | CSRC | CSRC". CSRC | NIST. Retrieved 2024-11-22.
- ^ "Cryptographic Module Validation Program CMVP". csrc.nist.gov. 11 October 2016.
- ^ "Cryptographic Module Validation Program". CSRC.nist.gov. Archived from the original on 2021-10-21.
- ^ "Certificate #4743". CSRC. 16 February 2025.
- ^ "Cryptographic Module Validation Program". CSRC.nist.gov. Archived from the original on 2021-09-24.
- ^ "Cryptographic Module Validation Program". CSRC.nist.gov. Archived from the original on 2021-10-23.
- ^ "Cryptographic Module Validation Program | CSRC".
- ^ "Search - Cryptographic Module Validation Program". CSRC. Retrieved 2022-05-29.
- ^ a b c "Implementation Under Test List - Cryptographic Module Validation Program". CSRC. 11 October 2016.
- ^ "Search - Cryptographic Module Validation Program". CSRC. 11 October 2016.
- ^ Computer Security Division, Information Technology Laboratory (October 11, 2016). "Search - Cryptographic Module Validation Program | CSRC | CSRC". CSRC | NIST.
- ^ "Cryptographic Module Validation Program". CSRC.nist.gov. Archived from the original on 2021-09-24.
- ^ "Cryptographic Module Validation Program". CSRC.nist.gov. Archived from the original on 2021-04-14.
- ^ "Cryptographic Module Validation Program". CSRC.nist.gov. Retrieved 12 September 2025.
- ^ Computer Security Division, Information Technology Laboratory (October 11, 2016). "Cryptographic Module Validation Program | CSRC | CSRC". CSRC | NIST.
- ^ "Cryptographic Module Validation Program | CSRC".
- ^ RFC 7091
- ^ RFC 8018
- ^ RFC 5831
- ^ RFC 6986
- ^ RFC 5830
- ^ RFC 8891
- ^ RFC 7801
- ^ Bouncy Castle Specifications, bouncycastle.org, retrieved 2018-04-10
- ^ cryptlib Encryption Toolkit, Peter Gutmann, retrieved 2015-11-28
- ^ With Scute, scute.org
- ^ a b With GnuPG's SCdaemon & gpg-agent, gnupg.org
- ^ a b With an libp11 engine
- ^ hwfeatures.c, dev.gnupg.org
- ^ "WolfSSL Asynchronous Intel QuickAssist Support - wolfSSL". 18 January 2017.
- ^ "WolfSSL ARMv8 Support - wolfSSL". 13 October 2016.
- ^ a b Language Analysis of Botan, OpenHub.net, retrieved 2018-07-18
- ^ a b Language Analysis of Bouncy Castle, OpenHub.net, retrieved 2015-12-23
- ^ a b Language Analysis of Crypto++, OpenHub.net, retrieved 2018-07-18
- ^ a b Language Analysis of GnuTLS, OpenHub.net, retrieved 2020-09-15
- ^ a b Language Analysis of Libgcrypt, OpenHub.net, retrieved 2015-12-23
- ^ a b Language Analysis of libsodium, OpenHub.net, retrieved 2017-05-07
- ^ a b Language Analysis of mbed-tls, OpenHub.net, retrieved 2019-09-15
- ^ a b Language Analysis of Nettle, OpenHub.net, retrieved 2015-12-23
- ^ a b Language Analysis of OpenSSL, OpenHub.net, retrieved 2017-05-07
- ^ GnuTLS - features, GnuTLS.org, retrieved 2022-09-15
- ^ GnuPG documentation: Libgcrypt overview - thread safety, GnuPG.org, retrieved 2016-04-16
Comparison of cryptography libraries
View on GrokipediaOverview and Libraries
Major Cryptography Libraries
Cryptography libraries provide essential implementations of cryptographic primitives and protocols, enabling secure communication, data protection, and authentication in software applications. These libraries vary in their design philosophies, supported languages, and adoption across industries, with open-source options dominating due to their transparency and community-driven development. Prominent libraries include those written in low-level languages like C and C++ for performance-critical applications, as well as higher-level bindings for languages such as Java and Python. OpenSSL, first released in 1998 as a fork of the SSLeay library, is one of the most widely used cryptography libraries, particularly for implementing TLS/SSL protocols in web servers and networking software. Maintained by the OpenSSL Software Foundation, it supports a broad range of algorithms and is integral to tools like Apache HTTP Server and Nginx. A significant historical milestone was the Heartbleed vulnerability discovered in 2014, which exposed memory in TLS connections and led to widespread security audits, funding increases, and architectural improvements in subsequent versions. In the C++ ecosystem, Crypto++ has been available since 1995, offering extensive implementations of symmetric and asymmetric algorithms, hash functions, and public-key infrastructure components; its last release (8.9) was in October 2023, with no post-quantum cryptography support as of November 2025, limiting its suitability for emerging standards despite prior use in embedded systems and high-performance applications. Developed by Wei Dai with community contributions, it emphasizes portability across platforms without external dependencies. Similarly, Botan, initiated in 2001, adopts a modular design that allows selective inclusion of cryptographic primitives, targeting use cases in secure messaging and file encryption; it is maintained by the Randombit organization and integrates well with C++ standards. For Java and .NET environments, Bouncy Castle, launched in 2000, provides comprehensive support for over 200 algorithms, including advanced features like PKCS#12 key stores and CMS signed data, catering to enterprise applications and mobile development. It is actively maintained by the Legion of the Bouncy Castle organization and serves as a reference implementation for Java's JCE provider. Other major libraries include wolfSSL (formerly CyaSSL), a lightweight C library with FIPS 140 validation, optimized for embedded systems and IoT with low resource usage; BoringSSL, Google's fork of OpenSSL focused on security hardening and reduced attack surface; mbedTLS (formerly PolarSSL), a portable C library for embedded and networked applications; and Google's Tink, a multi-language library emphasizing misuse-resistant high-level APIs for protocols like authenticated encryption. Modern libraries prioritize usability and security by design, such as libsodium, released in 2013 as a portable fork of the NaCl (Networking and Cryptography library). Focused on simple, high-level APIs to reduce common misuse, it supports authenticated encryption and is used in projects like WireGuard VPN and Signal messaging app; maintenance is handled by the libsodium team with contributions from the cryptography community. In Python, the cryptography library (cryptography.io), introduced in 2013, offers bindings to OpenSSL and native implementations for primitives like AES and RSA, emphasizing secure defaults for web frameworks such as Django and Flask.Comparison Methodology
The comparison of cryptography libraries utilizes standardized tables to evaluate key attributes, with support for algorithms denoted as "yes" for complete, production-ready implementations, "partial" for experimental or restricted features, and "no" for lack of support, as determined from each library's official release notes and API documentation. Performance metrics are selectively incorporated, such as throughput rates in megabytes per second (MB/s) for operations like AES-256-GCM encryption on common hardware (e.g., x86-64 processors), to highlight scalability without overwhelming detail; these are normalized to avoid hardware-specific biases. For instance, a representative support table might appear as follows:| Library | AES-256 Support | ECC (P-256) Support | Post-Quantum KEM Support |
|---|---|---|---|
| OpenSSL | Yes | Yes | Yes |
| libsodium | Yes | No | No |
| Botan | Yes | Yes | Yes |
Standards Compliance
FIPS 140 Validation
FIPS 140 is a U.S. federal standard that defines security requirements for cryptographic modules used to protect sensitive information, administered by the National Institute of Standards and Technology (NIST) through the Cryptographic Module Validation Program (CMVP).[6] The standard specifies four increasing levels of security, each building on the previous to address a range of applications and environments. FIPS 140-2, published in 2002, was the prior version, but it has been superseded by FIPS 140-3, published on March 22, 2019, with an effective date of September 22, 2019, and testing commencing on September 22, 2020; new validations are now under FIPS 140-3, while legacy FIPS 140-2 certificates remain active until their sunset dates.[8] The security levels under FIPS 140-3 are as follows:| Level | Description |
|---|---|
| 1 | Basic security requirements are specified for a cryptographic module. No specific physical security mechanisms are required beyond the basic requirement for production-grade equipment. No specific requirements for tamper evidence or resistance to physical attack.[8] |
| 2 | Requires, in addition to the Level 1 requirements, role-based authentication and physical security mechanisms that provide a basic level of tamper evidence and resistance to simple unauthorized physical access.[8] |
| 3 | Requires, in addition to the Level 2 requirements, identity-based authentication mechanisms, physical security mechanisms that provide a high probability of detecting and responding to attempts at physical access, use or modification of the cryptographic module, and additional requirements for the entry and output of sensitive data.[8] |
| 4 | Provides the highest level of security defined in this standard. Requires, in addition to the Level 3 requirements, physical security mechanisms that have a very high probability of detecting and responding to unauthorized attempts at physical access, use, or modification of the cryptographic module. The physical security mechanisms must protect against environmental conditions or fluctuations outside of the normal operating ranges for the module.[8] |
Common Criteria and Other Certifications
The Common Criteria (CC) is an international standard (ISO/IEC 15408) for evaluating the security of IT products and systems, providing a framework for assurance through seven Evaluation Assurance Levels (EAL1 to EAL7), where higher levels involve more rigorous testing, design analysis, and vulnerability assessment to ensure protection against implementation flaws and intentional attacks. EAL1 offers basic functional testing, while EAL4+—a common target for cryptographic modules—includes semi-formal design verification and methodical testing of operational security, making it suitable for high-assurance environments in Europe and Asia. Unlike the U.S.-focused FIPS 140 validation, CC emphasizes global mutual recognition up to EAL4 and provides higher levels for specialized needs, influencing library selection for regulated deployments like government or financial systems. These certifications highlight how CC evaluations verify not only algorithmic correctness but also secure coding practices, reducing risks from buffer overflows or timing leaks prevalent in crypto software. Other certifications complement CC for specific domains. For payment systems, PCI DSS requires strong cryptography per its v4.0.1 standard (mandatory since March 31, 2025), where libraries like those supporting AES-256 and SHA-256 enable compliance by facilitating encrypted cardholder data transmission, though libraries themselves are not directly certified—instead, systems using them undergo assessment.[13] ISO 27001, an information security management standard, mandates rules for cryptography use (Annex A.8.24), and libraries such as Botan or Crypto++ support this by providing auditable implementations for key management and hashing, aiding organizational certification without library-specific seals.[14] Libsodium, emphasizing simplicity and misuse resistance, relies on independent security audits rather than formal certifications like CC, confirming no critical vulnerabilities in its core primitives.[15] Certification impacts include enhanced trust against flaws. By 2025, CC evaluations increasingly incorporate post-quantum cryptography (PQC), with NIAP developing Protection Profiles for PQC algorithms like Kyber and Dilithium to ensure libraries support quantum-resistant keys without weakening classical security.[16] This evolution addresses "harvest now, decrypt later" threats, prioritizing libraries with PQC roadmaps for future-proof compliance.[17]Asymmetric Cryptography Support
Public Key Algorithms
Public key algorithms form the foundation of asymmetric cryptography in modern libraries, enabling secure key exchange, encryption, and digital signatures without prior shared secrets. Major libraries vary in their implementation of classical algorithms like RSA, DSA, and Diffie-Hellman (DH), with support influenced by security standards, performance considerations, and deprecation trends toward quantum-resistant alternatives. Comprehensive libraries such as OpenSSL and Bouncy Castle provide full implementations, including key generation and padding schemes, while more minimalist ones like libsodium prioritize modern elliptic-curve variants for key exchange.[18] RSA, introduced in 1977, remains a widely supported public key algorithm for encryption and signing, relying on the difficulty of factoring large primes. Key generation involves selecting two large primes and computing the modulus, with recommended sizes of 2048 to 4096 bits to achieve at least 112 bits of security through 2030, per NIST guidelines. OpenSSL offers complete RSA support, including probabilistic key generation viaRSA_generate_key_ex and integration with padding like OAEP for encryption and PSS for signing. Bouncy Castle provides extensive RSA functionality in Java, supporting OAEP and PSS schemes through classes like RSAEngine and RSASSAPSS, enabling hybrid use in protocols such as TLS for key transport. In contrast, libsodium does not support RSA, focusing instead on Curve25519-based primitives to avoid the computational overhead of large-integer arithmetic.[19]
DSA, a discrete logarithm-based signature algorithm standardized in FIPS 186, is now considered legacy. FIPS 186-5 (2023) removed DSA as an approved algorithm for new digital signature generation and key generation, allowing only verification of existing signatures. Earlier guidance (SP 800-131A Rev. 1) disallowed generation of DSA keys smaller than 2048 bits after 2013, and SP 800-131A Rev. 2 approves generation only for large keys (2048 or 3072 bits) but recommends migration to elliptic-curve alternatives due to inefficiency and vulnerabilities. OpenSSL retains DSA support for backward compatibility, including key generation with DSA_generate_parameters and signing via DSA_sign, though it warns of its obsolescence. Bouncy Castle similarly implements DSA through DSA classes, but documentation emphasizes migration away from it. Libsodium omits DSA entirely, aligning with its modern-crypto ethos.[20][19]
Diffie-Hellman enables secure key exchange by allowing parties to compute a shared secret over an insecure channel, based on the discrete logarithm problem. Classical DH uses prime moduli of at least 2048 bits for security, while its elliptic-curve variant (ECDH) offers efficiency with smaller keys; libraries often bundle them for hybrid TLS handshakes. Key generation for DH traditionally uses probabilistic methods reliant on random number generators to select private exponents. OpenSSL provides robust DH support, including parameter generation with DH_generate_parameters and ephemeral key exchange via DH_compute_key, essential for TLS 1.3. Bouncy Castle supports DH through DHKeyGenerator and integrates it with protocols, including finite-field and elliptic-curve modes. Libsodium limits support to ECDH via X25519 (crypto_scalarmult), eschewing classical DH for its higher computational cost and quantum vulnerability. For signature algorithms like DSA and ECDSA used in related protocols, deterministic nonce generation per RFC 6979—deriving nonces from the private key and message—enhances security against faulty randomness; OpenSSL and Bouncy Castle implement this for compatible signatures, reducing risks in TLS deployments.[21]
| Library | RSA Support (Key Gen, Encrypt/Sign, Padding) | DSA Support (Legacy) | DH/ECDH Support (Key Exchange) |
|---|---|---|---|
| OpenSSL | Full (2048-4096 bits, OAEP/PSS) | Yes (up to 3072 bits, verification only post-2023) | Full DH + ECDH |
| Libsodium | None | None | ECDH (X25519 only) |
| Bouncy Castle | Full (OAEP/PSS schemes) | Yes (verification only post-2023) | DH + ECDH |
| wolfSSL | Full (2048-4096 bits, OAEP/PSS) | Yes (legacy, verification) | Full DH + ECDH |
| BoringSSL | Full (2048-4096 bits, OAEP/PSS) | Yes (legacy, verification) | Full DH + ECDH |
| ring (Rust) | Full (no gen, encrypt/sign, OAEP/PSS) | None | ECDH (various curves) |
| Go crypto | Full (2048+ bits, OAEP/PSS) | Deprecated (verification) | DH + ECDH |
Elliptic-Curve Cryptography (ECC)
Elliptic-curve cryptography (ECC) provides asymmetric cryptographic primitives that leverage the algebraic structure of elliptic curves over finite fields to achieve high security with reduced computational overhead compared to traditional systems like RSA. In cryptography libraries, ECC is primarily implemented through algorithms such as the Elliptic Curve Digital Signature Algorithm (ECDSA) for digital signatures and Elliptic Curve Diffie-Hellman (ECDH) for key exchange, enabling secure authentication and session key derivation. These implementations support standardized curves that balance security, performance, and interoperability, with libraries varying in their curve selections to address specific use cases like general-purpose security or blockchain applications. FIPS 186-5 (2023) also approves EdDSA variants like Ed25519 for signatures, supported in libraries such as libsodium and OpenSSL.[22][20] A key advantage of ECC is its ability to deliver equivalent security levels with significantly smaller key sizes; for instance, a 256-bit ECC key offers approximately the same strength as a 3072-bit RSA key, both providing around 128 bits of security against known attacks. This results in 2-5 times faster operations in benchmarks across libraries, particularly for key generation and signature verification on resource-constrained devices, due to fewer arithmetic operations required in elliptic curve point multiplications. Libraries like libsodium default to Curve25519 for ECDH and related primitives, prioritizing its high speed and resistance to certain implementation pitfalls, while supporting conversions to Ed25519 for signatures.[23][24][25] Major libraries exhibit distinct ECC implementations tailored to standards and performance needs. OpenSSL supports NIST curves such as P-256 and P-384 for ECDSA and ECDH, along with Brainpool curves for enhanced security in European standards-compliant environments, ensuring broad compatibility in protocols like TLS. Bouncy Castle extends this with secp256k1, a Koblitz curve optimized for Bitcoin's ECDSA signatures, facilitating integration in blockchain and cryptocurrency applications. To mitigate side-channel attacks, such as timing or power analysis, these libraries incorporate constant-time arithmetic in their ECC routines, avoiding data-dependent branches during scalar multiplications and point additions. As of 2025, libraries are increasingly adopting hybrid approaches that combine ECC with post-quantum algorithms to future-proof key exchanges. Botan, for example, integrates its optimized ECC library with FIPS 203 ML-KEM support, enabling hybrid ECDH-ML-KEM key exchanges in TLS 1.3 for immediate classical security alongside quantum resistance. As of 2025, OpenSSL integrates post-quantum providers for hybrid key exchanges combining ECC with ML-KEM (FIPS 203). This shift reflects broader industry trends toward migrating ECC-based systems without disrupting existing deployments.[26][27]Symmetric Cryptography Support
Block Cipher Algorithms
Block cipher algorithms form a core component of symmetric cryptography in libraries, enabling the encryption of fixed-size data blocks typically using 128-bit blocks. The Advanced Encryption Standard (AES), standardized by NIST in FIPS 197, is the most widely supported block cipher, based on the Rijndael algorithm selected in 2001 and available in key lengths of 128, 192, and 256 bits.[28] All major libraries provide comprehensive AES support, including authenticated modes like AES-GCM for combined encryption and integrity protection. For instance, OpenSSL leverages Intel AES-NI hardware instructions for accelerated performance on compatible processors. Legacy block ciphers such as DES and Triple DES (3DES) are included in most libraries for backward compatibility but are deprecated due to vulnerabilities and insufficient security margins; NIST withdrew recommendations for 3DES in SP 800-67 Revision 2 effective January 2024.[29] DES operates on 64-bit blocks with a 56-bit effective key, while 3DES applies DES thrice for enhanced strength, yet both are unsuitable for modern use. Additional algorithms like Camellia, a 128-bit block cipher with 128-, 192-, and 256-bit keys developed by NTT and Mitsubishi Electric and standardized in ISO/IEC 18033-3, are supported in several libraries including OpenSSL, Bouncy Castle, and Crypto++.[30] Twofish, a 128-bit block cipher with up to 256-bit keys from the AES competition finalists designed by Bruce Schneier et al., is available in Bouncy Castle, Crypto++, and Botan.[31] Crypto++ extends support to ARIA, another 128-bit block cipher standardized by the Korean government.[32]| Library | AES (128/192/256) | DES/3DES | Camellia | Twofish | ARIA | Optimizations |
|---|---|---|---|---|---|---|
| OpenSSL | Yes | Yes | Yes | No | No | AES-NI |
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes | None specified |
| Crypto++ | Yes | Yes | Yes | Yes | Yes | Portable implementations |
| libsodium | AES-256 only | No | No | No | No | None specified |
| Botan | Yes | Yes | Yes | Yes | Yes | AES-NI |
| wolfSSL | Yes | Yes | Yes | No | Yes | None specified |
| Mbed TLS | Yes | Yes | No | No | Yes | AES-NI |
Stream Cipher Algorithms
Stream ciphers generate a continuous keystream that is combined with plaintext via XOR, making them ideal for real-time applications such as network packets where data arrives in variable lengths.[35] Unlike block ciphers, which process fixed-size blocks and require padding for incomplete data, stream ciphers eliminate the need for padding, reducing overhead and simplifying implementation for streaming or packet-based encryption.[36] Major cryptography libraries prioritize modern stream ciphers with 256-bit keys for enhanced security, focusing on algorithms resistant to known attacks while deprecating legacy options. Prominent stream cipher algorithms include ChaCha20-Poly1305, Salsa20, and the deprecated RC4. ChaCha20-Poly1305, an authenticated encryption with associated data (AEAD) construction combining the ChaCha20 stream cipher and Poly1305 message authentication code, emerged as a Google and Cloudflare standard in 2014 for TLS implementations, offering high performance on software platforms without hardware acceleration.[37] Salsa20, designed by Daniel J. Bernstein in 2005 as a high-speed stream cipher, serves as the predecessor to ChaCha20 and supports 256-bit keys with configurable rounds (typically 20 for security).[38] RC4, once widely used for its simplicity, has been deprecated across libraries due to exploitable biases in its keystream output, which enable statistical attacks recovering plaintext with sufficient data.[39] Library support varies, with modern implementations favoring ChaCha20-Poly1305 for its balance of speed and security. Libsodium, a portable fork of the NaCl library, exclusively recommends ChaCha20 for AEAD operations like crypto_aead_chacha20poly1305, though it retains Salsa20 for legacy compatibility; NaCl originally used XSalsa20-Poly1305 but transitioned emphasis to ChaCha variants.[40] OpenSSL introduced ChaCha20-Poly1305 support in version 1.1.0 released in 2016, enabling its use in TLS 1.3 cipher suites, but does not include Salsa20.[41] Bouncy Castle provides comprehensive support for the full suite, including ChaCha20Engine, Salsa20Engine, and legacy RC4 implementations via its StreamCipher interface, allowing Java developers to select based on application needs.[42]| Library | ChaCha20-Poly1305 | Salsa20 | RC4 (Deprecated) |
|---|---|---|---|
| Libsodium/NaCl | Yes (Primary AEAD) | Yes (Legacy) | No |
| OpenSSL | Yes (Since 1.1.0) | No | Yes (Disabled by default) |
| Bouncy Castle | Yes | Yes | Yes |
Cipher Operation Modes and Primitives
Block Cipher Modes
Block cipher modes of operation extend the use of underlying block ciphers, such as AES, to process data larger than a single block while providing confidentiality; some modes also incorporate authentication to ensure integrity.[48] These modes address limitations of raw block encryption, such as handling variable-length messages and mitigating patterns in repeated plaintext blocks, though choices impact security, performance, and parallelism.[48] Common unauthenticated modes include Electronic Codebook (ECB), which encrypts each block independently but is insecure as identical plaintext blocks produce identical ciphertext, revealing patterns.[48] Cipher Block Chaining (CBC) chains blocks by XORing each plaintext block with the previous ciphertext before encryption, requiring a random initialization vector (IV) for security and padding for non-block-aligned data.[48] Counter (CTR) mode generates a keystream by encrypting a counter, enabling stream-like operation and parallel processing, provided the counter (nonce) is unique per key to avoid keystream reuse.[48] Authenticated Encryption with Associated Data (AEAD) modes combine confidentiality and integrity in a single primitive. Galois/Counter Mode (GCM) uses CTR for encryption and a polynomial-based authenticator over a Galois field for integrity, supporting associated data and allowing parallel computation.[49] Counter with CBC-MAC (CCM) pairs CTR encryption with a CBC-based MAC, offering similar AEAD capabilities but typically requiring two passes, which can limit parallelism compared to GCM.[50] Both modes are sensitive to nonce or IV reuse, which can lead to plaintext recovery or key exposure if not managed properly.[49] These modes are standardized in the NIST SP 800-38 series, with SP 800-38A covering ECB, CBC, CFB, OFB, and CTR; SP 800-38D specifying GCM; and SP 800-38C defining CCM.[48][49][50] GCM is particularly prominent, as TLS 1.3 mandates support for the TLS_AES_128_GCM_SHA256 cipher suite in all compliant implementations, with TLS_AES_256_GCM_SHA384 strongly recommended.[51] AEAD modes like GCM offer efficiency by providing both confidentiality and authentication in one pass, reducing computational overhead compared to separate encryption and MAC operations, though they require careful nonce management to prevent catastrophic failures from reuse.[49]| Library | ECB | CBC | CTR | GCM (AEAD) | CCM (AEAD) | Notes |
|---|---|---|---|---|---|---|
| OpenSSL | Yes | Yes | Yes | Yes (hardware acceleration via AES-NI) | Yes | Comprehensive low-level support; GCM leverages CPU instructions for performance.[52] |
| libsodium | No | No | No | Yes (AES-256-GCM) | No | High-level API focused on secure AEAD; avoids unauthenticated modes to prevent misuse; emphasizes unique nonces.[53] |
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes | Full support across Java/C# APIs for all modes.[18] |
| Crypto++ | Yes | Yes | Yes | Yes | Yes | Extensive C++ implementation of standard modes.[54] |
| Botan | Yes | Yes | Yes | Yes | Yes | Supports unauthenticated and AEAD modes with configurable padding and tag sizes.[55] |
Message Authentication Codes (MACs)
Message authentication codes (MACs) ensure the integrity and authenticity of data by producing a tag from a message and a secret key, allowing verification that the message has not been altered and originates from a trusted source. In cryptography libraries, MAC support focuses on secure, efficient implementations of algorithms that resist forgery attacks, with key sizes typically matching the underlying primitive's security level—such as 256 bits for AES-CMAC or at least 32 bytes for HMAC-SHA256. These mechanisms are essential for protocols requiring data origin authentication without encryption, though they are often integrated into authenticated encryption modes for broader use.[56] Hash-based MACs like HMAC, defined in RFC 2104 and standardized by NIST in FIPS 198, combine a cryptographic hash function (e.g., SHA-2 or SHA-3) with a secret key to generate a tag resistant to known hash weaknesses when properly implemented.[57][56] Cipher-based alternatives include CMAC, specified in NIST SP 800-38B, which uses a block cipher like AES in a mode that provides authenticity for binary data, supporting key sizes of 128, 192, or 256 bits to align with AES security levels.[58] Poly1305, a polynomial-based authenticator frequently paired with the ChaCha20 stream cipher as outlined in RFC 7539, employs a 32-byte key to produce a 16-byte tag, offering high-speed authentication suitable for resource-constrained environments.[59] Major cryptography libraries provide broad support for these MAC algorithms through dedicated APIs, enabling developers to compute and verify tags efficiently. OpenSSL implements HMAC, CMAC, and Poly1305 via its EVP interface, with HMAC and CMAC available in both default and FIPS providers.[60] Bouncy Castle offers comprehensive coverage, including HMAC with various hashes, AES-CMAC, Poly1305, and even GMAC for Galois/Counter Mode authentication, making it versatile for Java-based applications.[61] Libsodium supports HMAC variants like HMAC-SHA-256 and HMAC-SHA-512, along with Poly1305 for one-time authentication, but lacks native CMAC.[62] The Python cryptography library similarly includes HMAC (via hash primitives), CMAC for block ciphers, and Poly1305, facilitating secure MAC operations in scripts. Performance varies by algorithm and hardware, but HMAC-SHA256 typically achieves throughput of 1-2 GB/s on modern x86 CPUs, benefiting from optimized hash instructions like Intel SHA extensions, while Poly1305 can exceed this in software due to its simplicity.[63] For security, libraries emphasize resistance to length-extension attacks inherent in Merkle-Damgård hashes; HMAC with SHA-2 or SHA-3 is recommended, as MD5 and SHA-1 bases are deprecated post-2025 due to collision vulnerabilities and NIST's phase-out mandate by 2030.[7][64]| Library | HMAC (SHA-2/SHA-3) | CMAC (AES-based) | Poly1305 (with ChaCha20) |
|---|---|---|---|
| OpenSSL | Yes | Yes | Yes |
| Bouncy Castle | Yes | Yes | Yes |
| libsodium | Yes (SHA-256/512) | No | Yes |
| Python cryptography | Yes | Yes | Yes |
Hashing and Key Management
Hash Functions
Cryptographic hash functions are essential primitives in libraries for ensuring data integrity, providing collision resistance, and serving as building blocks for other constructs like message authentication codes. Major libraries support NIST-approved algorithms such as SHA-2 variants (SHA-256, SHA-384, SHA-512) with output sizes of 256, 384, and 512 bits respectively, offering strong preimage and collision resistance based on the Merkle-Damgård construction. SHA-3, standardized in FIPS 202 since 2015 and based on the Keccak sponge construction, provides similar output sizes (e.g., 256 bits for SHA3-256) and is noted for its resistance to length-extension attacks, with claims of enhanced security margins against quantum attacks due to its design. BLAKE2, specified in RFC 7693, serves as a faster alternative to SHA-2 and SHA-3, supporting variable output lengths up to 512 bits for BLAKE2b and maintaining equivalent security levels while being optimized for software performance on 64-bit platforms. BLAKE3, a parallelizable successor to BLAKE2, offers even higher performance for multi-core systems and is increasingly supported in modern libraries as of 2025.[65] Legacy algorithms like SHA-1 and MD5 are included in many libraries for compatibility but are considered broken due to practical collision attacks; NIST has deprecated SHA-1 for all uses, mandating phase-out by December 31, 2030, in favor of SHA-2 and SHA-3 as primary standards post-2025.[7] Incremental hashing for streaming data is widely supported across libraries, allowing efficient processing of large inputs without loading entire datasets into memory. For instance, OpenSSL has provided SHA-3 support since version 1.1.1 and BLAKE2 since 1.1.0, enabling developers to compute digests via the EVP interface for both one-shot and multi-part operations.| Library | SHA-2 Support (256/384/512) | SHA-3 Support (since version) | BLAKE2 Support | BLAKE3 Support | Incremental Hashing | Notes |
|---|---|---|---|---|---|---|
| OpenSSL | Yes | Yes (1.1.1) | Yes (BLAKE2b/s, 1.1.0) | No | Yes | Comprehensive EVP_MD API; legacy SHA-1/MD5 included but deprecated. |
| libsodium | Yes (SHA-256/512) | No | Yes (BLAKE2b primary) | No | Yes | Focuses on BLAKE2b via crypto_generichash for high performance; avoids legacy algorithms.[66] |
| Bouncy Castle | Yes | Yes | Yes (BLAKE2b/s) | Yes | Yes | Full FIPS 202 compliance for SHA-3 variants including SHAKE; supports Blake3. |
| mbed TLS | Yes | Yes (3.0+) | No | No | Yes | SHA-3 added for embedded use; prioritizes SHA-2 for efficiency. |
| Crypto++ | Yes | Yes | Yes | Yes | Yes | Extensive support including parallel processing optimizations. |
| Python cryptography | Yes | Yes | Yes (BLAKE2b/s) | Yes (via hashlib) | Yes | Hazmat primitives for secure, high-level use; integrates with hashlib.[67] |
| Nettle | Yes | Yes (3.1.1) | No | No | Yes | Low-level API with SHAKE XOF; used in GnuTLS.[68] |
Key Derivation and Agreement Protocols
Key derivation functions (KDFs) and key agreement protocols are essential components in cryptography libraries, enabling the secure generation of cryptographic keys from passwords, shared secrets, or other inputs while resisting brute-force and side-channel attacks. KDFs transform low-entropy inputs, such as passwords, into uniform, high-entropy keys suitable for encryption or authentication, often incorporating salting and computational hardness to deter exhaustive searches. Key agreement protocols, like Diffie-Hellman, allow parties to establish shared secrets over insecure channels, frequently combined with KDFs for key material expansion in protocols such as TLS. Libraries vary in their support for these primitives, prioritizing standards like those from the IETF and Password Hashing Competition (PHC), with modern implementations favoring memory-hard functions to counter GPU-accelerated attacks. Prominent KDFs include PBKDF2, defined in RFC 2898, which applies a pseudorandom function (typically HMAC-based) iteratively to a password and salt, with a minimum of 1000 iterations recommended to impose computational slowness and resist brute-force attempts. HKDF, specified in RFC 5869, follows an extract-then-expand paradigm: it first extracts a pseudorandom key from input keying material using HMAC-Hash(salt, input), then expands it to the desired output length via counter-based HMAC invocations, making it ideal for deriving keys from high-entropy sources like Diffie-Hellman outputs. Argon2, the winner of the 2015 PHC and standardized in RFC 9106, is a memory-hard function designed to prevent time-memory trade-offs, configurable via time cost (t, e.g., 1-3 for balance), memory cost (m, e.g., 64 MiB to 2 GiB), and parallelism (p); its Argon2id variant combines data-dependent and independent modes for resistance to both GPU and side-channel attacks. Scrypt, another memory-hard KDF, complements these by requiring significant RAM during computation to hinder parallelization on specialized hardware. Key agreement protocols supported across libraries often center on Diffie-Hellman (DH), which enables two parties to compute a shared secret from public parameters without direct exchange, providing forward secrecy when ephemeral keys are used. In TLS 1.3 (RFC 8446), DH (or ECDH) shared secrets are processed through HKDF for key derivation, ensuring secure session keys. Examples include libsodium'scrypto_scalarmult_curve25519, which implements X25519-based DH for efficient, constant-time agreement, and OpenSSL's EVP_PKEY interface for finite-field or elliptic-curve DH. These protocols build on hash functions as underlying primitives for pseudorandomness, extending their utility in key management.
Security for these mechanisms emphasizes brute-force resistance, particularly for password-based KDFs; Argon2's tunable parameters allow costs to scale with hardware threats, with 2025 OWASP guidelines recommending Argon2id as the primary choice for new systems due to its robustness against parallel attacks, over legacy options like PBKDF2. Salts must be randomly generated and at least 8 octets long to prevent precomputation, a practice universally enforced in reputable libraries to avoid weak implementations.
| Library | PBKDF2 | HKDF | Argon2 | Scrypt | Key Agreement (e.g., DH) |
|---|---|---|---|---|---|
| OpenSSL | Yes | Yes | Yes (3.2+) | Yes | Yes (EVP_PKEY) |
| libsodium | No | Yes | Yes (Argon2id) | Yes | Yes (X25519) |
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes |
| Crypto++ | Yes | Yes | No | Yes | Yes |
Argon2BytesGenerator and scrypt support integrate these KDFs seamlessly in Java environments, while OpenSSL's EVP_KDF API unifies PBKDF2, HKDF, scrypt, and Argon2 under a high-level interface; libsodium's crypto_pwhash defaults to Argon2id for password-derived keys. These libraries ensure constant-time operations where possible to mitigate timing attacks, aligning with 2025 best practices for post-password hashing.
Advanced and Emerging Features
Post-Quantum Cryptography Support
Post-quantum cryptography (PQC) addresses vulnerabilities in classical asymmetric algorithms like RSA and ECC, which are susceptible to Shor's algorithm on quantum computers. Libraries are integrating PQC to support quantum-resistant key encapsulation mechanisms (KEMs) and digital signatures, primarily lattice-based schemes selected by NIST. The National Institute of Standards and Technology (NIST) finalized standards for ML-KEM (based on CRYSTALS-Kyber) in FIPS 203, ML-DSA (CRYSTALS-Dilithium) in FIPS 204, and SLH-DSA (SPHINCS+) in FIPS 205 in August 2024, with FN-DSA (FALCON) draft FIPS 206 released in August 2025, pending finalization as of November 2025.[71][72] Major cryptography libraries vary in their readiness for these algorithms, with support focusing on Kyber/ML-KEM for key exchange and Dilithium/ML-DSA or Falcon for signatures. Bouncy Castle has offered comprehensive PQC implementations since version 1.79 in October 2024, including all four NIST-selected algorithms and hybrid modes combining PQC with classical ECC (e.g., X25519 + Kyber).[73][74] OpenSSL provides experimental access via the Open Quantum Safe (OQS) provider since 2022, with native integration for the finalized ML-KEM, ML-DSA, and SLH-DSA in version 3.5.0 released in April 2025, enabling hybrid TLS 1.3 key exchanges; support for draft FN-DSA (Falcon) is available via providers.[73][75] Botan supports ML-KEM, ML-DSA, and SLH-DSA since version 3.x in late 2023, with hybrid post-quantum key exchange in TLS 1.3 using ML-KEM or FrodoKEM, though Falcon remains planned as of November 2025.[73][76] In contrast, libsodium lacks production PQC support as of November 2025 but includes prototypes for ML-KEM on its roadmap, without timelines for full integration.[73] Crypto++ shows no merged PQC support as of November 2025, relying on external forks.[73]| Library | ML-KEM (Kyber) | ML-DSA (Dilithium) | FN-DSA (Falcon) | SLH-DSA (SPHINCS+) | Hybrid Modes | Key Version/Date |
|---|---|---|---|---|---|---|
| Bouncy Castle | Yes | Yes | Yes | Yes | Yes | 1.79 (October 2024) |
| OpenSSL | Yes | Yes | Via provider | Yes | Yes | 3.5.0 (April 2025) |
| Botan | Yes | Yes | Planned | Yes | Yes | 3.x (late 2023) |
| libsodium | Prototype | No | No | No | No | Roadmap (November 2025) |
| Crypto++ | No | No | No | No | No | None (November 2025) |
Side-Channel Attack Resistance
Side-channel attacks, such as timing, power analysis, and fault injection, exploit physical implementations of cryptographic algorithms rather than mathematical weaknesses, making resistance a critical aspect of library design. Cryptography libraries mitigate these by incorporating techniques like constant-time operations, which ensure execution time is independent of secret data, thereby preventing timing leaks; masking, which randomizes intermediate values to obscure power consumption patterns; and blinding, which introduces randomness into computations to thwart differential power analysis (DPA). These countermeasures are essential, as even secure algorithms can be broken if implementations leak information through side channels, with seminal work by Kocher et al. demonstrating DPA's effectiveness against unmasked designs in 1999. Among popular libraries, libsodium stands out for its design philosophy of providing all operations in constant time by default, eliminating conditional branches that could leak timing information across algorithms like AES, elliptic curve operations, and hash functions. This approach, rooted in the NaCl library's principles, has been verified through formal methods and security audits, confirming resistance to basic timing and cache-based side channels without requiring user configuration. Similarly, Botan implements comprehensive constant-time primitives, including a bitsliced AES that avoids data-dependent branches and uses hardware instructions where available, while employing masking for Karatsuba multiplications and blinding for RSA (with 64-bit masks refreshed every 64 operations) to resist first-order DPA. For elliptic curve cryptography (ECC), Botan uses constant-time scalar multiplication via methods like the Montgomery ladder, which performs a fixed sequence of additions and doublings independent of the scalar bits.[78][79] OpenSSL has evolved to include constant-time implementations, such as its no-branching AES-CTR mode introduced to counter timing attacks, and post-Spectre/Meltdown mitigations like cache-line aware memory access to reduce speculative execution leaks. However, it has faced ongoing challenges, with 2025 disclosures revealing timing side-channels in the SM2 implementation on 64-bit ARM (CVE-2025-9231), allowing potential private key recovery, underscoring the need for continuous patching despite claims of timing resistance in core primitives. Crypto++, in contrast, offers configurable countermeasures, enabling developers to select constant-time modes for operations like modular exponentiation and ECC, though it relies more on user enablement for advanced masking or blinding, with audits confirming basic DPA order-1 resistance in default setups. Comparative assessments highlight that only a subset of libraries, including libsodium and Botan, routinely perform post-compilation timing tests to validate resistance, with techniques like constant-time programming being manually implemented and error-prone across the board. For DPA metrics, many libraries achieve order-1 resistance—requiring thousands of traces for key recovery—but higher-order attacks (order-2) remain feasible without masking, as demonstrated in evaluations of unmasked ECC implementations. Project Wycheproof, initiated by Google in 2016 and updated through 2025, includes test vectors for detecting implementation flaws that enable side channels, such as branch-dependent timing in DSA variants, aiding libraries like OpenSSL and Crypto++ in verification. While post-quantum algorithms introduce new side-channel risks due to larger key sizes amplifying leaks, classical protections like these remain foundational.[80]| Library | Key Techniques | Resistance Level (Example) | Audits/Notes |
|---|---|---|---|
| libsodium | Constant-time by design | Order-1 DPA; timing-resistant | Formal verification; post-compilation tests[81] |
| Botan | Constant-time, masking, blinding | Order-1 DPA for AES/ECC; blinding for RSA | Timing tests with MARVIN; side-channel handbook[79] |
| OpenSSL | No-branching ops, cache mitigations | Order-1 for AES; vulns in SM2 (2025) | Patches for Spectre; Wycheproof integration |
| Crypto++ | Configurable constant-time | Order-1 configurable; basic masking | User-enabled; audit-confirmed defaults |
Hardware and Platform Integration
Hardware Security Module (HSM) and Smart Card Support
Hardware Security Modules (HSMs) and smart cards provide tamper-resistant environments for key storage and cryptographic operations, integrating with cryptography libraries primarily through standardized protocols to ensure keys remain protected without exposure to the host system.[82] The PKCS#11 interface serves as the dominant standard for this integration, defining a platform-independent API for accessing HSMs and smart cards to perform operations like encryption, signing, and key generation.[83] For smart cards, protocols such as Personal Identity Verification (PIV) enable secure authentication and key management, often layered atop PKCS#11, while the SIM Toolkit supports mobile-specific cryptographic interactions on SIM cards, though adoption in general-purpose libraries remains limited.[84][85] Among major libraries, OpenSSL offers robust HSM support through its engine architecture, allowing dynamic loading of PKCS#11 providers for devices like Thales nShield, where operations such as AES encryption can be offloaded without exporting keys.[86] This enables seamless integration for enterprise applications, such as secure key storage in payment processing or certificate authorities, where the HSM handles symmetric operations like AES-GCM for data encryption.[87] Bouncy Castle supports HSM and smart card integration indirectly via PKCS#11-compatible providers and its BCFKS keystore format, which facilitates FIPS-compliant key storage and can interface with PIV-enabled cards for Java-based systems.[88] For instance, Bouncy Castle's provider allows offloading RSA signing to smart cards in identity management use cases, maintaining key confidentiality.[89] In contrast, libraries like Crypto++ and libsodium lack native PKCS#11 support, relying on external wrappers for HSM access, which limits their direct use in hardware-secured environments. PyCA/cryptography similarly requires third-party PKCS#11 bindings, such as python-pkcs11, to enable HSM operations, making it suitable for Python ecosystems but adding integration overhead.[90] These integrations are critical for enterprise scenarios, including compliance-driven key offload where AES operations via PKCS#11 prevent key exposure during bulk encryption tasks.[91] Despite these capabilities, HSM integrations face limitations, including vendor lock-in due to proprietary extensions in PKCS#11 implementations, which can complicate migrations between devices from different manufacturers.[92] As of 2025, FIPS 140-3 compliant HSMs from vendors like Entrust nShield, Thales Luna, and Utimaco now support post-quantum cryptography (PQC) algorithms such as ML-KEM and ML-DSA, enabling libraries to transition to quantum-resistant key storage without full hardware replacement.[93][94][95] Unlike CPU-based accelerations, HSMs emphasize isolated key handling for high-assurance environments.[96]CPU and Accelerator Optimization
Cryptography libraries increasingly leverage specialized CPU instructions and accelerator extensions to enhance performance for computationally intensive operations like encryption, hashing, and key exchange, enabling throughput rates suitable for high-volume applications such as secure web traffic and data storage.[97] These optimizations exploit hardware features that offload and parallelize cryptographic primitives, reducing latency and power consumption compared to pure software implementations.[98] On x86 architectures, Intel's AES-NI instructions, introduced in 2008, provide a 3- to 10-fold speedup for AES encryption and decryption by accelerating key expansion, substitution, and round computations.[97][98] Libraries like OpenSSL automatically detect and utilize AES-NI via runtime CPU feature checks, seamlessly switching to hardware-accelerated paths for AES operations when available on supported processors.[99] Advanced vector extensions such as AVX-512 further boost performance in modern libraries; for instance, AWS-LC employs AVX-512 for AES-XTS, achieving significant gains in disk encryption workloads on Intel Xeon processors.[100] Similarly, the liboqs library optimizes post-quantum algorithms like SHA3 using AVX-512 for vectorized hashing, yielding up to 2x improvements over AVX2 baselines.[101] As of 2025, Intel Xeon processors with AVX-512 support initial acceleration for PQC algorithms like ML-KEM through vectorized implementations in libraries such as OpenSSL.[102] For ARM-based platforms, prevalent in mobile and embedded systems, the ARMv8 Cryptographic Extensions include instructions like PMULL for polynomial multiplication, which accelerates GHASH in AES-GCM modes and elliptic curve operations.[103] Botan, a C++ cryptography library, incorporates these extensions where supported, falling back to SIMD-optimized software paths (e.g., NEON) on older ARM CPUs to maintain compatibility without hardware-specific polyfills.[104] In contrast, mbed TLS prioritizes lightweight implementations for IoT devices with constrained CPUs, using configurable modules that avoid heavy reliance on accelerators but support basic ARM NEON for AES to minimize footprint while achieving acceptable speeds on resource-limited hardware.[105][106] GPU acceleration extends these optimizations to parallel workloads, with NVIDIA's CUDA enabling libraries to offload bulk encryption; for example, custom AES implementations on modern GPUs reach throughputs exceeding 80 Gbps for side-channel-resistant variants.[107] Benchmarks across libraries demonstrate AES-GCM performance surpassing 10 Gbps on contemporary x86 and ARM hardware with accelerators, as seen in OpenSSL and Botan on Intel Core i9 or ARM Cortex-A78 processors, underscoring the scale for real-time applications like VPNs.[108][109] As of 2025, emerging trends focus on RISC-V architectures, where ongoing standardization of cryptographic extensions—such as the scalar and vector crypto proposals in the RISC-V ISA—enable libraries like those from PQShield to integrate post-quantum primitives with vector acceleration for efficient deployment in open hardware ecosystems.[110][111]| Library | Key Optimizations | Platforms Supported | Example Throughput (AES-GCM) |
|---|---|---|---|
| OpenSSL | AES-NI auto-detection, AVX-512 | x86 | >10 Gbps on modern Intel Xeon (e.g., Sapphire Rapids)[112] |
| Botan | AES-NI, ARMv8 Crypto (PMULL), NEON fallback | x86, ARM | 10-50 Gbps on modern CPUs (median ~32 Gbps)[113] |
| mbed TLS | Lightweight AES with NEON | ARM (IoT-focused) | 1-10 MB/s on Cortex-M4 at 100-200 MHz[114] |
| liboqs | AVX-512 for hashes | x86 | 2x over AVX2 for SHA3[101] |
Implementation Qualities
Code Size and Maintainability
Code size and maintainability are critical factors in evaluating cryptography libraries, as they influence auditability, deployment in resource-limited settings like embedded systems, and long-term sustainability. Smaller codebases facilitate security reviews and reduce the attack surface, while higher comment ratios enhance readability for auditors and contributors. Metrics such as static binary size, lines of code (LOC), and comment density are commonly assessed using tools like thesize(1) utility for binaries on Unix-like systems and cloc for source code analysis. These indicators help determine suitability for constrained environments, where excessive size can limit integration into firmware or IoT devices.
Static binary size varies significantly across libraries, reflecting their scope and optimization. For instance, a full static build of OpenSSL typically results in a library exceeding 2 MB due to its comprehensive feature set, including legacy algorithms and extensive protocol support. In contrast, libsodium emphasizes minimalism, with its core static library compiling to approximately 100-200 KB, making it ideal for embedded applications where memory footprint is paramount. Rust-based libraries like ring further reduce size through memory safety and selective implementations, often yielding binaries under 500 KB while avoiding common vulnerabilities associated with manual memory management.[115][116]
| Library | Static Binary Size (approx.) | LOC (approx.) | Comment Ratio (approx.) |
|---|---|---|---|
| OpenSSL | ~2-3 MB | ~500,000 | 15-20% |
| libsodium | ~100-200 KB | ~50,000 | 25-30% |
| Crypto++ | ~1-2 MB | >1,000,000 | 10-15% |
| Botan | ~500 KB - 1 MB | ~200,000 | 20-30% |
| ring | <500 KB | ~100,000 | 30-40% |
cloc, indicate documentation quality—Botan achieves 20-30% comments, aiding comprehension of its modular C++ design, whereas denser libraries like OpenSSL hover around 15-20%, potentially complicating reviews. In embedded contexts, these metrics directly impact feasibility; oversized libraries like OpenSSL may necessitate stripping unused features to fit within megabyte limits typical of microcontrollers.
Maintainability is further evidenced by vulnerability history and community engagement. OpenSSL has accumulated over 200 Common Vulnerabilities and Exposures (CVEs) since its inception, reflecting its broad adoption and complex evolution, though recent releases show improved patching velocity. Conversely, libsodium maintains a sparse record with fewer than 10 CVEs, attributable to its focused API and design principles that minimize misuse. Active community involvement, measured by GitHub forks and contributors, underscores ongoing development—OpenSSL boasts over 10,000 forks with hundreds of active contributors as of 2025, while libsodium has around 1,500 forks and steady updates from its core team. By 2025, Rust libraries like ring have gained traction for maintainability, leveraging the language's ownership model to eliminate entire classes of memory-related bugs, with approximately 300 active forks supporting its integration into secure ecosystems.[117]
