Created
August 2, 2022 09:06
-
-
Save WanLinLin/fb529bd63ccad6363a4c8bd4cf0bee82 to your computer and use it in GitHub Desktop.
get keys in CI
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
### in local ### | |
# gen private key | |
openssl genrsa -aes128 -out private.pem 4096 | |
# gen public key from private key | |
openssl rsa -in private.pem -pubout > public.pem | |
### in CI ### | |
# setup the $PUB secret in the CI platform settings, create public key in CI steps | |
echo "$PUB" > public.pem | |
touch msg | |
printenv KEY_YOU_WANT_1 >> msg | |
printenv KEY_YOU_WANT_2 >> msg | |
# copy the output in the CI console | |
openssl rsautl -encrypt -inkey public.pem -pubin -in msg | base64 | |
### in local ### | |
# paste the clipboard to "in" file, decrypt it to "out" file | |
cat in | base64 -d | openssl rsautl -decrypt -inkey private.pem > out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment