예제 #1
0
func main() {
	w, _ := armor.Encode(os.Stdout, "PGP MESSAGE", nil)
	plaintext, _ := openpgp.SymmetricallyEncrypt(w, []byte("golang"), nil)
	fmt.Fprintf(plaintext, "Hello from golang.\n")
	plaintext.Close()
	w.Close()
	fmt.Print("\n")
}
예제 #2
0
func NewEncrypter(writer io.WriteCloser, key string) (plaintextWriter io.WriteCloser, err error) {
	return openpgp.SymmetricallyEncrypt(writer, []byte(key), nil, nil)
}