sshpk-conv(1)
π sshpk-conv β bestie's guide to key glow-ups π
okay so this lil page lives in the sshpk Commands manual, and it's literally just... converting keys between formats? iconic behaviour, honestly.
β¨ NAME β¨
sshpk-conv β convert between key formats π¦
β¨ SYNOPSYS β¨
(yes that's how the original spells it, and yes I'm keeping it, it's part of the vibe)
sshpk-conv -t FORMAT [FILENAME] [OPTIONS...]
sshpk-conv -i [FILENAME] [OPTIONS...]
β¨ DESCRIPTION β¨
So the whole thing is: it reads in a public or private key and converts it between different formats β especially the formats the SSH protocol uses and the well-known PEM PKCS#1/7 formats. That's the job. That's the whole assignment. π
And then there's the second form: if you give it the -i option, it doesn't convert anything, it just identifies a key and prints info about its nature, size and fingerprint β to stderr. Slay.
β¨ EXAMPLES β¨
okay imagine we've got this SSH-format public key sitting in id_ecdsa.pub:
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTI...9M/4c4= user@host
Identify it with -i:
$ sshpk-conv -i id_ecdsa.pub
id_ecdsa: a 256 bit ECDSA public key
ECDSA curve: nistp256
Comment: user@host
Fingerprint:
SHA256:vCNX7eUkdvqqW0m4PoxQAZRv+CM4P4fS8+CbliAvS4k
81:ad:d5:57:e5:6f:7d:a2:93:79:56:af:d7:c0:38:51
Convert it to pkcs8 format, for use with e.g. OpenSSL:
$ sshpk-conv -t pkcs8 id_ecdsa
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEAsA4R6N6AS3gzaPBeLjG2ObSgUsR
zOt+kWJoijLnw3ZMYUKmAx+lD0I5XUxdrPcs1vH5f3cn9TvRvO9L0z/hzg==
-----END PUBLIC KEY-----
Retrieve the public half of a private key:
$ openssl genrsa 2048 | sshpk-conv -t ssh -c foo@bar
ssh-rsa AAAAB3NzaC1yc2EAAA...koK7 foo@bar
Convert a private key to PKCS#1 (OpenSSL) format from a new-style OpenSSH key format (the ssh-keygen -o format):
$ ssh-keygen -o -f foobar
...
$ sshpk-conv -p -t pkcs1 foobar
-----BEGIN RSA PRIVATE KEY-----
MIIDpAIBAAKCAQEA6T/GYJndb1TRH3+NL....
-----END RSA PRIVATE KEY-----
β¨ OPTIONS β¨
-i,--identifyβ don't convert anything bestie, just spit out identifying info about the key to stderr β its type, size and fingerprints. π«Ά-p,--privateβ treat the key as a private key instead of a public one (public is the default). Heads up: if you handsshpk-conva private key and don't give this option, it'll extract only the public half from it and work with that. so like... it takes the public half. no cap. π-f PATH,--file=PATHβ the input file to grab the key from, instead of stdin. And if you just pass a filename as a positional argument? that's equivalent to using this option. same energy, different spelling. β¨-o PATH,--out=PATHβ output file name to use instead of stdout. π-T FORMAT,--informat=FORMAT-t FORMAT,--outformat=FORMATβ these two pick the input and output formats to be used (peep the FORMATS section right below, bestie).-c TEXT,--comment=TEXTβ sets the key comment for the output file, if supported. π¬
β¨ FORMATS β¨
Currently supported formats, ranked in no particular order because they're all valid:
pem,pkcs1β the standard PEM format, used by older OpenSSH and most TLS libraries such as OpenSSL. The classicid_rsafile is usually in this format. It's an ASN.1 encoded structure, base64-encoded and placed between PEM headers. πsshβ the SSH public key text format (i.e. the format of anid_rsa.pubfile). A single line, containing 3 space separated parts: the key type, key body and optional key comment. πΈpkcs8β a newer PEM format, usually used only for public keys by TLS libraries such as OpenSSL. The ASN.1 structure is more generic than that ofpkcs1. β¨opensshβ the newssh-keygen -oformat from OpenSSH. Lowkey it can be mistaken for a PEM encoding but it's actually an OpenSSH internal format. don't get got. πrfc4253β the internal binary format of keys when sent over the wire in the SSH protocol. This is also the format that thessh-agentuses in its protocol. π
β¨ SEE ALSO β¨
ssh-keygen(1), openssl(1) β go read those too, they're the co-stars π
β¨ BUGS β¨
π¨ Encrypted (password-protected) keys are not supported. π¨ like, at all. don't come for me, it's just not happening. π
Report bugs at Github β¨https://github.com/arekinath/node-sshpk/issuesβ© β the link is right there, use it, tell them everything. π
sshpk Β· Jan 2016 β that's the source and the date bestie, and that's the whole page. go forth and convert some keys, you're gonna ate. π β¨ππ¦π
π¦ where this page comes from
- arch rolling: bower 1.8.14-3 Β· MIT
- arch rolling: phonegap 9.0.0-3 Β· Apache
- arch rolling: yarn 1.22.22-2 Β· BSD-2-Clause
- epel 10: yarnpkg 1.22.22-18.el10_3 Β· BSD-2-Clause
- epel 9: yarnpkg 1.22.22-18.el9 Β· BSD-2-Clause
- fedora 43: magicmirror-module-airnow 1.0.0^20200824gitefddeb3-7.fc43 Β· Apache-2.0 and BSD and ISC and MIT and Unlicense
- fedora 43: yarnpkg 1.22.22-11.fc43 Β· BSD-2-Clause
- fedora 43: yarnpkg 1.22.22-18.fc43 Β· BSD-2-Clause
- fedora 44: magicmirror-module-airnow 1.0.0^20200824gitefddeb3-8.fc44 Β· Apache-2.0 and BSD and ISC and MIT and Unlicense
- fedora 44: yarnpkg 1.22.22-17.fc44 Β· BSD-2-Clause
- fedora 44: yarnpkg 1.22.22-18.fc44 Β· BSD-2-Clause
- nixos 26.05: aonsoku 0.15.0
- nixos 26.05: ares-cli 3.2.3
- nixos 26.05: codefresh 1.0.6
- nixos 26.05: cypress 14.5.4
- nixos 26.05: draupnir 3.1.0
- nixos 26.05: elm-analyse 0.16.5
- nixos 26.05: emuflight-configurator 0.4.3
- nixos 26.05: epgstation 2.6.20
- nixos 26.05: gancio 1.28.2
- nixos 26.05: gatsby-cli 5.16.0
- nixos 26.05: get-google-fonts 1.2.2-unstable-2020-06-30
- nixos 26.05: hedgedoc 1.11.1
- nixos 26.05: hueadm 1.2.1
- nixos 26.05: hyperpotamus 0.39.0
- nixos 26.05: joplin-cli 3.5.1
- nixos 26.05: jsonplaceholder 0.3.3-unstable-2021-06-14
- nixos 26.05: lemmy-ui 0.19.19
- nixos 26.05: lessc 4.6.6
- nixos 26.05: log4brains 1.1.0
- nixos 26.05: manta 5.4.2
- nixos 26.05: mathjax-node-cli 1.0.1
- nixos 26.05: matrix-appservice-irc 4.0.0
- nixos 26.05: matrix-hookshot 7.6.0
- nixos 26.05: meshcentral 1.2.0
- nixos 26.05: meteor 3.4
- nixos 26.05: misskey 2026.10.0
- nixos 26.05: mjolnir 1.9.2
- nixos 26.05: newman 6.2.2
- nixos 26.05: onlykey 5.5.0
- nixos 26.05: opcua-commander 0.40.0
- nixos 26.05: overseerr 1.34.0
- nixos 26.05: pangolin 1.24.0
- nixos 26.05: particle-cli 3.45.0
- nixos 26.05: peerflix-server 0.6.0
- nixos 26.05: popcorntime 0.5.1
- nixos 26.05: postlight-parser 2.2.3
- nixos 26.05: rsshub 0-unstable-2026-05-14
- nixos 26.05: sharkey 2025.4.7
- nixos 26.05: surge-cli 0.23.1
- nixos 26.05: terminal-stocks 1.0.20
- nixos 26.05: thorium-reader 3.3.0
- nixos 26.05: triton 7.18.0
- nixos 26.05: vega-cli 6.2.0
- nixos 26.05: vsc-leetcode-cli-unstable 2021-04-11
- nixos 26.05: vscode-extension-spywhere-guides 0.9.3
- nixos 26.05: vscode-extension-zxh404-vscode-proto3 0.5.5
- nixos 26.05: wiki-js 2.5.312
- nixos 26.05: wrangler 4.93.0
- nixos 26.05: zotero-translation-server-unstable 2023-07-13
- nixpkgs unstable: aonsoku 0.15.0
- nixpkgs unstable: cdktn-cli 0.24.0
- nixpkgs unstable: codefresh 1.0.6
- nixpkgs unstable: deepseek-harness 0.2.1-rc.3
- nixpkgs unstable: draupnir 3.1.0
- nixpkgs unstable: emuflight-configurator 0.4.3
- nixpkgs unstable: epgstation 2.6.20
- nixpkgs unstable: flame 2.4.0
- nixpkgs unstable: gancio 1.28.2
- nixpkgs unstable: gatsby-cli 5.16.0
- nixpkgs unstable: get-google-fonts 1.2.2-unstable-2020-06-30
- nixpkgs unstable: hedgedoc 1.12.0
- nixpkgs unstable: hueadm 1.2.1
- nixpkgs unstable: hyperpotamus 0.39.0
- nixpkgs unstable: joplin-cli 3.7.1
- nixpkgs unstable: jsonplaceholder 0.3.3-unstable-2021-06-14
- nixpkgs unstable: lemmy-ui 0.19.21
- nixpkgs unstable: log4brains 1.1.0
- nixpkgs unstable: manta 5.4.2
- nixpkgs unstable: mathjax-node-cli 1.0.1
- nixpkgs unstable: matrix-appservice-irc 4.0.1
- nixpkgs unstable: matrix-hookshot 7.6.0
- nixpkgs unstable: meshcentral 1.2.0
- nixpkgs unstable: meteor 3.5.2
- nixpkgs unstable: misskey 2026.10.0
- nixpkgs unstable: mjolnir 1.12.1
- nixpkgs unstable: newman 6.2.3
- nixpkgs unstable: onlykey 5.5.0
- nixpkgs unstable: opcua-commander 0.40.0
- nixpkgs unstable: pangolin 1.24.0
- nixpkgs unstable: particle-cli 3.45.0
- nixpkgs unstable: peerflix-server 0.6.0
- nixpkgs unstable: postlight-parser 2.2.3
- nixpkgs unstable: proton 1.0.1
- nixpkgs unstable: rsshub 2026.10.22-8467.7aaf947
- nixpkgs unstable: surge-cli 0.23.1
- nixpkgs unstable: terminal-stocks 1.0.20
- nixpkgs unstable: triton 7.18.1
- nixpkgs unstable: vsc-leetcode-cli-unstable 2021-04-11
- nixpkgs unstable: vscode-extension-ExiaHuang-dictionary 0.0.2
- nixpkgs unstable: vscode-extension-spywhere-guides 0.9.3
- nixpkgs unstable: vscode-extension-zxh404-vscode-proto3 0.5.5
- nixpkgs unstable: wiki-js 2.5.317
- nixpkgs unstable: zotero-translation-server-unstable 2023-07-13
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms