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
28
29
30
|
# File 'lib/gpgme/sub_key.rb', line 28
def expired
expires? && @expires < Time.now.to_i
end
|
#expires ⇒ Object
24
25
26
|
# File 'lib/gpgme/sub_key.rb', line 24
def expires
expires? ? Time.at(@expires) : nil
end
|
#expires? ⇒ Boolean
20
21
22
|
# File 'lib/gpgme/sub_key.rb', line 20
def expires?
@expires != 0
end
|
#inspect ⇒ Object
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/gpgme/sub_key.rb', line 47
def inspect
sprintf("#<#{self.class} %s %4d%s/%s %s trust=%s, capability=%s>",
secret? ? 'ssc' : 'sub',
length,
pubkey_algo_letter,
(@fpr || @keyid)[-8 .. -1],
timestamp.strftime('%Y-%m-%d'),
trust.inspect,
capability.inspect)
end
|
#pubkey_algo_letter ⇒ Object
43
44
45
|
# File 'lib/gpgme/sub_key.rb', line 43
def pubkey_algo_letter
PUBKEY_ALGO_LETTERS[@pubkey_algo] || "?"
end
|
#sha ⇒ Object
32
33
34
|
# File 'lib/gpgme/sub_key.rb', line 32
def sha
(@fpr || @keyid)[-8 .. -1]
end
|
#timestamp ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/gpgme/sub_key.rb', line 10
def timestamp
case @timestamp
when -1, 0
return nil
else
return Time.at(@timestamp)
end
end
|
#to_s ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'lib/gpgme/sub_key.rb', line 58
def to_s
sprintf("%s %4d%s/%s %s\n",
secret? ? 'ssc' : 'sub',
length,
pubkey_algo_letter,
(@fpr || @keyid)[-8 .. -1],
timestamp.strftime('%Y-%m-%d'))
end
|