Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-06-13 14:46:43 +0300
committerAlexis Reigel <mail@koffeinfrei.org>2017-07-27 16:42:53 +0300
commit3c42d730986222d891c9b7985edf3942021afcef (patch)
tree4631a62e7cbfba445e8cf6b89f9b5e6582aa4cc3 /lib/gitlab/gpg.rb
parent7e13d96715750f74db399bf40ee4ec9679bbe806 (diff)
add primary keyid attribute to gpg keys
Diffstat (limited to 'lib/gitlab/gpg.rb')
-rw-r--r--lib/gitlab/gpg.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/gitlab/gpg.rb b/lib/gitlab/gpg.rb
index 384a9138fa1..486e040adb6 100644
--- a/lib/gitlab/gpg.rb
+++ b/lib/gitlab/gpg.rb
@@ -12,6 +12,18 @@ module Gitlab
end
end
+ def primary_keyids_from_key(key)
+ using_tmp_keychain do
+ import = GPGME::Key.import(key)
+
+ return [] if import.imported == 0
+
+ fingerprints = import.imports.map(&:fingerprint)
+
+ GPGME::Key.find(:public, fingerprints).map { |raw_key| raw_key.primary_subkey.keyid }
+ end
+ end
+
def emails_from_key(key)
using_tmp_keychain do
import = GPGME::Key.import(key)