Documentation Index
Fetch the complete documentation index at: https://mintlify.com/bitwarden/clients/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Bitwarden implements a comprehensive cryptographic architecture built on end-to-end encryption principles. All sensitive data is encrypted client-side before transmission to servers, ensuring that only the user can decrypt their vault data.Core Cryptographic Principles
End-to-End Encryption
Bitwarden employs end-to-end encryption where:- Client-side encryption: All encryption and decryption operations occur on the client
- Zero-knowledge architecture: The server never has access to unencrypted data or encryption keys
- User-controlled keys: Only the user possesses the keys needed to decrypt their vault
Key Hierarchy
Bitwarden uses a hierarchical key structure:Master Key
The master key is derived from the user’s master password using a Key Derivation Function (KDF):- Input: Master password + email (used as salt)
- Process: KDF (PBKDF2 or Argon2id)
- Output: 256-bit master key
- Storage: Never stored; derived on-demand from password
User Key
The user key is a symmetric key that actually encrypts vault data:- Type: 512-bit symmetric key (AES-256 + HMAC-SHA256)
- Generation: Cryptographically secure random number generator (CSPRNG)
- Protection: Encrypted with the master key
- Storage: Encrypted user key stored server-side and locally
Organization Keys
For shared organization vaults:- Generation: 512-bit symmetric key per organization
- Protection: Encrypted with user’s public key (RSA-2048)
- Sharing: Encrypted separately for each organization member
Encryption Types
Bitwarden supports multiple encryption algorithms:Symmetric Encryption
AES-256-CBC with HMAC-SHA256 (Primary)
- Encryption: AES-256 in CBC mode
- Authentication: HMAC-SHA256
- Key size: 512 bits (256-bit encryption key + 256-bit MAC key)
- IV: Randomly generated per encryption operation
XChaCha20-Poly1305 (Modern)
- Algorithm: XChaCha20-Poly1305 AEAD
- Encoding: COSE (CBOR Object Signing and Encryption)
- Benefits: Authenticated encryption, better performance on some platforms
Asymmetric Encryption
- Key size: 2048-bit RSA
- Padding: OAEP (Optimal Asymmetric Encryption Padding)
- Usage: Organization key sharing, key encapsulation
Key Derivation Functions
Bitwarden supports two KDFs for deriving the master key from the master password:PBKDF2-SHA256
- Default iterations: 600,000 (OWASP recommended minimum)
- Range: 600,000 to 2,000,000 iterations
- Algorithm: PBKDF2 with SHA-256
- Purpose: Derive master key from password + email
Argon2id
- Default: 3 iterations, 64 MB memory, 4 parallel threads
- Algorithm: Argon2id (winner of Password Hashing Competition)
- Benefits: Memory-hard, resistant to GPU/ASIC attacks
Encryption Services
The encryption architecture is modular:EncryptService
- String encryption/decryption
- File encryption/decryption
- Key wrapping/unwrapping
- Key encapsulation (RSA)
CryptoFunctionService
- PBKDF2/Argon2id key derivation
- HKDF key expansion
- Hash functions (SHA-1, SHA-256, SHA-512)
- HMAC operations
- RSA operations
- Random number generation (CSPRNG)
Encrypted String Format
Encrypted data is serialized in a specific format:Format Examples
- AES-CBC-256 + HMAC:
2.iv|data|mac - RSA-OAEP:
3.data - RSA-OAEP + HMAC:
5.data|mac
Security Best Practices
Key Storage Guidelines
- Master Key: Never stored; always derived from password
- User Key: Stored encrypted with master key
- Organization Keys: Stored encrypted with user’s public key
- Private Key: Stored encrypted with user key
Encryption Guidelines
- Always use authenticated encryption (HMAC or AEAD)
- Generate unique IVs for each encryption operation
- Use CSPRNG for all random data (keys, IVs, salts)
- Validate MACs before decrypting (prevent oracle attacks)
Related Topics
- Encryption Implementation - Details on how data is encrypted
- Key Management - Key lifecycle and storage
- Vault Security - Vault-specific encryption
References
libs/key-management/- Key management implementationlibs/common/src/key-management/crypto/- Cryptographic serviceslibs/common/src/platform/enums/encryption-type.enum.ts- Encryption types