skillfed

sshpubkeys

SSH public key parser

sshpubkeys v3.3.1 1.4M downloads/30d#3,948 on PyPI99
Permissive license BSD DORMANT released

What it is and what it does

sshpubkeys is a native Python parser for OpenSSH public keys that validates and extracts metadata from ssh-rsa, ssh-dss, ssh-ed25519, and NIST-curve ecdsa keys. It depends on cryptography and ecdsa for the underlying cryptographic operations. The package provides a simple API: instantiate an SSHKey object with a key string, call parse(), and access properties like bits, comment, and hash methods (MD5, SHA256, SHA512). It also includes an AuthorizedKeysFile class for bulk parsing of authorized_keys files.

The package operates in two modes: strict (default), which enforces OpenSSH's own validation rules (e.g., DSA keys must be 1024, 2048, or 3072 bits), and loose, which attempts to accept any key OpenSSH would. It raises specific exceptions for different failure modes—InvalidKeyError for malformed data, NotImplementedError for unsupported key types, and InvalidOptionsError for invalid SSH options. The last release was in February 2021, and the project is dormant; however, the repository remains unarchived and may receive maintenance if issues arise.

Use it for:

  • Validate SSH public keys before storing them in an authorized_keys file or database.
  • Parse and audit authorized_keys files to extract key metadata and compute fingerprints for security logging.
  • Build SSH key management tools that need to identify key type, bit length, and detect weak keys.
  • Integrate SSH key validation into deployment or provisioning scripts that accept user-provided keys.
  • Generate SHA256 or SHA512 fingerprints for SSH keys to match against known-hosts or key registries.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses and validates OpenSSH public keys, extracting key type, bit length, and computing cryptographic hashes for ssh-rsa, ssh-dss, ssh-ed25519, and NIST-curve ecdsa keys.

Yes, if you need to parse and validate OpenSSH public keys in Python. The package is stable, has low install friction, carries a permissive license, and has no known vulnerabilities. Dormancy is a minor concern—the last release was over 2017 days ago—but the unarchived repository and broad Python 3 support (3.5+) suggest it remains usable for standard key formats. Install it if your use case is straightforward key parsing; consider alternatives if you need support for newer OpenSSH certificate formats or active maintenance.

Install

sshpubkeys on PyPI

pip

pip install sshpubkeys

uv

uv add sshpubkeys

poetry

poetry add sshpubkeys

Installing sshpubkeys

Before you install

Low friction install with two stable runtime dependencies (cryptography and ecdsa). Package is dormant—last release was 2021-02-04, over 2017 days ago—but the repository remains active and unarchived, suggesting maintenance may resume if needed.

License in practice

BSD license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects.

Quickstart

pip install sshpubkeys

from sshpubkeys import SSHKey

ssh = SSHKey("ssh-rsa AAAAB3NzaC1yc2E...", strict=True)
ssh.parse()
print(ssh.bits, ssh.hash_sha256())

Requires Python 3 (minimum version >=3); DSA keys must be 1024, 2048, or 3072 bits in strict mode.

Verify before relying

  • Whether the package handles modern OpenSSH key formats (e.g., ssh-ed25519-cert-v01@openssh.com) or only the base key types listed.
  • Performance characteristics when parsing large authorized_keys files with thousands of entries.
  • Whether dormancy affects compatibility with recent OpenSSH releases or cryptographic best practices.

Package facts

License BSD (permissive)
Python support supports the current Python release (>=3)
Install friction low — pure-Python wheel
Runtime dependencies 2 — cryptography, ecdsa
Maintenance dormant — 2,017 days since the last release
Last repo commit
First released
Downloads 1,401,982/month — #3,948 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sshpubkeys-3.3.1-py2.py3-none-any.whl

Keywords: ssh, pubkey, public, key, openssh, ssh-rsa, ssh-dss, ssh-ed25519

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: Implementation :: PyPyTopic :: Security

Tags

ssh public key parseropenssh key validationparse ssh-rsa keysssh key fingerprintauthorized_keys parserssh key hashopenssh key type detection
ssh-key-managementcryptography

More Security packages