Class: Xml::Kit::KeyInfo

Inherits:
Object
  • Object
show all
Includes:
Templatable
Defined in:
lib/xml/kit/key_info.rb,
lib/xml/kit/key_info/key_value.rb,
lib/xml/kit/key_info/rsa_key_value.rb,
lib/xml/kit/key_info/retrieval_method.rb

Overview

An implementation of the KeyInfo element. www.w3.org/TR/xmldsig-core1/#sec-KeyInfo

Since:

  • 0.3.0

Defined Under Namespace

Classes: KeyValue, RSAKeyValue, RetrievalMethod

Instance Attribute Summary collapse

Attributes included from Templatable

#embed_signature, #encrypt, #encryption_certificate, #signing_key_pair

Instance Method Summary collapse

Methods included from Templatable

#asymmetric_cipher, #encrypt_data_for, #encrypt_key_for, #encrypt_with, #encryption_for, #render, #sign_with, #signature_for, #symmetric_cipher, #to_xml

Constructor Details

#initialize(x509: nil) {|_self| ... } ⇒ KeyInfo

Returns a new instance of KeyInfo.

Yields:

  • (_self)

Yield Parameters:

Since:

  • 0.3.0



19
20
21
22
# File 'lib/xml/kit/key_info.rb', line 19

def initialize(x509: nil)
  @x509_data = x509
  yield self if block_given?
end

Instance Attribute Details

#encrypted_keyObject

Since:

  • 0.3.0



17
18
19
# File 'lib/xml/kit/key_info.rb', line 17

def encrypted_key
  @encrypted_key
end

#key_nameObject

Since:

  • 0.3.0



15
16
17
# File 'lib/xml/kit/key_info.rb', line 15

def key_name
  @key_name
end

#x509_dataObject

Since:

  • 0.3.0



16
17
18
# File 'lib/xml/kit/key_info.rb', line 16

def x509_data
  @x509_data
end

Instance Method Details

#key_valueObject

Since:

  • 0.3.0



24
25
26
# File 'lib/xml/kit/key_info.rb', line 24

def key_value
  @key_value ||= KeyValue.new
end

#retrieval_methodObject

Since:

  • 0.3.0



28
29
30
# File 'lib/xml/kit/key_info.rb', line 28

def retrieval_method
  @retrieval_method ||= RetrievalMethod.new
end

#subject_key_identifierObject

Since:

  • 0.3.0



32
33
34
35
36
37
# File 'lib/xml/kit/key_info.rb', line 32

def subject_key_identifier
  ski = x509_data.extensions.find { |x| x.oid == 'subjectKeyIdentifier' }
  return if ski.nil?

  Base64.strict_encode64(ski.value)
end