skillfed

eth-keyfile

eth-keyfile: A library for handling the encrypted keyfiles used to store ethereum private keys

eth-keyfile v0.9.1 5.9M downloads/30d#2,007 on PyPI85
Permissive license MIT AGING released

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-keyfile

uv

uv add eth-keyfile

poetry

poetry add eth-keyfile

Installing 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

Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

ethereum keyfile encryptiondecrypt ethereum private keykeystore json handlerethereum key managementpbkdf2 scrypt keyfileaes encrypted keystoreethereum wallet keyfile
ethereumkey-managementcryptography

More Cryptography packages