openssh_key
Tools to deal with OpenSSH2 (RFC4716) keys in as pure Python 3 as possible.
These key files are the default format generated by ssh-keygen since OpenSSH 7.8 (2018-08-24)
and can be recognized from their -----BEGIN OPENSSH PRIVATE KEY----- header.
If you need to simply convert one of these files into the "legacy" PEM format, you can do it using
a recent enough ssh-keygen – or you can use this library. In case you just want the conversion done,
ssh-keygen -e -m PEM -p -f my-openssh-format-private-key
will transmute my-openssh-format-private-key in-place into PEM.
Limitations
- Encrypted OpenSSH private key files are not yet supported, and raise an error.
- Not all key formats supported by OpenSSH are supported; the widest support is for RSA keys.
Requirements
- Python 3.7+
Usage
Install the package into your environment using your favored tools.
If you need to be able to convert key data into PEM, also install cryptography
(or install this package with the convert extra, which depends on that module).
The basic API is provided via openssh_key.OpenSSHKeyFile.parse_text(), like so:
from openssh_key import OpenSSHKeyFile
with open('my-openssh-format-private-key') as infp:
kf = OpenSSHKeyFile.parse_text(infp)
for keypair in kf.decrypt_keypairs():
print(keypair.public_key_string) # as you'd find in `authorized_keys`
See the modules themselves and the tests for more.
Metadata
Release files for openssh-key 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openssh_key-0.3.0.tar.gz | 6.2 kB | Without provenance | Details for openssh_key-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openssh_key-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for openssh_key-0.3.0-py3-none-any.whl |
Total release size: 14.7 kB
Release files / openssh_key-0.3.0.tar.gz
| Download URL | openssh_key-0.3.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c24fc3250999c46cf59273e235e4dd48b60be2d47541d4b993fd2c79c6e4035d
|
|
BLAKE2b-256 checksum How to use checksums |
bf6c901580bf521e957cb615b69654c7e2e9ff0791abc42b17d85f00e898657a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Release files / openssh_key-0.3.0-py3-none-any.whl
| Download URL | openssh_key-0.3.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f0d19852d205a1242406ccc229ab0e6ee2970587e30d1a5bff1f3aff1748df1
|
|
BLAKE2b-256 checksum How to use checksums |
0516ca5399f889b16f9e63050959222a1ff7cb5ce5c8d704b300e057fade26b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|
Security for openssh-key 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.