# File lib/gpgr.rb, line 160 def self.installed_public_keys keys = [] email_regexp = /\<(.*@.*)\>/ # Select the output to grep for, which is different depending on the version # of GPG installed. This is tested on 1.4 and 2.1. # if `#{Gpgr.command} --version | grep GnuPG`.include?('1.') grep_for = 'pub' else grep_for = 'uid' end `#{Gpgr.command} --list-public-keys --with-colons | grep #{grep_for}`.split("\n").each do |key| keys << email_regexp.match(key)[1].upcase end keys.uniq end