Documentation
¶
Overview ¶
Package pgp encrypts, signs, decrypts and verifies OpenPGP messages (RFC 9580, and RFC 4880 for older peers), for payers, clearinghouses and state agencies that exchange files over SFTP or email under PGP.
The cryptography is github.com/ProtonMail/go-crypto, the maintained fork of golang.org/x/crypto/openpgp; nothing here implements a primitive. This package only loads keys and decides what a message must carry.
Index ¶
- func Describe(e *openpgp.Entity) string
- func IsPGP(data []byte) bool
- func KeyID(e *openpgp.Entity) string
- func ParseKeys(b []byte) (openpgp.EntityList, error)
- func ReadKeys(path string) (openpgp.EntityList, error)
- func Seal(data []byte, o SealOptions) ([]byte, error)
- func Unlock(list openpgp.EntityList, passphrase []byte) error
- type OpenOptions
- type Opened
- type SealOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseKeys ¶
func ParseKeys(b []byte) (openpgp.EntityList, error)
ParseKeys reads armored or binary keys.
func ReadKeys ¶
func ReadKeys(path string) (openpgp.EntityList, error)
ReadKeys reads armored or binary keys from a file: a public key ring, a secret key, or several concatenated.
Types ¶
type OpenOptions ¶
type OpenOptions struct {
// Keys are our unlocked secret keys, for decrypting.
Keys openpgp.EntityList
// Verify are the senders' public keys a signature is checked against.
Verify openpgp.EntityList
// RequireSignature refuses a message not signed by one of Verify.
RequireSignature bool
// AllowUnencrypted accepts a message that is signed but not encrypted.
AllowUnencrypted bool
}
OpenOptions says what an incoming message needs.
type Opened ¶
type Opened struct {
Data []byte
FileName string
Encrypted bool
// SignedBy is the verified signer, or "" when the message was not signed by a known key.
SignedBy string
}
Opened is what an incoming message held.
type SealOptions ¶
type SealOptions struct {
// To are the recipients' public keys; the message is readable by any of them.
To openpgp.EntityList
// Signer, when set, signs the message (an unlocked secret key).
Signer *openpgp.Entity
// Armor writes ASCII armor ("-----BEGIN PGP MESSAGE-----") rather than binary.
Armor bool
// FileName is the literal data packet's file name, which some receivers use to name what they decrypt.
FileName string
// Compress compresses before encrypting (ZLIB), as gpg does by default.
Compress bool
}
SealOptions says how to protect an outgoing message.