From 05543b5b8af809629be11bc5c48929bec243c8e1 Mon Sep 17 00:00:00 2001 From: Jeff Alyanak Date: Sat, 11 May 2019 15:45:03 -0400 Subject: [PATCH] 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. --- .keys/Empty.txt | 1 - .keys/generate-keys.sh | 15 +++++++++++++++ README.md | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) delete mode 100644 .keys/Empty.txt create mode 100755 .keys/generate-keys.sh diff --git a/.keys/Empty.txt b/.keys/Empty.txt deleted file mode 100644 index 031e408..0000000 --- a/.keys/Empty.txt +++ /dev/null @@ -1 +0,0 @@ -Need an empty folder diff --git a/.keys/generate-keys.sh b/.keys/generate-keys.sh new file mode 100755 index 0000000..7e91e67 --- /dev/null +++ b/.keys/generate-keys.sh @@ -0,0 +1,15 @@ +#!/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 diff --git a/README.md b/README.md index 346749e..282dcd4 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ If you want to be able to sign your own licenses obviously you'll have to replac ### Signing licesnses -There is a tool included to generate a license (see `src/liceseGen/`) +To sign your own license you first need to generate your own singing cert using the `.keys/generate-keys.sh` script. Running this script will prompt you to enter some information about your new certificate, you may leave these at the defaults or set them to your preference. The script will then create a pkcs12 file (.pfx) containing your new key/cert. -generate a PFX above using a password of `test` and then build the tool using: +There is a tool included to generate a license (see `src/liceseGen/`), build it using: ```bash ./src/licenseGen/build.sh