Class: GPGME::Signature
- Inherits:
-
Object
- Object
- GPGME::Signature
- Defined in:
- lib/gpgme/signature.rb,
ext/gpgme/gpgme_n.c
Instance Attribute Summary collapse
-
#fpr ⇒ Object
(also: #fingerprint)
readonly
Returns the value of attribute fpr.
-
#notations ⇒ Object
readonly
Returns the value of attribute notations.
-
#pka_address ⇒ Object
readonly
Returns the value of attribute pka_address.
-
#pka_trust ⇒ Object
readonly
Returns the value of attribute pka_trust.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#validity ⇒ Object
readonly
Returns the value of attribute validity.
-
#validity_reason ⇒ Object
readonly
Returns the value of attribute validity_reason.
-
#wrong_key_usage ⇒ Object
readonly
Returns the value of attribute wrong_key_usage.
Instance Method Summary collapse
- #bad? ⇒ Boolean
- #exp_timestamp ⇒ Object
- #expired_key? ⇒ Boolean
- #expired_signature? ⇒ Boolean
- #from ⇒ Object
- #key ⇒ Object
- #no_key? ⇒ Boolean
- #revoked_key? ⇒ Boolean
- #status_code ⇒ Object
- #timestamp ⇒ Object
- #to_s ⇒ Object
-
#valid? ⇒ Boolean
Returns true if the signature is correct.
Instance Attribute Details
#fpr ⇒ Object (readonly) Also known as: fingerprint
Returns the value of attribute fpr.
5 6 7 |
# File 'lib/gpgme/signature.rb', line 5 def fpr @fpr end |
#notations ⇒ Object (readonly)
Returns the value of attribute notations.
5 6 7 |
# File 'lib/gpgme/signature.rb', line 5 def notations @notations end |
#pka_address ⇒ Object (readonly)
Returns the value of attribute pka_address.
7 8 9 |
# File 'lib/gpgme/signature.rb', line 7 def pka_address @pka_address end |
#pka_trust ⇒ Object (readonly)
Returns the value of attribute pka_trust.
7 8 9 |
# File 'lib/gpgme/signature.rb', line 7 def pka_trust @pka_trust end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/gpgme/signature.rb', line 5 def status @status end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
5 6 7 |
# File 'lib/gpgme/signature.rb', line 5 def summary @summary end |
#validity ⇒ Object (readonly)
Returns the value of attribute validity.
6 7 8 |
# File 'lib/gpgme/signature.rb', line 6 def validity @validity end |
#validity_reason ⇒ Object (readonly)
Returns the value of attribute validity_reason.
6 7 8 |
# File 'lib/gpgme/signature.rb', line 6 def validity_reason @validity_reason end |
#wrong_key_usage ⇒ Object (readonly)
Returns the value of attribute wrong_key_usage.
5 6 7 |
# File 'lib/gpgme/signature.rb', line 5 def wrong_key_usage @wrong_key_usage end |
Instance Method Details
#bad? ⇒ Boolean
28 29 30 |
# File 'lib/gpgme/signature.rb', line 28 def bad? status_code == GPGME::GPG_ERR_BAD_SIGNATURE end |
#exp_timestamp ⇒ Object
64 65 66 |
# File 'lib/gpgme/signature.rb', line 64 def Time.at(@exp_timestamp) end |
#expired_key? ⇒ Boolean
20 21 22 |
# File 'lib/gpgme/signature.rb', line 20 def expired_key? status_code == GPGME::GPG_ERR_KEY_EXPIRED end |
#expired_signature? ⇒ Boolean
16 17 18 |
# File 'lib/gpgme/signature.rb', line 16 def expired_signature? status_code == GPGME::GPG_ERR_SIG_EXPIRED end |
#from ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# 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 ⇒ Object
52 53 54 55 56 57 58 |
# 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? ⇒ Boolean
32 33 34 |
# File 'lib/gpgme/signature.rb', line 32 def no_key? status_code == GPGME::GPG_ERR_NO_PUBKEY end |
#revoked_key? ⇒ Boolean
24 25 26 |
# File 'lib/gpgme/signature.rb', line 24 def revoked_key? status_code == GPGME::GPG_ERR_CERT_REVOKED end |
#status_code ⇒ Object
36 37 38 |
# File 'lib/gpgme/signature.rb', line 36 def status_code GPGME::gpgme_err_code(status) end |
#timestamp ⇒ Object
60 61 62 |
# File 'lib/gpgme/signature.rb', line 60 def Time.at(@timestamp) end |
#to_s ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# 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? ⇒ Boolean
Returns true if the signature is correct
12 13 14 |
# File 'lib/gpgme/signature.rb', line 12 def valid? status_code == GPGME::GPG_ERR_NO_ERROR end |