Documentation ¶
Overview ¶
Package gpgeez is a wrapper around golang.org/x/crypto/openpgp
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { packet.Config // Expiry is the duration that the generated key will be valid for. Expiry time.Duration }
Config for generating keys.
type Key ¶
Key represents an OpenPGP key.
func CreateKey ¶
CreateKey creates an OpenPGP key which is similar to running gpg --gen-key on the command line. In other words, this method returns a primary signing key and an encryption subkey with expected self-signatures.
There are a few differences:
• GnuPG sets key server preference to 0x80, no-modify (see https://tools.ietf.org/html/rfc4880#section-5.2.3.17).
• GnuPG sets features to 0x01, modification detection (see https://tools.ietf.org/html/rfc4880#page-36).
• GnuPG sets the digest algorithm to SHA1. Go defaults to SHA256.
• GnuPG includes Bzip2 as a compression method. Go currently doesn't support Bzip2, so that option isn't set.
• Issuer key ID is hashed subpkt instead of subpkt, and contains a primary user ID sub packet.
You can see these differences for yourself by comparing the output of:
go run example/create_key.go | gpg --homedir /tmp --list-packets
with:
gpg --homedir /tmp --gen-key gpg --homedir /tmp -a --export | gpg --homedir /tmp --list-packets
Or just look at https://github.com/alokmenghrajani/gpgeez/blob/master/gpgeez_test.pl
Some useful links: https://godoc.org/golang.org/x/crypto/openpgp, https://davesteele.github.io/gpg/2014/09/20/anatomy-of-a-gpg-key, https://github.com/golang/go/issues/12153
func (*Key) ArmorPrivate ¶
ArmorPrivate returns the private part of a key in armored format.
Note: if you want to protect the string against varous low-level attacks, you should look at https://github.com/stouset/go.secrets and https://github.com/worr/secstring and then re-implement this function.