gogpg
Simplified GPG encryption using golang
Generating GPG keys
-
List all available keys
gpg --list-keys
-
Create a new key
The adviced configuration is:
Question |
Answer |
kind of key |
(1) RSA and RSA (default) |
keysize |
4096 |
*validity |
0 = key does not expire (for staging) |
*validity should be specified for production.
gpg --full-generate-key
-
Export the keys
gpg --armor --output <uid>.gpg.pub --export <uid>
gpg --armor --output <uid>.gpg.pvt --export-secret-keys <uid>
Installation
import "github.com/reddotpay/gogpg"
Usage
func Decrypt
func Decrypt(secretkey io.Reader, passphrase string, text []byte) ([]byte, error)
Decrypt decrypts the message using secret key file and a passphrase
func Encrypt
func Encrypt(publickey io.Reader, text []byte) ([]byte, error)
Encrypt encrypts the message using the public key file