Sha256: f52975922f4a4e5752f8c1ade0fea25d3f9282ff65ba8389309224c65b2b78da

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

module Xml
  module Kit
    module Builders
      class Signature
        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 :certificate
        attr_reader :digest_method
        attr_reader :reference_id
        attr_reader :signature_method

        def initialize(reference_id, signature_method: :SH256, digest_method: :SHA256, certificate:)
          @certificate = certificate
          @digest_method = DIGEST_METHODS[digest_method]
          @reference_id = reference_id
          @signature_method = SIGNATURE_METHODS[signature_method]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xml-kit-0.1.0 lib/xml/kit/builders/signature.rb