Skip to main content

Crate botan

Crate botan 

Source
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§

BlockCipher
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
HashFunction
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
MsgAuthCode
Message authentication code
OID
ASN.1 object identifier
Privkey
A private key object
Pubkey
A public key object
RandomNumberGenerator
A cryptographic random number generator
Signer
An object that can generate signatures
Spake2pParams
SPAKE2+ system parameters
Spake2pProver
SPAKE2+ prover
Spake2pVerifier
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§

BlockCipherAlgorithm
Block ciphers accepted by Botan’s block cipher interface.
CRLReason
Reason a certificate was revoked for
CertUsage
Indicates if the certificate key is allowed for a particular usage
CertValidationStatus
Represents result of cert validation
CipherAlgorithm
Ciphers and cipher modes accepted by Botan’s cipher interface.
CipherDirection
Which direction the cipher processes in
CipherPadding
Padding schemes used by Botan block cipher modes.
ClassicMcElieceParams
Classic McEliece parameter sets.
DlGroup
Discrete logarithm groups accepted for Diffie-Hellman key creation.
EcGroupId
Elliptic curve groups accepted for key creation.
EncryptionParams
Parameters controlling public key encryption and decryption.
ErrorType
Possible error categories
FrodoKemParams
FrodoKEM parameter sets.
HashAlgorithm
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.
MlDsaParams
ML-DSA parameter sets.
MlKemParams
ML-KEM parameter sets.
PasswordHashAlgorithm
Password hashing and password based KDF algorithms accepted by Botan.
Pkcs8Kdf
KDFs accepted when exporting an encrypted PKCS #8 private key.
PublicKeyAlgorithm
Public key algorithms accepted by Botan’s key creation interface.
RngType
Random number generator types accepted by Botan.
SignatureParams
Parameters controlling public key signature generation and verification.
SlhDsaParams
SLH-DSA parameter sets.
Spake2pCiphersuite
A SPAKE2+ ciphersuite from RFC 9383
StreamCipherAlgorithm
Stream ciphers accepted by Botan’s cipher interface.
XmssParams
XMSS parameter sets.

Traits§

BlockCipherAlgorithmIdentifier
A type that identifies a Botan block cipher.
CipherAlgorithmIdentifier
A type that identifies a Botan cipher or cipher mode.
EncryptionParamsIdentifier
A type that identifies the parameters of a Botan public key encryption scheme.
HashAlgorithmIdentifier
A type that identifies a Botan hash function.
KdfAlgorithmIdentifier
A type that identifies a Botan key derivation function.
KeyGenParamsIdentifier
A type that identifies parameters for Botan private key generation, such as an elliptic curve group or a post-quantum parameter set.
MacAlgorithmIdentifier
A type that identifies a Botan message authentication code.
PasswordHashAlgorithmIdentifier
A type that identifies a Botan password hashing or password based KDF algorithm.
Pkcs8KdfIdentifier
A type that identifies the KDF used to encrypt a PKCS #8 private key.
PublicKeyAlgorithmIdentifier
A type that identifies a Botan public key algorithm.
RngTypeIdentifier
A type that identifies a Botan random number generator.
SignatureParamsIdentifier
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