summaryrefslogtreecommitdiff
path: root/lib/crypto/gpg/gpgbin/keys.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/crypto/gpg/gpgbin/keys.go')
-rw-r--r--lib/crypto/gpg/gpgbin/keys.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/crypto/gpg/gpgbin/keys.go b/lib/crypto/gpg/gpgbin/keys.go
new file mode 100644
index 0000000..660ce82
--- /dev/null
+++ b/lib/crypto/gpg/gpgbin/keys.go
@@ -0,0 +1,13 @@
+package gpgbin
+
+import "fmt"
+
+// GetPrivateKeyId runs gpg --list-secret-keys s
+func GetPrivateKeyId(s string) (string, error) {
+ private := true
+ id := getKeyId(s, private)
+ if id == "" {
+ return "", fmt.Errorf("no private key found")
+ }
+ return id, nil
+}