Class: GPGME::SubKey
- Inherits:
-
Object
show all
- Includes:
- KeyCommon
- Defined in:
- lib/gpgme/sub_key.rb,
ext/gpgme/gpgme_n.c
Constant Summary
collapse
- PUBKEY_ALGO_LETTERS =
{
PK_RSA => "R",
PK_ELG_E => "g",
PK_ELG => "G",
PK_DSA => "D"
}
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from KeyCommon
#capability, #secret?, #trust, #usable_for?
Instance Attribute Details
#fpr ⇒ Object
Also known as:
fingerprint
Returns the value of attribute fpr.
5
6
7
|
# File 'lib/gpgme/sub_key.rb', line 5
def fpr
@fpr
end
|
#keyid ⇒ Object
Returns the value of attribute keyid.
5
6
7
|
# File 'lib/gpgme/sub_key.rb', line 5
def keyid
@keyid
end
|
#length ⇒ Object
Returns the value of attribute length.
5
6
7
|
# File 'lib/gpgme/sub_key.rb', line 5
def length
@length
end
|
#pubkey_algo ⇒ Object
Returns the value of attribute pubkey_algo.
5
6
7
|
# File 'lib/gpgme/sub_key.rb', line 5
def pubkey_algo
@pubkey_algo
end
|
Instance Method Details
#expired ⇒ Object
18
19
20
21
|
# File 'lib/gpgme/sub_key.rb', line 18
def expired
return false if @expires == 0
@expires < Time.now.to_i
end
|
#expires ⇒ Object
14
15
16
|
# File 'lib/gpgme/sub_key.rb', line 14
def expires
Time.at(@expires)
end
|
#inspect ⇒ Object
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/gpgme/sub_key.rb', line 38
def inspect
sprintf("#<#{self.class} %s %4d%s/%s %s trust=%s, capability=%s>",
secret? ? 'ssc' : 'sub',
length,
pubkey_algo_letter,
(@fingerprint || @keyid)[-8 .. -1],
timestamp.strftime('%Y-%m-%d'),
trust.inspect,
capability.inspect)
end
|
#pubkey_algo_letter ⇒ Object
34
35
36
|
# File 'lib/gpgme/sub_key.rb', line 34
def pubkey_algo_letter
PUBKEY_ALGO_LETTERS[@pubkey_algo] || "?"
end
|
#sha ⇒ Object
23
24
25
|
# File 'lib/gpgme/sub_key.rb', line 23
def sha
(@fingerprint || @keyid)[-8 .. -1]
end
|
#timestamp ⇒ Object
10
11
12
|
# File 'lib/gpgme/sub_key.rb', line 10
def timestamp
Time.at(@timestamp)
end
|
#to_s ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/gpgme/sub_key.rb', line 49
def to_s
sprintf("%s %4d%s/%s %s\n",
secret? ? 'ssc' : 'sub',
length,
pubkey_algo_letter,
(@fingerprint || @keyid)[-8 .. -1],
timestamp.strftime('%Y-%m-%d'))
end
|