Class: GPGME::SubKey

Inherits:
Object
  • Object
show all
Defined in:
lib/gpgme.rb

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

Instance Attribute Details

#fprObject (readonly) Also known as: fingerprint

Returns the value of attribute fpr.



1274
1275
1276
# File 'lib/gpgme.rb', line 1274

def fpr
  @fpr
end

#keyidObject (readonly)

Returns the value of attribute keyid.



1274
1275
1276
# File 'lib/gpgme.rb', line 1274

def keyid
  @keyid
end

#lengthObject (readonly)

Returns the value of attribute length.



1274
1275
1276
# File 'lib/gpgme.rb', line 1274

def length
  @length
end

#pubkey_algoObject (readonly)

Returns the value of attribute pubkey_algo.



1274
1275
1276
# File 'lib/gpgme.rb', line 1274

def pubkey_algo
  @pubkey_algo
end

Instance Method Details

#capabilityObject



1284
1285
1286
1287
1288
1289
1290
1291
# File 'lib/gpgme.rb', line 1284

def capability
  caps = Array.new
  caps << :encrypt if @can_encrypt
  caps << :sign if @can_sign
  caps << :certify if @can_certify
  caps << :authenticate if @can_authenticate
  caps
end

#expiresObject



1301
1302
1303
# File 'lib/gpgme.rb', line 1301

def expires
  Time.at(@expires)
end

#inspectObject



1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
# File 'lib/gpgme.rb', line 1316

def inspect
  sprintf("#<#{self.class} %s %4d%c/%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_letterObject



1312
1313
1314
# File 'lib/gpgme.rb', line 1312

def pubkey_algo_letter
  PUBKEY_ALGO_LETTERS[@pubkey_algo] || ??
end

#secret?Boolean

Returns:

  • (Boolean)


1293
1294
1295
# File 'lib/gpgme.rb', line 1293

def secret?
  @secret == 1
end

#timestampObject



1297
1298
1299
# File 'lib/gpgme.rb', line 1297

def timestamp
  Time.at(@timestamp)
end

#to_sObject



1327
1328
1329
1330
1331
1332
1333
1334
# File 'lib/gpgme.rb', line 1327

def to_s
  sprintf("%s   %4d%c/%s %s\n",
          secret? ? 'ssc' : 'sub',
          length,
          pubkey_algo_letter,
          (@fingerprint || @keyid)[-8 .. -1],
          timestamp.strftime('%Y-%m-%d'))
end

#trustObject



1277
1278
1279
1280
1281
1282
# File 'lib/gpgme.rb', line 1277

def trust
  return :revoked if @revoked == 1
  return :expired if @expired == 1
  return :disabled if @disabled == 1
  return :invalid if @invalid == 1
end