eth-keyfile
eth-keyfile: A library for handling the encrypted keyfiles used to store ethereum private keys
What it is and what it does
eth-keyfile is a library for reading, writing, and decrypting Ethereum keyfiles—the encrypted JSON format used to store Ethereum private keys. It implements the Ethereum keyfile standard (versions 3 and 4), handling the encryption/decryption logic so you don't have to manage AES-128-CTR ciphers, PBKDF2/Scrypt key derivation, or MAC verification yourself. The library wraps eth-keys, eth-utils, py_ecc, and pycryptodome to provide four main functions: load keyfiles from disk, create new encrypted keyfiles from a raw private key and password, decrypt keyfile JSON to recover the private key, and extract keys directly from a file path.
It's primarily used in Ethereum wallet software, key management tools, and applications that need to persist private keys securely. The library supports both the older v3 standard (using secp256k1 curve limits) and the newer v4 standard (using bls12-381 curve limits), though it is still marked Pre-Alpha, suggesting v4 may not be fully stable.
Use it for:
- Load an encrypted Ethereum keyfile from disk and decrypt it with a password to retrieve the private key for signing transactions
- Generate a new encrypted keyfile from a raw private key and password, then save it for later use in wallet software
- Validate and parse keyfile JSON structures to ensure they conform to the Ethereum keyfile standard before processing
- Migrate keys between wallet implementations by reading v3 keyfiles and re-encrypting them as v4 with updated metadata
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Loads, creates, and decrypts Ethereum keyfiles—encrypted JSON files that store private keys using PBKDF2 or Scrypt key derivation with AES-128-CTR encryption.
Yes, if you are building Ethereum wallet or key management tooling and need standard-compliant keyfile handling. The library is well-established (in use since 2017), has no known vulnerabilities, and is maintained by the Ethereum Foundation. However, the aging maintenance status (550 days since last release) and Pre-Alpha classifier for v4 suggest you should verify v4 stability for your use case before relying on it in production.
Install
eth-keyfile on PyPI
pip
pip install eth-keyfileuv
uv add eth-keyfilepoetry
poetry add eth-keyfileInstalling eth-keyfile
Before you install
Low install friction with a pure-Python wheel and four runtime dependencies. Maintenance status is aging—last release was 550 days ago, though the repository remains active with a recent commit on 2025-12-18.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
from eth_keyfile import load_keyfile, extract_key_from_keyfile
# Load keyfile JSON from disk
keyfile_json = load_keyfile('path/to/keyfile.json')
# Or extract the private key directly
private_key = extract_key_from_keyfile('path/to/keyfile.json', b'password')
Requires a valid Ethereum keyfile in JSON format on disk; the password must match the one used to encrypt the keyfile.
Verify before relying
- Whether version 4 keyfile support is production-ready or still experimental given the Pre-Alpha classifier
- Current test coverage and whether the aging maintenance status reflects reduced security review
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — eth-keys, eth-utils, py_ecc, pycryptodome |
| Maintenance | aging — 550 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,937,356/month — #2,007 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: eth_keyfile-0.9.1-py3-none-any.whl
Keywords: ethereum
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
eth-keysProvides a unified API for Ethereum key…
permissive · top 5,000 on PyPI
altchaCreates and verifies ALTCHA proof-of-work…
permissive · top 15,000 on PyPI
pyscryptA pure-Python implementation of the scrypt…
permissive · top 15,000 on PyPI
cryptoProvides command-line tools to encrypt and…
permissive · top 5,000 on PyPI
eth-bloomImplements Ethereum's bloom filter algorithm…
permissive · top 15,000 on PyPI
malduckMalduck provides cryptographic, compression,…
copyleft · top 15,000 on PyPI
hkdfImplements HMAC-based Key Derivation Function…
permissive · top 15,000 on PyPI
eth-accounteth-account signs Ethereum transactions and…
permissive · top 5,000 on PyPI
faster-eth-utilsProvides Ethereum utility functions for address…
permissive · top 15,000 on PyPI
bip32Implements BIP 32 hierarchical deterministic…
permissive · top 15,000 on PyPI