Skip to main content

key-transform

Transforms an OpenPGP key to PKCS#8 and OpenSSH key format.

Supports RSA, ECDSA and ED25519 keys.

Installation

Install via pipx or uv tool

uv tool install key-transform
# OR
pipx install key-transform

Usage

# Lookup secret key(s) and note key fingerprint
gpg -K
~/.gnupg/pubring.kbx
-------------------------------------------------------------
sec   ed25519 2026-02-06 [SC]
      972ACF51A09C0259060CFA035432496985998071
uid           [ultimate] Test Key <test@example.com>
ssb   cv25519 2026-02-06 [E]
ssb   rsa3072 2026-02-06 [A]
ssb   ed25519 2026-02-06 [A]
ssb   nistp256 2026-02-06 [A]

# Export the key
gpg --export-secret-key 972ACF51A09C0259060CFA035432496985998071 > secret_key.gpg

# Transform the key, output will be PKCS#8 and OpenSSH format
key-transform transform secret_key.gpg

#################### PGP Private Key 3F745041AAFE4699CB6FB57F3E311D69E96ADFDD RSAEncryptOrSign 3072 ####################
# SSH Pubkey:
ssh-rsa AAAAB3NzaC1yc2[...]

# PKCS8 Private Key:
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIHdTBfBgkqhkiG9w0BBQ0wUjAxBgkqhkiG9w0BBQwwJAQQmv1ATOwwehUv7yd6
[...]
Nu6faDf4tiJQCfrBP0OL8Rt4yJTSHk79IZe8tysYfYVc01jl119v3Cc=
-----END ENCRYPTED PRIVATE KEY-----

# OpenSSH Private Key:
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABC4U2kyj10gkOYW
[...]
OxarmihrTQIcdQpD0Ts1NrV9A/eg3Pua+FRmuVVzfY+fT8bP5+ztIQ5SDmcxmDwNLGDY5vD6jcR0
q2Sf5Fl7k1uKj1QmPA==
-----END OPENSSH PRIVATE KEY-----

########################################################################################################################
############### PGP Private Key 82080A5C69729B254E767F10030959F32C2268B7 EdDSA EllipticCurveOID.Ed25519 ################
# SSH Pubkey:
ssh-ed25519 AAAAC3Nza[...]

# PKCS8 Private Key:
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIGjMF8GCSqGSIb3DQEFDTBSMDEGCSqGSIb3DQEFDDAkBBB+N0mJLilE1jtYvYNO
[...]
FmvKKIRiopWgsjUIgcPLRyoDWLdzKg==
-----END ENCRYPTED PRIVATE KEY-----

# OpenSSH Private Key:
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABCUuri5leG0RFKe
[...]
K5+JAItSAMQnM9LV5g4PT6nn56VtsSaM3dF+PM0lSoeJDNkR/6pZ7LLyphCwKQ==
-----END OPENSSH PRIVATE KEY-----

########################################################################################################################
############## PGP Private Key 963E77E42934A3BD5EDB2139527CD0C853415507 ECDSA EllipticCurveOID.NIST_P256 ###############
# SSH Pubkey:
ecdsa-sha2-nistp256 AAAAE2VjZH[...]

# PKCS8 Private Key:
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIH0MF8GCSqGSIb3DQEFDTBSMDEGCSqGSIb3DQEFDDAkBBA1GnMpIItB3JYv51b9
[...]
PZn5p3E77Q==
-----END ENCRYPTED PRIVATE KEY-----

# OpenSSH Private Key:
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABCqT2tcZRsyufkT
[...]
bg==
-----END OPENSSH PRIVATE KEY-----

########################################################################################################################

Metadata

Release files for key-transform 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for key-transform 1.0.2
File Size Uploaded Provenance Actions
key_transform-1.0.2.tar.gz 14.1 kB With provenance Details for key_transform-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for key-transform 1.0.2
File Interpreter ABI Platform Actions
key_transform-1.0.2-py3-none-any.whl Python 3 none any Details for key_transform-1.0.2-py3-none-any.whl

Total release size: 19.4 kB

Release files / key_transform-1.0.2.tar.gz

Download URL key_transform-1.0.2.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d851a88377947c2a32dbdfad4443e05871a2747e2ec9aab1331ef3640d44305b
BLAKE2b-256 checksum
How to use checksums
07aace06d9cc9396cd1e52adb39eaedf15346cb81aadfeb10f6b24c2eee3f87f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / key_transform-1.0.2-py3-none-any.whl

Download URL key_transform-1.0.2-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8e21fbd34067018617fb00d649897d1502eca14941542d24bd836478ff9a9c8
BLAKE2b-256 checksum
How to use checksums
e0d8f240267b1137e31ba5c1baf9641a254475d946fbd75d8a07d141b456f135
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Nov 13, 2026.

Transparency log

Security for key-transform 1.0.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for key_transform-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Nov 13, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page