1
0
mirror of https://github.com/jakeswenson/BitBetter.git synced 2023-10-10 13:36:57 +02:00
BitBetter/.keys/generate-keys.sh
Jeff Alyanak 05543b5b8a
Added a Key Generating script
To make the keygen process a bit easier I've added a `generate-keys.sh` script that can be found in the `.keys` directory. It will generate the key & cert and bundle them into the required pkcs#12 file.

I've updated the readme to include instructions on the script.
2019-05-11 15:45:03 -04:00

16 lines
591 B
Bash
Executable File

#!/bin/sh
# Check for openssl
command -v openssl >/dev/null 2>&1 || { echo >&2 "openssl required but not found. Aborting."; exit 1; }
# Remove any existing key files
[ ! -e cert.pem ] || rm cert.pem
[ ! -e key.pem ] || rm key.pem
[ ! -e cert.cert ] || rm cert.cert
[ ! -e cert.pfx ] || rm cert.pfx
# Generate new keys
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.cert -days 36500 -outform DER -passout pass:test
openssl x509 -inform DER -in cert.cert -out cert.pem
openssl pkcs12 -export -out cert.pfx -inkey key.pem -in cert.pem -passin pass:test -passout pass:test