Documentation ¶
Overview ¶
Package keypairs handles the public-private keypairs defined for your apps that are used to sign your license data to create license keys. Keypairs are used to sign your data for authenticity purposes. The private key should never leave this app while the public key can be exported for placement in your app's code.
Index ¶
- func Add(w http.ResponseWriter, r *http.Request)
- func DecryptPrivateKey(encryptionKey string, encryptedPrivateKey []byte) (unecryptedPrivKey []byte, err error)
- func Default(w http.ResponseWriter, r *http.Request)
- func Delete(w http.ResponseWriter, r *http.Request)
- func Get(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add(w http.ResponseWriter, r *http.Request)
Add saves a new keypair. The keypair data provided is used to generate a new keypair which is then saved to the database.
func DecryptPrivateKey ¶
func DecryptPrivateKey(encryptionKey string, encryptedPrivateKey []byte) (unecryptedPrivKey []byte, err error)
DecryptPrivateKey decrypts the private key stored in the database using the encryption key provided in the config file. This returns a []byte since the input unencrypted data is also a []byte; we just keep the type the same for ease of use elsewhere.
The encryption key must be 16, 24, or 32 characters long. The encryptionKey is a string since that is how it is stored in the config file and we can handle the conversion inside this func as needed.
This func is only used when signing a newly created license file. Once a license key file has been created, the signature is stored in the db and we just retrieve it when a license key file needs to be downloaded.
func Default ¶
func Default(w http.ResponseWriter, r *http.Request)
Default marks a keypair as the default for the app. This marks all other keypairs for this app as non-default.
Types ¶
This section is empty.