class GPGME::GpgmeSignature

Attributes

fingerprint[R]
fpr[R]
notations[R]
pka_address[R]
pka_trust[R]
status[R]
summary[R]
validity[R]
validity_reason[R]
wrong_key_usage[R]

Public Instance Methods

bad?() click to toggle source
# File lib/gpgme/signature.rb, line 28
def bad?
  status_code == GPGME::GPG_ERR_BAD_SIGNATURE
end
exp_timestamp() click to toggle source
# File lib/gpgme/signature.rb, line 64
def exp_timestamp
  Time.at(@exp_timestamp)
end
expired_key?() click to toggle source
# File lib/gpgme/signature.rb, line 20
def expired_key?
  status_code == GPGME::GPG_ERR_KEY_EXPIRED
end
expired_signature?() click to toggle source
# File lib/gpgme/signature.rb, line 16
def expired_signature?
  status_code == GPGME::GPG_ERR_SIG_EXPIRED
end
from() click to toggle source
# File lib/gpgme/signature.rb, line 40
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
key() click to toggle source
# File lib/gpgme/signature.rb, line 52
def key
  @key ||= begin
    Ctx.new do |ctx|
      @key = ctx.get_key(fingerprint)
    end
  end
end
no_key?() click to toggle source
# File lib/gpgme/signature.rb, line 32
def no_key?
  status_code == GPGME::GPG_ERR_NO_PUBKEY
end
revoked_key?() click to toggle source
# File lib/gpgme/signature.rb, line 24
def revoked_key?
  status_code == GPGME::GPG_ERR_CERT_REVOKED
end
status_code() click to toggle source
# File lib/gpgme/signature.rb, line 36
def status_code
  GPGME::gpgme_err_code(status)
end
timestamp() click to toggle source
# File lib/gpgme/signature.rb, line 60
def timestamp
  Time.at(@timestamp)
end
to_s() click to toggle source
# File lib/gpgme/signature.rb, line 68
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
valid?() click to toggle source

Returns true if the signature is correct

# File lib/gpgme/signature.rb, line 12
def valid?
  status_code == GPGME::GPG_ERR_NO_ERROR
end