Sha256: d93afe1f1ccc25ba3065d52cca7abd5bee4c62e6bfa37cee347e2c5f97aaa3a8

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 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 :sign, :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

2 entries across 2 versions & 1 rubygems

Version Path
saml-kit-0.2.6 lib/saml/kit/builders/xml_signature.rb
saml-kit-0.2.5 lib/saml/kit/builders/xml_signature.rb