This folder hosts the Cryptographic Units of the mORMot Open Source framework, version 2.
Those units implement hashing, message digests, encryption, and asymmetric cryptography.
They are written in a cross-platform way in mind, with a very efficient stand-alone version (using optimized pascal code and assembly), or via an external OpenSSL library.
Hint: If you are not familiar with the algorithms themselves and their details, consider using mormot.crypt.secure and its Rnd/Hash/Sign/Cipher/Asym/Cert/Store high-level factories.
Legal Notice: as stated by our licensing terms, make sure that you comply to any restriction about the use of cryptographic software in your country.
High-Performance Cryptographic features shared by all framework units
- Low-Level Memory Buffers Helper Functions
- 256-bit BigInt Low-Level Computation for ECC
- AES Encoding/Decoding with optimized asm and AES-NI/CLMUL support
- AES-256 Cryptographic Pseudorandom Number Generator (CSPRNG)
- SHA-2 SHA-3 Secure Hashing
- HMAC Authentication over SHA-256
- PBKDF2 Safe Key Derivation over SHA-2 and SHA-3
- Digest/Hash to Hexadecimal Text Conversion
- Deprecated MD5 SHA-1 Algorithms
- Non Cryptographic Random Generators for Testing or IV Filling
This unit is validated against OpenSSL for correctness.
Optimized assembly is located in separated mormot.crypt.core.asmx64.inc and mormot.crypt.core.asmx86.inc files.
It is fully stand-alone, and faster than OpenSSL on x86_64 for most operations, except RSA.
Authentication and Security types shared by all framework units.
TSyn*PasswordandTSynConnectionDefinitionClasses- Reusable Authentication Classes
- High-Level
TSynSigner/TSynHasherMulti-Algorithm Wrappers - HMAC/PBKDF2 MCF SCRAM SCRAM-MCF TOTP High-Level Protocols
- Client and Server Digest Access Authentication
- 64-bit
TSynUniqueIdentifierand its efficient Generator IProtocolSafe Communication with Unilateral or Mutual AuthenticationTBinaryCookieGeneratorSimple Cookie GeneratorRnd/Hash/Sign/Cipher/Asym/Cert/StoreHigh-Level Algorithms Factories- Minimal
PEM/DEREncoding/Decoding TSynMustacheCryptographic Expression Helpers
High-Performance secp256r1/NISTP-256/prime256v1 Elliptic-Curve Cryptography
- Low-Level ECC secp256r1 ECDSA and ECDH Functions
- Middle-Level Certificate-based Public Key Cryptography
If mormot.crypt.openssl.RegisterOpenSsl is called, faster OpenSSL library will be used.
Certificate-based Public Key Cryptography Classes
- High-Level Certificate-based secp256r1 Public Key Cryptography
- HMAC-CRC32C and HMAC-CRC256C Message Integrity Algorithms
IProtocolImplemented using Public Key Cryptography- Registration of our ECC Engine to the
TCryptAsym/TCryptCertFactories
Rivest-Shamir-Adleman (RSA) Public-Key Cryptography
- RSA Oriented Big-Integer Computation
- RSA Low-Level Cryptography Functions
- Registration of our RSA Engine to the
TCryptAsymFactory
X.509 Certificates Implementation - see RFC 5280
- X.509 Fields Logic
- X.509 Certificates and Certificate Signing Request (CSR)
- X.509 Certificate Revocation List (CRL)
- X.509 Private Key Infrastructure (PKI)
- Registration of our X.509 Engine to the
TCryptCert/TCryptStoreFactories
JSON Web Tokens (JWT) Implementation - see RFC 7797
- Abstract JWT Parsing and Computation
- JWT Implementation of
HS*andS3*Symmetric Algorithms - JWT Implementation of
ES256Asymmetric Algorithm - JWT Implementation of
RS256/RS384/RS512Asymmetric Algorithms TJwtCryptImplementation viaICryptPublicKey/ICryptPrivateKeyFactories
High-Performance Cryptographic Features using OpenSSL 1.1 / 3.x / 4.x
- OpenSSL Cryptographic Pseudorandom Number Generator (CSPRNG)
- AES Cypher/Uncypher in various Modes
- Hashers and Signers OpenSSL Wrappers
- OpenSSL Asymmetric Cryptography
- JWT Implementation using any OpenSSL Algorithm
- Register OpenSSL to our General Cryptography Catalog
Warning: on Windows, you need to define the USE_OPENSSL conditional in YOUR project options to have this code actually link to the OpenSSL library.
TL;DR: On x86_64, our mormot.crypt.pas asm is stand-alone and faster than OpenSSL for most algorithms, and only 20% slower for AES-GCM (but faster for OpenSSL 3.0).
For ECC or RSA, our mormot.crypt.ecc256r1 or mormot.crypt.rsa units are noticeably slower than OpenSSL, but fully stand-alone.
Direct Cryptography using Windows API
- AES cypher/uncypher using PROV_RSA_AES CryptoApi
- High-Level Windows Certificate Store Integration
- Middle-Level Windows CNG Private Key Integration
Access Hardware Security Modules (HSM) via PKCS#11
- High-Level PKCS#11 Integration with the Framework Types
- Registration of the PKCS#11 Engine to the
TCryptAsym/TCryptCertFactories
Deprecated or Seldom Used Cryptographic Features
- Deprecated MD4 and RC4 Support
- Deprecated Low-Level Memory Buffers Helper Functions
- Deprecated Weak AES/SHA Process
- BlowFish Encryption
- BCrypt Password-Hashing Function
- SCrypt Password-Hashing Function