I've been trying to encrypt docx
file using GPG public key and go's openpgp
library. It encrypts document but then I am unable to decrypt it using my private key.
Already tried to do the same with plain text file and decryption worked without any problems.
What am I missing here?
package main
import (
"golang.org/x/crypto/openpgp"
"bytes"
"io/ioutil"
"fmt"
"os"
)
func main() {
entitylist, _ := openpgp.ReadArmoredKeyRing(bytes.NewBufferString(...))
buf := new(bytes.Buffer)
w, _ := openpgp.Encrypt(buf, entitylist, nil, nil, nil)
b, _ := ioutil.ReadFile("in.docx")
w.Write(b)
w.Close()
bts, _ := ioutil.ReadAll(buf)
ioutil.WriteFile("out.gpg", bts, os.ModePerm)
}