class SAML2::Key

Attributes

encryption_methods[RW]

@return [Array<EncryptionMethod>]

use[RW]

@see Type @return [String]

Public Class Methods

new(x509 = nil, use = nil, encryption_methods = []) click to toggle source

@param x509 [String] The PEM encoded certificate. @param use optional [String] See {Type} @param encryption_methods [Array<EncryptionMethod>]

Calls superclass method SAML2::KeyInfo::new
# File lib/saml2/key.rb, line 151
def initialize(x509 = nil, use = nil, encryption_methods = [])
  super()
  @use = use
  self.x509 = x509
  @encryption_methods = encryption_methods
end

Public Instance Methods

build(builder) click to toggle source

(see Base#build)

Calls superclass method SAML2::KeyInfo#build
# File lib/saml2/key.rb, line 167
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?() click to toggle source
# File lib/saml2/key.rb, line 158
def encryption?
  use.nil? || use == Type::ENCRYPTION
end
from_xml(node) click to toggle source

(see Base#from_xml)

Calls superclass method SAML2::KeyInfo#from_xml
# File lib/saml2/key.rb, line 142
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
signing?() click to toggle source
# File lib/saml2/key.rb, line 162
def signing?
  use.nil? || use == Type::SIGNING
end