Sha256: c8f418b97c393dd34b565e328da1e369a9afd6412909d1bcf059fd0f50e86a55
Contents?: true
Size: 851 Bytes
Versions: 29
Compression:
Stored size: 851 Bytes
Contents
class Epics::Signer attr_accessor :doc, :client def initialize(client, doc = nil) self.doc = Nokogiri::XML.parse(doc) if doc self.client = client end def digest! content_to_digest = Base64.encode64(digester.digest(doc.xpath("//*[@authenticate='true']").map(&:canonicalize).join)).strip if digest_node digest_node.content = content_to_digest end doc end def sign! signature_value_node = doc.xpath("//ds:SignatureValue").first if signature_node signature_value_node.content = Base64.encode64(client.x.key.sign(digester, signature_node.canonicalize)).gsub(/\n/,'') end doc end def digest_node @d ||= doc.xpath("//ds:DigestValue").first end def signature_node @s ||= doc.xpath("//ds:SignedInfo").first end def digester OpenSSL::Digest::SHA256.new end end
Version data entries
29 entries across 29 versions & 1 rubygems