Skip to content

Instantly share code, notes, and snippets.

@salex89
salex89 / key_and_certificate_conversions.sh
Last active May 4, 2024 08:31
Different private/public key conversions GnuPG, OpenSSH and OpenSSL
# Source: http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# OpenSSH private keys are directly understable by OpenSSL. You can test for example:
openssl rsa -in ~/.ssh/id_rsa -text
openssl dsa -in ~/.ssh/id_dsa -text
# So, you can directly use it to create a certification request:
openssl req -new -key ~/.ssh/id_dsa -out myid.csr
# You can also use your ssh key to create a sef-signed certificate: