aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/gpg/gpg.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-04-29 11:19:52 -0500
committerRobin Jarry <robin@jarry.cc>2022-05-04 14:07:15 +0200
commitdbf52bb4b48748586bb6343ae4ad6d424f0631ac (patch)
treebd806636b0be51f07218f5a9db9be45af72db9ba /lib/crypto/gpg/gpg.go
parentb29293d7b53c73629911ec75b2ec5954d365feed (diff)
downloadaerc-dbf52bb4b48748586bb6343ae4ad6d424f0631ac.tar.gz
pgp: check for signing key before signing time
Check that the signing key exists when the user issues the :sign command. The signing key ID will be displayed in the security status also, allowing the user to see what key will be used to sign the message. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Jens Grassel <jens@wegtam.com>
Diffstat (limited to 'lib/crypto/gpg/gpg.go')
-rw-r--r--lib/crypto/gpg/gpg.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/crypto/gpg/gpg.go b/lib/crypto/gpg/gpg.go
index 66cd3725..457788dc 100644
--- a/lib/crypto/gpg/gpg.go
+++ b/lib/crypto/gpg/gpg.go
@@ -51,6 +51,10 @@ func (m *Mail) Sign(buf *bytes.Buffer, signer string, decryptKeys openpgp.Prompt
func (m *Mail) Close() {}
+func (m *Mail) GetSignerKeyId(s string) (string, error) {
+ return gpgbin.GetPrivateKeyId(s)
+}
+
func handleSignatureError(e string) models.SignatureValidity {
if e == "gpg: missing public key" {
return models.UnknownEntity