Skip to content

Commit

Permalink
Check all signing subkeys when verifying identity
Browse files Browse the repository at this point in the history
Fixes C3S#11.
  • Loading branch information
garrettr committed Jan 22, 2016
1 parent b28acb6 commit b67af0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/pgpkey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ def public_key
def metadata
GPGME::Key.get(self.fpr).to_s
end

def subkeys
GPGME::Key.get(self.fpr).subkeys
end
end
5 changes: 4 additions & 1 deletion lib/decrypt_mails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def receive_with_encryption(email, options={})
user = User.find_by_mail sender_email if sender_email.present?
key = Pgpkey.find_by user_id: user.id
signatures.each do |s|
valid = true if key.fpr == s.fpr
key.subkeys.each do |subkey|
valid = true if subkey.capability.include? :sign and \
subkey.fpr == s.fpr
end
end if not signatures.empty?
end

Expand Down

0 comments on commit b67af0e

Please sign in to comment.