class GPGME::Signature
def bad?
def bad? status_code == GPGME::GPG_ERR_BAD_SIGNATURE end
def exp_timestamp
def exp_timestamp Time.at(@exp_timestamp) end
def expired_key?
def expired_key? status_code == GPGME::GPG_ERR_KEY_EXPIRED end
def expired_signature?
def expired_signature? status_code == GPGME::GPG_ERR_SIG_EXPIRED end
def from
def from @from ||= begin Ctx.new do |ctx| if from_key = ctx.get_key(fingerprint) "#{from_key.subkeys[0].keyid} #{from_key.uids[0].uid}" else fingerprint end end end end
def key
def key @key ||= begin Ctx.new do |ctx| @key = ctx.get_key(fingerprint) end end end
def no_key?
def no_key? status_code == GPGME::GPG_ERR_NO_PUBKEY end
def revoked_key?
def revoked_key? status_code == GPGME::GPG_ERR_CERT_REVOKED end
def status_code
def status_code GPGME::gpgme_err_code(status) end
def timestamp
def timestamp Time.at(@timestamp) end
def to_s
def to_s case status_code when GPGME::GPG_ERR_NO_ERROR "Good signature from #{from}" when GPGME::GPG_ERR_SIG_EXPIRED "Expired signature from #{from}" when GPGME::GPG_ERR_KEY_EXPIRED "Signature made from expired key #{from}" when GPGME::GPG_ERR_CERT_REVOKED "Signature made from revoked key #{from}" when GPGME::GPG_ERR_BAD_SIGNATURE "Bad signature from #{from}" when GPGME::GPG_ERR_NO_PUBKEY "No public key for #{from}" end end
def valid?
#
def valid? status_code == GPGME::GPG_ERR_NO_ERROR end