Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 1.17 KB

File metadata and controls

28 lines (21 loc) · 1.17 KB

PEM Format

PEM format is Privacy Enhanced Mail. You probably know it to look like files with content like:

-----BEGIN <CRYPTOGRAPHIC TYPE>-----
...base64 encoded binary data...
-----END <CRYPTOGRAPHIC TYPE>-----

Generate RSA Key pairs

openssl genrsa -out private_key.pem 2048
openssl rsa -in private_key.pem -pubout -out public_key.pem

Trim key to single line

export PRIVATE_KEY=$(cat private_key.pem | sed '/-----BEGIN .*-----/d;/-----END .*-----/d' | tr -d '\n')
export PUBLIC_KEY=$(cat public_key.pem | sed '/-----BEGIN .*-----/d;/-----END .*-----/d' | tr -d '\n')