func encryptPGP(plaintext []byte, key *openpgp.Entity) ([]byte, error) {
	crypted := bytes.Buffer{}
	out, err := openpgp.Encrypt(&crypted, []*openpgp.Entity{key}, nil, nil, nil)
	if err != nil {
		return nil, err
	}
	out.Write([]byte(plaintext))
	out.Close()
	return crypted.Bytes(), nil
}
Encrypt plaintext using the given key
package main
import (
	"bytes"
	"golang.org/x/crypto/openpgp"
	"golang.org/x/crypto/openpgp/armor"
)
const (
	pgpMessageType = "PGP MESSAGE"
)