Created
June 27, 2018 09:03
-
-
Save realduke2000/b17c00e20ab061be947e03481a26c224 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# https://raymii.org/s/tutorials/Encrypt_and_decrypt_files_to_public_keys_via_the_OpenSSL_Command_Line.html | |
# Get the public key | |
openssl rsa -in certificate.pem -out publickey.pem -outform PEM -pubout | |
# Generate the random password file | |
openssl rand -base64 128 -out key.bin | |
# Encrypt the random key with the public keyfile | |
openssl rsautl -encrypt -inkey publickey.pem -pubin -in key.bin -out key.bin.enc | |
# Decrypt the random key with our private key file | |
openssl rsautl -decrypt -inkey privatekey.pem -in key.bin.enc -out key.bin | |
# Get private key | |
openssl rsa -check -in authservice-ca.key.pem | |
# View cert | |
openssl rsa -in authservice-ca.key.pem -check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment