Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9172283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:18:31+00:00 2026-06-17T16:18:31+00:00

I need to sign xml using ruby, someone know any method or lib for

  • 0

I need to sign xml using ruby, someone know any method or lib for that?

My xml skeleton is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<Message>
    <MessageId> 
        <ServiceId>service</ServiceId> 
        <Version>1.0</Version> 
        <MsgDesc>Service Description</MsgDesc> 
        <Code>4</Code> 
        <FromAddress>from</FromAddress> 
        <ToAddress>to</ToAddress> 
        <Date>2012-10-29</Date> 
    </MessageId> 
    <MessageBody/> 

<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
  <SignedInfo>
    <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
    <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
    <Reference URI="">
    <Transforms>
      <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
    </Transforms>
    <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
    <DigestValue>??????</DigestValue>
    </Reference>
  </SignedInfo>

  <SignatureValue>????????????</SignatureValue>
  <KeyInfo>
    <X509Data>
      <X509Certificate>????????</X509Certificate>
    </X509Data>
  </KeyInfo>
</Signature>
</message>

I tried this code for DigestValue and I have tested it, comparing it with my java example, but DigestValue is not matching with the response of my java example:

require 'base64'
require 'openssl'

to_sign_xml = File.read 'service.xml'
digest = OpenSSL::Digest::SHA1.digest(to_sign_xml)

digest = Base64.encode64(digest.to_s).gsub(/\n/, '')
raise digest.inspect

My file service.xml contain that:

<Message>
    <MessageId> 
        <ServiceId>service</ServiceId> 
        <Version>1.0</Version> 
        <MsgDesc>Service Description</MsgDesc> 
        <Code>4</Code> 
        <FromAddress>from</FromAddress> 
        <ToAddress>to</ToAddress> 
        <Date>2012-10-29</Date> 
    </MessageId> 
    <MessageBody/>
<Message>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:18:32+00:00Added an answer on June 17, 2026 at 4:18 pm

    If you’re still interested I made this gem a week ago. It’s still in development but the basic stuff is implemented. This gem is tested against signatures created with the xmlsec library.
    http://www.aleksey.com/xmlsec/

    I’m actively working with this gem at the moment so bugs should be fixed relatively quick.

    https://rubygems.org/gems/xmldsig

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need, in C# (4.0), to sign an XML (XMLDSig Envelope) using a X509Certificate
I'm using an XML POST to sign in my users and I need to
Why should I sign my JAR files? I know that I need to sign
I need to encrypt and sign data using PKCS7(CMS) . I am using bouncy
I´m trying to sign some text or XML node using my certificates, installed on
I have a C# application that uses XML digital signatures to sign license files.
I have 3 application that need single sign on. These are the web config
I have source code of Entlib 5.0 and I need sign all assemblies using
I need to sign and verify a string using my company's digital certificate. The
I need to sign XML SOAP requests in Android application. I did a little

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.