Last active
August 29, 2023 07:22
-
-
Save xkr47/920ffe94f6a4c171ee59 to your computer and use it in GitHub Desktop.
How to use Letsencrypt certificate & private key with Jetty
This file contains 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
# input: fullchain.pem and privkey.pem as generated by the "letsencrypt-auto" script when run with | |
# the "auth" aka "certonly" subcommand | |
# convert certificate chain + private key to the PKCS#12 file format | |
openssl pkcs12 -export -out keystore.pkcs12 -in fullchain.pem -inkey privkey.pem | |
# convert PKCS#12 file into Java keystore format | |
keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks | |
# don't need the PKCS#12 file anymore | |
rm keystore.pkcs12 | |
# Now use "keystore.jks" as keystore in jetty with the keystore password you specfied when you ran | |
# the "keytool" command |
Omg thanks everybody for your nice comments, glad it was of help! :)
16 forks & 56 stars 😲
Thanks @juleskers — yeah things have definately improved a lot since the letsencrypt snowballing started :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Indeed, this is a feature of modern JDKs; they have deprecated the proprietary JKS-format in favour of PKCS12, so you can use the PKCS12 output from the openssl-step directly.
You can recognise this from your Keytool output; Your Java can handle PKCS12 keystores if your keytool shows the warning: