Expand description
A wrapper for the Botan cryptography library
§Linking to Botan
By default the crate links against an installed Botan shared library
(or a static library with the static feature, or one built from source
with the vendored feature). Which functions the Botan headers declare
is detected at build time.
With the dynamic-loading feature nothing is linked at build time and no
Botan installation is required to build. Instead the Botan shared library
is located and loaded the first time it is needed (see load_library
for how to control this), and functions are resolved from it as they are
used. This means an application can be built once and pick up newer
features when run against a newer Botan, without being rebuilt.
§Availability of newer APIs
Every wrapper in this crate exists regardless of the version of Botan it
is built or run against. When an operation requires a function that the
Botan library in use does not provide, an error of type
ErrorType::NotImplemented is returned and Error::is_function_unavailable
returns true. The documentation of each affected item notes the minimum
version of Botan required. Version::current and
Version::supports_version report on the library in use.
Structs§
- Block
Cipher - A raw block cipher interface (ie ECB mode)
- CRL
- X.509 certificate revocation list
- CRLEntry
- X.509 certificate revocation entry
- Certificate
- X.509 certificate
- Cipher
- A symmetric cipher
- Decryptor
- An object that can perform public key decryption
- EcGroup
- An elliptic curve group
- EcPoint
- An elliptic curve point
- EcScalar
- An Integer modulo the prime group order of an elliptic curve
- Encryptor
- An object that performs public key encryption
- Error
- The library error type
- FPE
- Represents an instance of format preserving encryption
- HOTP
- Generate or check HOTP tokens
- Hash
Function - A hash function object
- KeyAgreement
- An object that performs key agreement
- KeyDecapsulation
- An object that can perform key decapsulation
- KeyEncapsulation
- An object that can perform key encapsulation
- KeySpec
- Specifies valid keylengths for symmetric ciphers/MACs
- MPI
- A big integer type
- MsgAuth
Code - Message authentication code
- OID
- ASN.1 object identifier
- Privkey
- A private key object
- Pubkey
- A public key object
- Random
Number Generator - A cryptographic random number generator
- Signer
- An object that can generate signatures
- Spake2p
Params - SPAKE2+ system parameters
- Spake2p
Prover - SPAKE2+ prover
- Spake2p
Verifier - SPAKE2+ verifier
- TOTP
- Generate or check TOTP tokens
- Verifier
- An object that can perform public key signature verification
- Version
- Information about the library version
Enums§
- Block
Cipher Algorithm - Block ciphers accepted by Botan’s block cipher interface.
- CRLReason
- Reason a certificate was revoked for
- Cert
Usage - Indicates if the certificate key is allowed for a particular usage
- Cert
Validation Status - Represents result of cert validation
- Cipher
Algorithm - Ciphers and cipher modes accepted by Botan’s cipher interface.
- Cipher
Direction - Which direction the cipher processes in
- Cipher
Padding - Padding schemes used by Botan block cipher modes.
- Classic
McEliece Params - Classic McEliece parameter sets.
- DlGroup
- Discrete logarithm groups accepted for Diffie-Hellman key creation.
- EcGroup
Id - Elliptic curve groups accepted for key creation.
- Encryption
Params - Parameters controlling public key encryption and decryption.
- Error
Type - Possible error categories
- Frodo
KemParams - FrodoKEM parameter sets.
- Hash
Algorithm - Hash functions accepted by Botan’s hash interface.
- KdfAlgorithm
- Key derivation functions accepted by Botan’s KDF interface.
- MacAlgorithm
- Message authentication codes accepted by Botan’s MAC interface.
- MlDsa
Params - ML-DSA parameter sets.
- MlKem
Params - ML-KEM parameter sets.
- Password
Hash Algorithm - Password hashing and password based KDF algorithms accepted by Botan.
- Pkcs8
Kdf - KDFs accepted when exporting an encrypted PKCS #8 private key.
- Public
KeyAlgorithm - Public key algorithms accepted by Botan’s key creation interface.
- RngType
- Random number generator types accepted by Botan.
- Signature
Params - Parameters controlling public key signature generation and verification.
- SlhDsa
Params - SLH-DSA parameter sets.
- Spake2p
Ciphersuite - A SPAKE2+ ciphersuite from RFC 9383
- Stream
Cipher Algorithm - Stream ciphers accepted by Botan’s cipher interface.
- Xmss
Params - XMSS parameter sets.
Traits§
- Block
Cipher Algorithm Identifier - A type that identifies a Botan block cipher.
- Cipher
Algorithm Identifier - A type that identifies a Botan cipher or cipher mode.
- Encryption
Params Identifier - A type that identifies the parameters of a Botan public key encryption scheme.
- Hash
Algorithm Identifier - A type that identifies a Botan hash function.
- KdfAlgorithm
Identifier - A type that identifies a Botan key derivation function.
- KeyGen
Params Identifier - A type that identifies parameters for Botan private key generation, such as an elliptic curve group or a post-quantum parameter set.
- MacAlgorithm
Identifier - A type that identifies a Botan message authentication code.
- Password
Hash Algorithm Identifier - A type that identifies a Botan password hashing or password based KDF algorithm.
- Pkcs8
KdfIdentifier - A type that identifies the KDF used to encrypt a PKCS #8 private key.
- Public
KeyAlgorithm Identifier - A type that identifies a Botan public key algorithm.
- RngType
Identifier - A type that identifies a Botan random number generator.
- Signature
Params Identifier - A type that identifies the parameters of a Botan public key signature scheme.
Functions§
- base64_
decode - Base64 decode some data
- base64_
encode - Base64 encode some data
- bcrypt_
hash - Produce a bcrypt password hash
- bcrypt_
verify - Verify a bcrypt password hash
- const_
time_ compare - Const time comparison
- derive_
key_ from_ password - Password based key derivation function
- derive_
key_ from_ password_ timed - Password based key derivation function, timed variant
- hex_
decode - Hex decode some data
- hex_
encode - Hex encode some data
- kdf
- Key derivation function
- load_
library - Load the Botan shared library from the specified path or name
- loaded_
library_ name - Return the name or path of the Botan shared library which was loaded
- nist_
kw_ dec - Unwrap a key using NIST key wrap algorithm
- nist_
kw_ enc - Wrap a key using NIST key wrap algorithm
- pbkdf
- Password based key derivation function
- pkcs_
hash_ id - Return the identifier used for PKCS1 v1.5 signatures for the specified hash
- rfc3394_
key_ unwrap - Unwrap a key encrypted using RFC3394’s AES key wrap algorithm
- rfc3394_
key_ wrap - Wrap a key using RFC 3394’s AES key wrap algorithm.
- scrub_
mem - Securely zeroize memory
- scrypt
- Scrypt key derivation
- zfec_
decode - Forward Error Correction Decoding
- zfec_
encode - Forward Error Correction Encoding
Type Aliases§
- Result
- The result of calling an operation on the library