LibreOffice File Encryption Algorithms Explained
LibreOffice employs industry-standard cryptographic protocols to protect sensitive documents from unauthorized access. This article details the primary encryption algorithms, hashing methods, and key derivation standards utilized by LibreOffice, focusing on modern OpenDocument Format (ODF) specifications, legacy compatibility, and alternative security features like OpenPGP.
Modern ODF Encryption: AES-256
The default format for LibreOffice is the OpenDocument Format (ODF). Starting with ODF 1.2 and continuing into ODF 1.3 and later specifications, LibreOffice relies on strong symmetric encryption:
- Algorithm: AES-256-CBC (Advanced Encryption Standard with a 256-bit key in Cipher Block Chaining mode).
- Key Derivation: PBKDF2 (Password-Based Key Derivation Function 2) combined with HMAC-SHA-256.
- Salt and Iterations: LibreOffice generates a cryptographic salt and executes 100,000 iterations by default to resist brute-force and dictionary attacks.
- Integrity Check: SHA-256 checksums verify that the document contents have not been altered or corrupted.
How LibreOffice Encrypts Files
LibreOffice documents (such as .odt, .ods,
and .odp) are structured as compressed ZIP archives
containing XML streams, embedded media, and metadata.
When a user enables password protection: 1. Manifest
File: The META-INF/manifest.xml file remains
unencrypted so the application can read the cryptographic parameters
(such as the algorithm used, initialization vectors, salt, and iteration
counts). 2. Component Encryption: Content streams (like
content.xml, styles.xml, and embedded images)
are individually encrypted using the derived AES-256 key and unique
initialization vectors (IVs). 3. MIME Type: The
mimetype file remains unencrypted to allow operating
systems and file managers to identify the file format without decrypting
it.
Legacy Algorithms and Compatibility
For backward compatibility with older ODF versions (ODF 1.1 and earlier) and legacy software, older LibreOffice and OpenOffice releases supported:
- AES-128-CBC: Used in early ODF 1.2 specifications with PBKDF2 and HMAC-SHA-1.
- Blowfish: Utilized in ODF 1.0 and 1.1 specifications with SHA-1 for key generation.
Modern versions of LibreOffice can still open these legacy encrypted files, but will upgrade them to AES-256 upon re-saving if modern ODF compatibility settings are selected.
Microsoft Office Format Compatibility
When saving password-protected files in Microsoft formats (such as
.docx, .xlsx, or .pptx),
LibreOffice implements the ECMA-376 Agile Encryption
standard:
- Cipher: AES-256 or AES-128 in CBC mode.
- Key Derivation: PBKDF2 with SHA-512 or SHA-256 hashing.
This ensures seamless cross-platform security between LibreOffice and Microsoft Office applications.
OpenPGP (GPG) Public-Key Encryption
In addition to symmetric password protection, LibreOffice supports OpenPGP (GPG) encryption and digital signatures. Users can encrypt documents using public keys stored in their local GnuPG keyring. This approach uses asymmetric cryptography (such as RSA or ECC) to secure the document key, ensuring that only holders of the corresponding private key can decrypt the file.