Last active
June 9, 2023 00:04
-
-
Save ppdouble/bc12355dde9e815c77c4d8785b0df045 to your computer and use it in GitHub Desktop.
generate 2048 bits rsa public private key pair for jwt token
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jwtkey=/home/jwt/sign/keys | |
mkdir -p $jwtkey | |
openssl genrsa -out $jwtkey/rsa-prv.pem 2048 | |
openssl rsa -in $jwtkey/rsa-prv.pem -pubout > $jwtkey/rsa-pub.pem | |
# OpenSSL `1.0.2k-fips on 26 Jan 2017` on `CentOS Linux release 7.9.2009 (Core)` gives pkcs#1 with -----BEGIN RSA PRIVATE KEY----- | |
# OpenSSL `3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)` on `Fedora release 38 (Thirty Eight)` gives pkcs#8 with -----BEGIN PRIVATE KEY----- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/nghiaht/224f7fe04ea591c6d2fddbee6c173379
openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -pubout -in private.pem -out public_key.pem
The commands give pkcs#8 both with openssl 1.0.2 and openssl 3.0.8.