Class: OpenPGP::Packet::AsymmetricSessionKey

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

Overview

OpenPGP Public-Key Encrypted Session Key packet (tag 1).

See Also:

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Methods inherited from

#body, for, #initialize, parse, parse_new_format, parse_old_format, tag

Constructor Details

This class inherits a constructor from OpenPGP::Packet

Instance Attribute Details

- (Object) algorithm

Returns the value of attribute algorithm



126
127
128
# File 'lib/openpgp/packet.rb', line 126

def algorithm
  @algorithm
end

- (Object) key_id

Returns the value of attribute key_id



126
127
128
# File 'lib/openpgp/packet.rb', line 126

def key_id
  @key_id
end

- (Object) version

Returns the value of attribute version



126
127
128
# File 'lib/openpgp/packet.rb', line 126

def version
  @version
end

Class Method Details

+ (Object) parse_body(body, options = {})



128
129
130
131
132
133
134
135
136
# File 'lib/openpgp/packet.rb', line 128

def self.parse_body(body, options = {})
  case version = body.read_byte
    when 3
      self.new(:version => version, :key_id => body.read_number(8, 16), :algorithm => body.read_byte)
      # TODO: read the encrypted session key.
    else
      raise "Invalid OpenPGP public-key ESK packet version: #{version}"
  end
end