There is only a small change I had to do to get it to encrypt and decrypt:

inside your encryptMessage() func, change:

_, err = encryptorWriter.Write([]byte(message))
//messageReader := bytes.NewReader([]byte(message))
//_, err = io.Copy(encoderWriter, messageReader)

using the Write() method vs io.Copy works

Also, you don't need the chunk about the private key in the encrypt function

Updated playground link

https://play.golang.org/p/HpXdDlKcOPt

Thanks

Diego



On Tuesday, August 18, 2020 at 1:00:50 PM UTC-4 srlor...@gmail.com wrote:

> Hi,
>
>
> i have been trying to decrypt and encrypt ASCII armor PGP Messages that i 
> receive and send to a API.
>
>
> I Wrote a function for decrypting messages and another one for encrypting 
> messages. The Decrypting function Works and i can decrypt the API's 
> messages. But My encrypt function Seems to be broken as Neither the API or 
> my decrypt function can decrypt the Messages encrypted by my encrypt 
> function.
>
>
> Decrypting the encrypted messages from my encrypt function always result 
> in the following error: 
>
> "Error reading message: openpgp: unsupported feature: unknown 
> SymmetricallyEncrypted version"
>
>
> I have uploaded a example to the Go Play Ground : 
> https://play.golang.org/p/JhhZ4xWWYvn
>
>
> Any help is Appreciated.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6dc18bc2-5d0d-4e40-b6a9-b073d5acde3an%40googlegroups.com.

Reply via email to