Sha256: f7782f81adefe313799f1aac87934d7c2be272eb18130433f9574e3cce389bdd

Contents?: true

Size: 1.37 KB

Versions: 7

Compression:

Stored size: 1.37 KB

Contents

module Saml
  module Kit
    module Builders
      class XmlSignature
        SIGNATURE_METHODS = {
          SHA1: "http://www.w3.org/2000/09/xmldsig#rsa-sha1",
          SHA224: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha224",
          SHA256: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
          SHA384: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384",
          SHA512: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512",
        }.freeze
        DIGEST_METHODS = {
          SHA1: "http://www.w3.org/2000/09/xmldsig#SHA1",
          SHA224: "http://www.w3.org/2001/04/xmldsig-more#sha224",
          SHA256: "http://www.w3.org/2001/04/xmlenc#sha256",
          SHA384: "http://www.w3.org/2001/04/xmldsig-more#sha384",
          SHA512: "http://www.w3.org/2001/04/xmlenc#sha512",
        }.freeze

        attr_reader :embed_signature, :configuration
        attr_reader :reference_id
        attr_reader :x509_certificate

        def initialize(reference_id, configuration:)
          @configuration = configuration
          @reference_id = reference_id
          @x509_certificate = configuration.certificates(use: :signing).last.stripped
        end

        def signature_method
          SIGNATURE_METHODS[configuration.signature_method]
        end

        def digest_method
          DIGEST_METHODS[configuration.digest_method]
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
saml-kit-0.2.13 lib/saml/kit/builders/xml_signature.rb
saml-kit-0.2.12 lib/saml/kit/builders/xml_signature.rb
saml-kit-0.2.11 lib/saml/kit/builders/xml_signature.rb
saml-kit-0.2.10 lib/saml/kit/builders/xml_signature.rb
saml-kit-0.2.9 lib/saml/kit/builders/xml_signature.rb
saml-kit-0.2.8 lib/saml/kit/builders/xml_signature.rb
saml-kit-0.2.7 lib/saml/kit/builders/xml_signature.rb