sshpk-conv (1) - Linux Manuals
sshpk-conv: convert between key formats
NAME
sshpk-conv - convert between key formats
SYNOPSYS
sshpk-conv -t FORMAT [FILENAME] [OPTIONS...]
sshpk-conv -i [FILENAME] [OPTIONS...]
DESCRIPTION
Reads in a public or private key and converts it between different formats, particularly formats used in the SSH protocol and the well-known PEM PKCS#1/7 formats.
In the second form, with the -i option given, identifies a key and prints to stderr information about its nature, size and fingerprint.
EXAMPLES
Assume the following SSH-format public key in id_ecdsa.pub:
-
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTI...9M/4c4= user [at] host
Identify it with -i:
-
$ sshpk-conv -i id_ecdsa.pub id_ecdsa: a 256 bit ECDSA public key ECDSA curve: nistp256 Comment: user [at] 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
-p, --private
-f PATH, --file=PATH
-o PATH, --out=PATH
-T FORMAT, --informat=FORMAT
-t FORMAT, --outformat=FORMAT
-c TEXT, --comment=TEXT
Currently supported formats:
pem, pkcs1
ssh
pkcs8
openssh
rfc4253
Encrypted (password-protected) keys are not supported.
Report bugs at Github https://github.com/arekinath/node-sshpk/issues
ssh-keygen(1), openssl(1)
FORMATS
BUGS
SEE ALSO