Open cyphar opened 6 years ago
This is caused by passing in a mutable reference to plain. The mutable reference is turned into a write-only Data
wrapper by IntoData while gpgme expects a readable object. This can be fixed by passing an immutable reference to plain or by passing plain directly:
gpg_context.encrypt(Some(&recipient_key), &plain, &mut cipher).expect("encrypt");
or
gpg_context.encrypt(Some(&recipient_key), plain, &mut cipher).expect("encrypt");
Okay, I believe this documentation example should be updated since that's what I based my code off of. Would you like a PR to update that?
If you try to encrypt some data with
gpgme::encrypt
I always seem to get the following error:Here's a minimal snippet of Rust code which will reproduce this.
I've double checked that the equivalent Assam commands operate correctly:
And here is the
gpgme-error
information about the error code: