module GPGME::KeyCommon
def capability
Array of capabilities for this key. It can contain any combination of
#
def capability caps = [] caps << :encrypt if @can_encrypt == 1 caps << :sign if @can_sign == 1 caps << :certify if @can_certify == 1 caps << :authenticate if @can_authenticate == 1 caps end
def secret?
def secret? @secret == 1 end
def trust
Returns nil if the trust is valid.
#
def trust return :revoked if @revoked == 1 return :expired if @expired == 1 return :disabled if @disabled == 1 return :invalid if @invalid == 1 end
def usable_for?(purposes)
is passed then will return true.
Checks if the key is capable of all of these actions. If empty array
#
def usable_for?(purposes) unless purposes.kind_of? Array purposes = [purposes] end return false if [:revoked, :expired, :disabled, :invalid].include? trust return (purposes - capability).empty? end