ueno/ruby-gpgme

Verification with provided passphrase fails if no encryption have been performed.

Opened this issue · 0 comments

This code works:

crypto = GPGME::Crypto.new(password: "12345", pinentry_mode: GPGME::PINENTRY_MODE_LOOPBACK)
dat = crypto.encrypt("Hello", sign: true, recipients: "example@example.com"
crypto.decrypt(dat)

After running this, the following code also works:

crypto = GPGME::Crypto.new(password: "12345", pinentry_mode: GPGME::PINENTRY_MODE_LOOPBACK)
crypto.verify(dat)

But if you kill gpg-agent it no longer works and instead returns empty string. To make it work, you need to 'reinitialize' gpg-agent by running encryption.

.decrypt is not affected by this.