aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/gpg/reader.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2024-08-06 22:37:29 +0200
committerRobin Jarry <robin@jarry.cc>2024-10-12 00:12:29 +0200
commit4b25d04509371664883e344aaa9fbf2f403529f3 (patch)
treebfcf17a16c01c924b53cd93a8c91bb63a113d18b /lib/crypto/gpg/reader.go
parent163ea3ec7d2af3bac1afe6489071a8a286f282b8 (diff)
downloadaerc-4b25d04509371664883e344aaa9fbf2f403529f3.tar.gz
crypto: add pinentry support to gpg
Add pinentry support to GPG for signing, enrypting and decrypting messages. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/crypto/gpg/reader.go')
-rw-r--r--lib/crypto/gpg/reader.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/crypto/gpg/reader.go b/lib/crypto/gpg/reader.go
index 07553c97..77022962 100644
--- a/lib/crypto/gpg/reader.go
+++ b/lib/crypto/gpg/reader.go
@@ -12,6 +12,7 @@ import (
"strings"
"git.sr.ht/~rjarry/aerc/lib/crypto/gpg/gpgbin"
+ "git.sr.ht/~rjarry/aerc/lib/pinentry"
"git.sr.ht/~rjarry/aerc/models"
"github.com/emersion/go-message/textproto"
)
@@ -92,6 +93,9 @@ func newEncryptedReader(h textproto.Header, mr *textproto.MultipartReader) (*Rea
return nil, fmt.Errorf("gpgmail: second part in multipart/encrypted message has type %q, not application/octet-stream", t)
}
+ pinentry.Enable()
+ defer pinentry.Disable()
+
md, err := gpgbin.Decrypt(p)
if err != nil {
return nil, fmt.Errorf("gpgmail: failed to read PGP message: %w", err)