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



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

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

Instance Attribute Details

#algorithmString

See Also:



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

def algorithm
  @algorithm
end

#key_sizeInteger



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

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



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

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.



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

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