Sha256: 37371e0bbb41b321ed2a47123eddc5a6f0e71ede063464e5600b53ffb7f1ec17
Contents?: true
Size: 1.33 KB
Versions: 4
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true module Xml module Kit 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 def to_xml(xml: ::Builder::XmlMarkup.new) ::Xml::Kit::Template.new(self).to_xml(xml: xml) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
xml-kit-0.2.0 | lib/xml/kit/signature.rb |
xml-kit-0.1.14 | lib/xml/kit/signature.rb |
xml-kit-0.1.13 | lib/xml/kit/signature.rb |
xml-kit-0.1.12 | lib/xml/kit/signature.rb |