Class: OpenPGP::Packet::AsymmetricSessionKey

Inherits:
OpenPGP::Packet show all
Defined in:
lib/openpgp/packet.rb

Overview

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

Instance Attribute Summary collapse

Attributes inherited from OpenPGP::Packet

#data, #size, #tag

Class Method Summary collapse

Methods inherited from OpenPGP::Packet

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

Constructor Details

This class inherits a constructor from OpenPGP::Packet

Instance Attribute Details

#algorithmObject

Returns the value of attribute algorithm.



106
107
108
# File 'lib/openpgp/packet.rb', line 106

def algorithm
  @algorithm
end

#key_idObject

Returns the value of attribute key_id.



106
107
108
# File 'lib/openpgp/packet.rb', line 106

def key_id
  @key_id
end

#versionObject

Returns the value of attribute version.



106
107
108
# File 'lib/openpgp/packet.rb', line 106

def version
  @version
end

Class Method Details

.parse_body(body, options = {}) ⇒ Object



108
109
110
111
112
113
114
115
116
# File 'lib/openpgp/packet.rb', line 108

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