Crypto++

{{Short description|C++ software library}}

{{Infobox software

| name = Crypto++

| logo = Crypto++-logo.png

| developer = originally Wei Dai, the Crypto++ project since 2015

| released = 2015

| latest release version = 8.9

| latest release date = {{release date and age|2023|10|01}}

| operating system = Cross-platform

| programming language = C++

| genre = Security library

| license = Boost Software License (previously [https://github.com/weidai11/cryptopp/blob/954fed3d5d6edb2639d5e093b0529b589ac31120/License.txt Crypto++ License]) / individual files into the public domain

| website = {{URL|https://www.cryptopp.com/}}

}}

Crypto++ (also known as CryptoPP, libcrypto++, and libcryptopp) is a free and open-source C++ class library of cryptographic algorithms and schemes written by Wei Dai. Crypto++ has been widely used in academia, student projects, open-source, and non-commercial projects, as well as businesses.

  • {{cite conference |author1=J. Kelsey |author2=B. Schneier |author-link2=Bruce Schneier |author3=D. Wagner |author4=C. Hall |date=1998 |url=http://www.schneier.com/paper-prngs.pdf |title=Cryptanalytic Attacks on Pseudorandom Number Generators |archive-url=https://web.archive.org/web/20141230032940/https://www.schneier.com/paper-prngs.pdf |archive-date=2014-12-30 |url-status=dead |book-title=Fast Software Encryption, 5th International Proceedings |access-date=2010-08-10}}
  • {{cite web |author1=C. Adjih |author2=D. Raffo |author3=P. Mühlethaler |date=2004 |url=http://www2.lifl.fr/SERAC/downloads/attacks-olsr-dkm.pdf |title=OLSR: Distributed Key Management for Security |archive-url=https://web.archive.org/web/20110721010610/http://www2.lifl.fr/SERAC/downloads/attacks-olsr-dkm.pdf |archive-date=2011-07-21 |url-status=dead |access-date=2010-08-10}}
  • {{cite conference |author1=X. Yinglian |author2=M. K. Reiter |author3=D. O'Hallaron |date=2006 |url=https://www.cs.cmu.edu/%7Eylxie/papers/report03.pdf |title=Protecting Privacy in Key-Value Search Systems |conference=Computer Security Applications Conference (ACSAC) |access-date=2010-08-10}}
  • {{cite web |author=T. Zidenberg |date=2010 |url=http://softlab-pro-web.technion.ac.il/projects/cryptoppopt/html/projectBook.html |title=Optimizing Crypto++ library for P4 |archive-url=https://web.archive.org/web/20110721134907/http://softlab-pro-web.technion.ac.il/projects/cryptoppopt/html/projectBook.html |archive-date=2011-07-21 |url-status=dead |website=Technion, Israel Institute of Technology |access-date=2010-08-10}} Released in 1995, the library fully supports 32-bit and 64-bit architectures for many major operating systems and platforms, including Android (using STLport), Apple (macOS and iOS), BSD, Cygwin, IBM AIX, Linux, MinGW, Solaris, Windows, Windows Phone and Windows RT. The project also supports compilation using C++03, C++11, C++14, and C++17 runtime libraries; and a variety of compilers and IDEs, including Borland Turbo C++, Borland C++ Builder, Clang, CodeWarrior Pro, GCC (including Apple's GCC), Intel C++ Compiler (ICC), Microsoft Visual C/C++, and Sun Studio.

Crypto++ 1.0 was released in June 1995, but the download is no longer available. The Crypto++ 1.0 release was withdrawn due to RSA Data Security, Inc asserting its patent over the RSA algorithm. All other versions of the library are available for download.{{cite web |title=Crypto++ Downloads |url=https://cryptopp.com/downloads.html |publisher=Crypto++ Project |date=June 1995 |access-date=December 20, 2020}}

Algorithms

Crypto++ ordinarily provides complete cryptographic implementations and often includes less popular, less frequently-used schemes. For example, Camellia is an ISO/NESSIE/IETF-approved block cipher roughly equivalent to AES, and Whirlpool is an ISO/NESSIE/IETF-approved hash function roughly equivalent to SHA; both are included in the library.{{cite web |title=Japan's First 128-bit Block Cipher 'Camellia' Approved as a New Standard Encryption Algorithm in the Internet |work=physorg.com |url=https://phys.org/news/2005-07-japan-bit-block-cipher-camellia.html |access-date=2022-05-23}}{{cite web |title=Hindu Wire |url=https://hinduwire.com/ |access-date=May 15, 2025}}

Additionally, the Crypto++ library sometimes makes proposed and bleeding-edge algorithms and implementations available for study by the cryptographic community. For example, VMAC, a universal hash-based message authentication code, was added to the library during its submission to the Internet Engineering Task Force (CFRG Working Group); and Brainpool curves, proposed in March 2009 as an Internet Draft in RFC 5639, were added to Crypto++ 5.6.0 in the same month.{{cite IETF |title=Elliptic Curve Cryptography (ECC) Brainpool Standard Curves and Curve Generation ||rfc=5639 |publisher=IETF |year=2009 |doi=10.17487/RFC5639 |access-date=2022-05-23 |last1=Lochter |first1=M. |last2=Merkle |first2=J. }}{{cite web |title=Crypto++ Library 8.6 |work=Crypto++ Website |url=https://www.cryptopp.com/ |access-date=2022-05-23 |archive-date=2022-05-22 |archive-url=https://web.archive.org/web/20220522124553/https://cryptopp.com/ |url-status=dead }}

class="wikitable" border="1"

|+ Crypto++ algorithms and implementations

!Primitive or Operation !! Algorithms or Implementations

Pseudorandom number generators

| LCG, KDF2, Blum Blum Shub, ANSI X9.17, Mersenne Twister, RDRAND and RDSEED

High speed stream ciphers

| ChaCha8/12/20, ChaCha20 (IETF version), HC-128 and HC-256, Panama, Rabbit, Salsa20, SOSEMANUK, XSalsa20

AES and AES candidates

| Rijndael (AES selection), RC6, MARS, Twofish, Serpent, CAST-256

Other block ciphers

| ARIA, Blowfish, Camellia, CHAM, HIGHT, IDEA, Kalyna (128/256/512), LEA, RC5, Triple-DES (2- and 3-key), SEED, SHACAL-2, Simon (64/128), Speck (64/128), SIMECK, Skipjack, SM4, TEA, Threefish (256/512/1024), XTEA

Block cipher modes of operation

| ECB, CBC, CTS, CFB, OFB, CTR, XTS

Authenticated encryption modes

| CCM, GCM, EAX, ChaCha20Poly1305

Block ciphers padding schemes

| PKCS#5, PKCS#7, Zeros, One and zeros, W3C Padding

Message authentication codes

| VMAC, HMAC, CMAC, CBC-MAC, DMAC, Two-Track-MAC

Cryptographic hash function

| BLAKE2 (BLAKE2b and BLAKE2s), Keccak, SHA-1, SHA-2 (SHA-224/256/384/512), SHA3, LSH (256/512), Tiger, WHIRLPOOL, RIPEMD (128/160/256/320)

Password based key derivation functions

| PBKDF1 and PBKDF2 from PKCS #5, PBKDF from PKCS #12 appendix B, Krawczyk and Eronen's HKDF

Public-key cryptography

| RSA, DSA, ElGamal, {{interlanguage link|Nyberg-Rueppel|ru|Подпись Нюберг — Руэппеля}} (NR), Rabin-Williams (RW), LUC, LUCELG, DLIES (variants of DHAES), ESIGN, curve25519

Padding schemes for public-key systems

| PKCS#1 v2.0, OAEP, PSS, PSSR, IEEE P1363 EMSA2 and EMSA5

Key agreement schemes

| Diffie–Hellman (DH), Unified Diffie–Hellman (DH2), Menezes–Qu–Vanstone (MQV), Hashed MQV (HMQV), Fully Hashed MQV (FHMQV), LUCDIF, XTR-DH, x25519

Elliptic-curve cryptography

| ECDSA, ECNR, ECIES, ECDH, ECMQV, Ed25519

Secret sharing

| Shamir's secret sharing scheme, Rabin's information dispersal algorithm (IDA)

The library also makes available primitives for number-theoretic operations such as fast multi-precision integers; prime number generation and verification; finite field arithmetic, including GF(p) and GF(2n); elliptical curves; and polynomial operations.

Furthermore, the library retains a collection of insecure or obsolescent algorithms for backward compatibility and historical value: MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL 3.0, WAKE, WAKE-OFB, DESX (DES-XEX3), RC2, SAFER, 3-WAY, GOST, SHARK, CAST-128, and Square.

Performance

In a 2007 ECRYPT workshop paper focusing on public key implementations of eight libraries, Ashraf Abusharekh and Kris Kaj found that "Crypto++ 5.1 [sic] leads in terms of support for cryptographic primitives and schemes, but is the slowest of all investigated libraries."{{cite conference|title=Comparative Analysis of Software Libraries for Public Key Cryptography|conference=ECRYPT Workshop on Software Performance Enhancement for Encryption and Decryption|pages=3–19|url=http://volgenau.gmu.edu/~kgaj/publications/conferences/GMU_SPEED_2007.pdf|author1=A. Abusharekh|author2=K. Kaj|year=2007|accessdate=2010-08-12|archive-url=https://web.archive.org/web/20120227082043/http://ite.gmu.edu/~kgaj/publications/conferences/GMU_SPEED_2007.pdf|archive-date=2012-02-27|url-status=dead}}

In 2008, speed tests carried out by Timo Bingmann using seven open-source security libraries with 15 block ciphers, Crypto++ 5.5.2 was the top-performing library under two block ciphers and did not rank below the average library performance under the remaining block ciphers.{{cite web|title=Speedtest and Comparison of Open-Source Cryptography Libraries and Compiler Flags|work=Timo Bingmann Weblog|url=http://idlebox.net/2008/0714-cryptography-speedtest-comparison/|author=T. Bingmann|year=2008|accessdate=2010-08-10}}

Crypto++ also includes an auto-benchmarking feature, available from the command line (cryptest.exe b), the results of which are available at Crypto++ 5.6.0 Benchmarks.{{cite web|title=Crypto++ 5.6.0 Benchmarks|work=Crypto++ Website|url=http://www.cryptopp.com/benchmarks.html|year=2009|accessdate=2010-08-10|archive-date=2008-10-15|archive-url=https://web.archive.org/web/20081015103105/http://www.cryptopp.com/benchmarks.html|url-status=dead}}

As with many other cryptographic libraries available for 32-bit and 64-bit x86 architectures, Crypto++ includes assembly routines for AES using AES-NI. With AES-NI, AES performance improves dramatically: 128-bit AES-GCM throughput increases from approximately 28.0 cycles per byte to 3.5 cycles per byte.{{cite web|title=AES-NI Performance Analyzed|url=http://www.tomshardware.com/reviews/clarkdale-aes-ni-encryption,2538.html|publisher=Tom's Hardware|year=2010|author1=P. Schmid |author2=A. Roos |accessdate=2010-08-10}}{{cite web|title=Misdetection of MIPS endianness & How to get fast AES calls?|author1=T. Krovetz |author2=W. Dai |work=Crypto++ user group|url=https://groups.google.com/group/cryptopp-users/msg/a688203c2314ef08|year=2010|accessdate=2010-08-11}}{{cite web|title=Crypto++ 5.6.0 Pentium 4 Benchmarks|work=Crypto++ Website|url=http://www.cryptopp.com/benchmarks-p4.html|year=2009|accessdate=2010-08-10|archive-date=2010-09-19|archive-url=https://web.archive.org/web/20100919121759/http://cryptopp.com/benchmarks-p4.html|url-status=dead}}

Version releases

Crypto++ 1.0 was released in June 1995. Since its initial release, the library has seen nearly two dozen revisions, including an architectural change in version 5.0.{{cite web|title=Crypto++ 5.0 beta available|work=Crypto++ Mailing List|url=https://groups.google.com/group/cryptopp-users/msg/fe8a49890c1d5484|author=Announcement|year=2002|accessdate=2010-08-09}}{{cite web|title=Crypto++ 5.0 update|work=Crypto++ Mailing List|url=https://groups.google.com/group/cryptopp-users/browse_thread/thread/5eddbbd5fde32a33/eca9f6071d470d8c|author=Announcement|year=2002|accessdate=2010-08-09}} There have been ten releases using the version 5.0 architecture since March 2009.{{cite web | url=http://sourceforge.net/mailarchive/forum.php?forum_name=cryptopp-announce | accessdate=2010-08-14 |

publisher = Sourceforge.net | title = Crypto++ Announcements List }}

class="wikitable" border="1"

|+ Crypto++ releases since version 6.0

! Version !! Released Date

Crypto++ 6.0.0

| align="right" | January 22, 2018

Crypto++ 6.1.0

| align="right" | February 22, 2018

Crypto++ 7.0.0

| align="right" | April 8, 2018

Crypto++ 8.0.0

| align="right" | December 28, 2018

Crypto++ 8.1.0

| align="right" | February 11, 2019

Crypto++ 8.2.0

| align="right" | April 28, 2019

Crypto++ 8.3.0

| align="right" | December 20, 2020

Crypto++ 8.4.0

| align="right" | January 2, 2021

Crypto++ 8.5.0

| align="right" | March 7, 2021

Crypto++ 8.6.0

| align="right" | September 24, 2021

Crypto++ 8.7.0

| align="right" | August 7, 2022

Crypto++ 8.8.0

| align="right" | June 25, 2023

Crypto++ 8.9.0

| align="right" | October 1, 2023

Lawrence Teo's compilation of previous Crypto++ releases dating back to 1995 can be found in the users group archives.{{cite web|title=Release Dates of Previous Versions|work=Crypto++ Mailing List|url=https://groups.google.com/group/cryptopp-users/msg/c6d44b381c78a2bf|author=L. Teo|year=2002|accessdate=2010-08-09}}

FIPS validations

Crypto++ has received three Federal Information Processing Standard (FIPS) 140-2 Level 1 module validations with no post-validation issues.{{cite web|title=Crypto++ Library Versions 5.3.0 [32-bit and 64-bit] Security Policy | work=Cryptographic Module Validation Program (CMVP)|url=http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140sp/140sp819.pdf|year=2007|accessdate=2010-08-08}}

class="wikitable" border="1"

|+ FIPS validated Crypto++ modules

! Version !! Certificate !! Dates

width="120pt" | Crypto++ 5.0.4width="120pt" | Certificate 343{{cite web|title=Validated FIPS 140-1 and FIPS 140-2 Cryptographic Modules (2003)|work=Cryptographic Module Validation Program (CMVP)|url=http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/1401val2003.htm#343|year=2003|accessdate=2010-08-08}}2003-09-05, 2005-10-28
Crypto++ 5.2.3Certificate 562{{cite web|title=Validated FIPS 140-1 and FIPS 140-2 Cryptographic Modules (2005)|work=Cryptographic Module Validation Program (CMVP)|url=http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/1401val2005.htm#562|year=2005|accessdate=2010-08-08}}2005-07-29, 2005-08-24, 2005-10-28
Crypto++ 5.3.0Certificate 819{{cite web|title=Validated FIPS 140-1 and FIPS 140-2 Cryptographic Modules (2007)|work=Cryptographic Module Validation Program (CMVP)|url=http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/1401val2007.htm#819|year=2007|accessdate=2010-08-08}}2007-08-13, 2007-08-17

Crypto++ was moved to the CMVP's [http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140val-historical.htm Historical Validation List] in 2016. The move effectively means the library is no longer validated.

Licensing

As of version 5.6.1, Crypto++ consists of only public domain files, with a compilation copyright and a single open source license for the compilation copyright:{{cite web|title=Compilation Copyright for Crypto++|url=http://www.cryptopp.com/License.txt|work=Crypto++ Website|accessdate=2010-08-15}}

{{Cquote|The License of Crypto++ is somewhat unusual amongst open source projects. A distinction is made between the library as a compilation (i.e., collection), which is copyrighted by Wei Dai, and the individual files in it, which are public domain.

The library is copyrighted as a compilation in order to place certain disclaimers (regarding warranty, export, and patents) in the license and to keep the attributions and public domain declarations intact when Crypto++ is distributed in source code form. The fact that individual files are public domain means that legally you can place code segments, entire files, or small sets of files (up to the limit set by fair use) into your own project and do anything you want with them without worrying about the copyright.

|30px||[http://www.cryptopp.com/ Crypto++ Website]

}}

See also

References

{{Reflist|30em}}