Class: SAML2::KeyDescriptor
Defined Under Namespace
Modules: Type Classes: EncryptionMethod
Instance Attribute Summary collapse
Attributes inherited from KeyInfo
Attributes inherited from Base
Instance Method Summary collapse
-
#build(builder) ⇒ void
Serialize this object to XML, as part of a larger document.
- #encryption? ⇒ Boolean
-
#from_xml(node) ⇒ void
Parse an XML element into this object.
-
#initialize(x509 = nil, use = nil, encryption_methods = []) ⇒ KeyDescriptor
constructor
A new instance of KeyDescriptor.
- #signing? ⇒ Boolean
Methods inherited from KeyInfo
#certificate, #fingerprint, format_fingerprint, #public_key
Methods inherited from Base
#decrypt, from_xml, #inspect, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml
Constructor Details
#initialize(x509 = nil, use = nil, encryption_methods = []) ⇒ KeyDescriptor
Returns a new instance of KeyDescriptor.
150 151 152 153 154 155 |
# File 'lib/saml2/key.rb', line 150 def initialize(x509 = nil, use = nil, encryption_methods = []) super() @use = use self.x509 = x509 @encryption_methods = encryption_methods end |
Instance Attribute Details
#encryption_methods ⇒ Array<EncryptionMethod>
138 139 140 |
# File 'lib/saml2/key.rb', line 138 def encryption_methods @encryption_methods end |
#use ⇒ String
136 137 138 |
# File 'lib/saml2/key.rb', line 136 def use @use end |
Instance Method Details
#build(builder) ⇒ void
This method returns an undefined value.
Serialize this object to XML, as part of a larger document
166 167 168 169 170 171 172 173 174 |
# File 'lib/saml2/key.rb', line 166 def build(builder) builder["md"].KeyDescriptor do |key_descriptor| key_descriptor.parent["use"] = use if use super(key_descriptor) encryption_methods.each do |method| method.build(key_descriptor) end end end |
#encryption? ⇒ Boolean
157 158 159 |
# File 'lib/saml2/key.rb', line 157 def encryption? use.nil? || use == Type::ENCRYPTION end |
#from_xml(node) ⇒ void
This method returns an undefined value.
Parse an XML element into this object.
141 142 143 144 145 |
# File 'lib/saml2/key.rb', line 141 def from_xml(node) super(node.at_xpath("dsig:KeyInfo", Namespaces::ALL)) self.use = node["use"] self.encryption_methods = load_object_array(node, "md:EncryptionMethod", EncryptionMethod) end |