Class: PacketGen::Plugin::IKE::Cert
- Defined in:
- lib/packetgen/plugin/ike/cert.rb
Overview
This class handles Certificate payloads.
A Cert payload consists of the IKE generic payload Plugin (see Payload) and some specific fields:
1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Payload |C| RESERVED | Payload Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Cert Encoding | |
+-+-+-+-+-+-+-+-+ +
| |
~ Certificate Data ~
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
These specific fields are:
-
and Payload#content (Certificate Data).
Create a Cert payload
# Create a IKE packet with a Cert payload
pkt = PacketGen.gen('IP').add('UDP').add('IKE').add('IKE::Cert', encoding: 'X509_CERT_SIG')
certs = cert.to_der << ca_cert.to_der
pkt.ike_cert.content.read certs
pkt.calc_length
Direct Known Subclasses
Constant Summary collapse
- PAYLOAD_TYPE =
Payload type number
37
- ENCODINGS =
Certificate encoding
{ 'PKCS7_WRAPPED_X509' => 1, 'PGP' => 2, 'DNS_SIGNED_KEY' => 3, 'X509_CERT_SIG' => 4, 'KERBEROS_TOKEN' => 6, 'X509_CRL' => 7, 'X509_ARL' => 8, 'SPKI_CERT' => 9, 'X509_CERT_ATTR' => 10, 'HASH_URL_X509_CERT' => 12, 'HASH_URL_X509_BUNDLE' => 13 }.freeze
Instance Attribute Summary collapse
-
#encoding ⇒ Integer
8-bit certificate encoding.
Attributes inherited from Payload
#content, #critical, #flags, #hreserved, #length, #next
Instance Method Summary collapse
-
#human_encoding ⇒ String
Get encoding name.
-
#initialize(options = {}) ⇒ Cert
constructor
A new instance of Cert.
Methods inherited from Payload
Constructor Details
#initialize(options = {}) ⇒ Cert
Returns a new instance of Cert.
61 62 63 64 |
# File 'lib/packetgen/plugin/ike/cert.rb', line 61 def initialize(={}) super self.encoding = [:encoding] if [:encoding] end |
Instance Attribute Details
Instance Method Details
#human_encoding ⇒ String
Get encoding name
68 69 70 |
# File 'lib/packetgen/plugin/ike/cert.rb', line 68 def human_encoding self[:encoding].to_human end |