Class: SAML2::KeyDescriptor::EncryptionMethod

Inherits:
Base
  • Object
show all
Defined in:
lib/saml2/key.rb

Defined Under Namespace

Modules: Algorithm

Instance Attribute Summary collapse

Attributes inherited from Base

#xml

Instance Method Summary collapse

Methods inherited from Base

#decrypt, from_xml, #inspect, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml

Constructor Details

#initialize(algorithm = Algorithm::AES128_CBC, key_size = 128) ⇒ EncryptionMethod



76
77
78
# File 'lib/saml2/key.rb', line 76

def initialize(algorithm = Algorithm::AES128_CBC, key_size = 128)
  @algorithm, @key_size = algorithm, key_size
end

Instance Attribute Details

#algorithmString

See Also:



70
71
72
# File 'lib/saml2/key.rb', line 70

def algorithm
  @algorithm
end

#key_sizeInteger



72
73
74
# File 'lib/saml2/key.rb', line 72

def key_size
  @key_size
end

Instance Method Details

#build(builder) ⇒ void

This method returns an undefined value.

Serialize this object to XML, as part of a larger document



87
88
89
90
91
# File 'lib/saml2/key.rb', line 87

def build(builder)
  builder['md'].EncryptionMethod('Algorithm' => algorithm) do |encryption_method|
    encryption_method['xenc'].KeySize(key_size) if key_size
  end
end

#from_xml(node) ⇒ void

This method returns an undefined value.

Parse an XML element into this object.



81
82
83
84
# File 'lib/saml2/key.rb', line 81

def from_xml(node)
  self.algorithm = node['Algorithm']
  self.key_size = node.at_xpath('xenc:KeySize', Namespaces::ALL)&.content&.to_i
end