lkgen
is a license generation and validation utility using the lk library as a backend.
It can be used standalone to generate cypto keys, sign and validate license keys.
Install it with the following command :
go install github.com/hyperboloide/lk/lkgen@latest
- Generate a private key file:
lkgen gen --output=./private.key
- Generate a public key to distribute with your app:
lkgen pub ./private.key --output=./pub.key
- Create the licence (here we use json but can be anything...):
echo '{"email":"[email protected]", "until":"2023-10-04"}' > license.tmp
- sign the license:
lkgen sign --input=./license.tmp --output=./license.signed private.key
The file license.signed
is your redistributable license.
- validate the license:
lkgen verify --input=./license.signed ./pub.key
{"email":"[email protected]", "until":"2023-10-04"}
echo $?
0
lkgen --help-long
usage: lkgen [<flags>] <command> [<args> ...]
A command-line utility to generate private keys and licenses.
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
Commands:
help [<command>...]
Show help.
gen [<flags>]
Generates a base32 encoded private key.
-o, --output=OUTPUT Output file (if not defined then stdout).
pub [<flags>] <key>
Get the public key.
-o, --output=OUTPUT Output file (if not defined then stdout).
sign [<flags>] <key>
Creates a license.
-i, --input=INPUT Input data file (if not defined then stdin).
-o, --output=OUTPUT Output file (if not defined then stdout).
verify [<flags>] <key>
Verifies a license.
-i, --input=INPUT Input license file (if not defined then stdin).