msoffcrypto-tool
Python tool and library for decrypting and encrypting MS Office files using a password or other keys
What it is and what it does
msoffcrypto-tool is a Python library and command-line tool for working with password-protected and encrypted Microsoft Office documents. It handles both modern OOXML formats (Word 2007+, Excel 2007+, PowerPoint 2007+) and legacy binary formats (Word 97–2003, Excel 97–2003, PowerPoint 2002–2003), supporting ECMA-376 Agile and Standard encryption, RC4 CryptoAPI, and XOR obfuscation schemes. The tool can verify passwords before decryption on supported formats and supports multiple key types: passwords, intermediate keys, and private keys for escrow certificates.
You can use it as a standalone CLI tool to decrypt files with a password prompt or command-line argument, test whether a file is encrypted, or encrypt plain OOXML documents. As a library, it provides fine-grained control over key loading, in-memory decryption, and optional integrity verification. The package depends on cryptography for cryptographic operations and olefile for parsing Office binary containers.
Use it for:
- Decrypt password-protected Word, Excel, or PowerPoint files in batch workflows or automation scripts.
- Analyze encrypted malicious Office documents (maldocs) in security research or incident response.
- Extract data from encrypted spreadsheets into memory for processing with pandas or other data tools.
- Verify password correctness before decryption on ECMA-376 Agile/Standard encrypted files.
- Programmatically encrypt plain OOXML documents with passwords for secure distribution.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Decrypts and encrypts Microsoft Office files (Word, Excel, PowerPoint) protected with passwords or cryptographic keys, supporting both modern OOXML and legacy binary formats.
Yes, if you need to decrypt or encrypt Microsoft Office files. The package is permissively licensed, has low install friction, and covers a wide range of encryption schemes. However, maintenance is aging (last release 214 days ago), and the encryption feature is experimental—use decryption for production workflows but treat encryption as beta. No known security vulnerabilities.
Install
msoffcrypto-tool on PyPI
pip
pip install msoffcrypto-tooluv
uv add msoffcrypto-toolpoetry
poetry add msoffcrypto-toolInstalling msoffcrypto-tool
Before you install
Low friction install with only two runtime dependencies (cryptography and olefile). Maintenance status is aging—last release was 214 days ago—but the repository remains active and not archived, with a modest user base of 619 stars.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely provided you retain the license notice.
Quickstart
pip install msoffcrypto-tool
import msoffcrypto
encrypted = open("encrypted.docx", "rb")
file = msoffcrypto.OfficeFile(encrypted)
file.load_key(password="Passw0rd")
with open("decrypted.docx", "wb") as f:
file.decrypt(f)
encrypted.close()
Requires Python 3.10 or later (supports up to 3.14); encryption feature is marked experimental.
Verify before relying
- Whether the experimental encryption feature is production-ready or suitable only for non-critical workflows.
- Performance characteristics when handling large Office files or batch decryption scenarios.
- Compatibility with Office files encrypted using non-standard or proprietary key derivation methods.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — cryptography, olefile |
| Maintenance | aging — 214 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 12,374,350/month — #1,322 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: msoffcrypto_tool-6.0.0-py3-none-any.whl
Tags
More Cryptography packages
Certifi provides Mozilla's curated collection…
copyleft · top 100 on PyPI
cryptographycryptography provides cryptographic recipes and…
permissive · top 100 on PyPI
rsaPure-Python RSA encryption, decryption,…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
azure-identityProvides Microsoft Entra ID token-based…
unclear · top 1,000 on PyPI
PyNaClPyNaCl provides Python bindings to libsodium…
permissive · top 1,000 on PyPI
oletoolsoletools is a suite of Python tools to extract,…
permissive · top 5,000 on PyPI
cryptoProvides command-line tools to encrypt and…
permissive · top 5,000 on PyPI
pcodedmpDisassembles VBA p-code from Microsoft Office…
copyleft · top 5,000 on PyPI
pyAesCryptEncrypts and decrypts files and binary streams…
permissive · top 15,000 on PyPI
compoundfilesReads and parses Microsoft Compound File Binary…
permissive · top 15,000 on PyPI
olefileolefile parses, reads, and writes Microsoft…
permissive · top 1,000 on PyPI
pypptx-with-oxmlReads, creates, and updates PowerPoint (.pptx)…
permissive · top 15,000 on PyPI
html2docxConverts valid HTML to Microsoft Word (.docx)…
permissive · top 15,000 on PyPI
pyzipperpyzipper replaces Python's standard zipfile…
permissive · top 5,000 on PyPI
kasa-cryptProvides fast encryption and decryption…
permissive · top 15,000 on PyPI