TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/openmls/openmls/llms.txt
Use this file to discover all available pages before exploring further.
OpenMlsCrypto trait defines all cryptographic functions required by OpenMLS. This includes HKDF, hashing, AEAD encryption/decryption, signatures, and HPKE operations.
Trait definition
TheOpenMlsCrypto trait is defined in openmls_traits/src/crypto.rs:
Required cryptographic operations
The crypto provider must implement the following categories of operations:HKDF (HMAC-based Key Derivation Function)
hash_type parameter specifies which hash function to use (SHA-256, SHA-384, or SHA-512).
Hashing
AEAD (Authenticated Encryption with Associated Data)
Signatures
HPKE (Hybrid Public Key Encryption)
Example implementation
Here’s a simplified example showing the structure of a crypto provider implementation from the Rust Crypto provider:Error handling
TheCryptoError enum provides specific error types for different failure scenarios:
Thread safety requirements
The trait requiresSend + Sync bounds:
RwLock or Mutex) for any mutable state.
Testing your implementation
When implementing a custom crypto provider:- Test against known vectors: Use test vectors from the MLS specification
- Test all ciphersuites: Ensure all supported ciphersuites work correctly
- Test error cases: Verify proper error handling for invalid inputs
- Test thread safety: Verify concurrent access works correctly
Using the crypto provider
Once implemented, use your crypto provider as part of anOpenMlsProvider:
See also
Random provider
Learn about the random number generation trait
Storage provider
Learn about the storage provider trait
Custom implementation
Complete guide to implementing custom providers
Overview
Back to provider traits overview