EldoS | Feel safer!

Software components for data protection, secure storage and transfer

A problem with SignedInfo

Posted: 02/27/2012 08:07:37
by Victor Villegas (Standard support level)
Joined: 02/27/2012
Posts: 18

How I can remove the reference to the "SignedInfo"?
That is, appears as <SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">

And I need only appear as <SignedInfo>
Posted: 02/27/2012 08:12:30
by Vsevolod Ievgiienko (Team)

Thank you for contacting us.

You can remove it using TElXMLSigner.OnFormatElement event handler.
Posted: 02/27/2012 10:24:49
by Victor Villegas (Standard support level)
Joined: 02/27/2012
Posts: 18

I am dealing with the following code:

Signer: = TElXMLSigner.Create (Self);
         Signer.Signature.SignedInfo.ID: ='';
         Signer.SignatureType: = xstEnveloped;
         Signer.CanonicalizationMethod: = xcmCanon;
         Signer.SignatureMethodType: = xmtSig;
         Signer.SignatureMethod: = xsmRSA_SHA1;
         Signer.MACMethod: = xmmHMAC_SHA1;
         Signer.References: = Refs;
         Signer.KeyName: ='';
         Signer.IncludeKey: = true;
         Signer.OnFormatElement: = FormatElement;
         Signer.OnFormatText: = FormatText;

Where FormatElement is a procedure according to Example incorporated with the component.
TFrmEnvioDTE.FormatElement procedure (Sender:} {$ ifndef DELPHI_NET TObject {$ else} {$ endif} System.Object;
   Element: TElXMLDOMElement; Level: Integer; const Path: xmlString;
   var StartTagWhitespace, EndTagWhitespace: xmlString);
   Node: TElXMLDOMNode;
   s: xmlString;
   i: Integer;
   HasElements: Boolean;
   StartTagWhitespace: = # 10;
   s: ='';
   for i: = 0 to Level - 2 do
     s: = s + # 9;

   StartTagWhitespace: = StartTagWhitespace + s;
   if Assigned (Element.FirstChild) then
     HasElements: = False;
     Node: = Element.FirstChild;
     while Assigned (Node) do
       Then if Node.NodeType = ntElement
         HasElements: = True;

       Node: = Node.NextSibling;

     Then if HasElements
       EndTagWhitespace: = # 10 + s;

So how could change the SignedInfo as this?
Posted: 02/27/2012 10:53:21
by Vsevolod Ievgiienko (Team)

The code should look like this:
if LowerCase(Element.NodeName) = 'signedinfo' then
  Element.SetAttribute('xmlns', '');
Posted: 02/27/2012 12:56:44
by Victor Villegas (Standard support level)
Joined: 02/27/2012
Posts: 18

adding that code generates the following:

<SignedInfo xmlns="" xmlns="http://www.w3.org/2000/09/xmldsig#">
Posted: 02/27/2012 14:56:07
by Dmytro Bogatskyy (Team)

Element.SetAttribute('xmlns', '');

In fact, it should be:
Element.SetAttributeNS('', 'xmlns', '');

However, a declaration for the digital signature namespace should be generated for Signature element (controlled using SignaturePrefix property), but not for SignedInfo element. What SecureBlackbox version do you use? Could you please attach here or to helpdesk a signed sample xml document.
Posted: 02/28/2012 06:54:47
by Victor Villegas (Standard support level)
Joined: 02/27/2012
Posts: 18

SecureBlackbox - version 9.0.203 - Released June 10, 2011

This is an extract from the xml file I need to be generated:


<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#F1T33">
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>


Posted: 02/28/2012 09:47:32
by Eugene Mayevski (Team)

Based on your version you've been using SecureBlackbox for quite long. So you either have a license or you need to purchase one.

If you have a license, please assign the license ticket to your user account before we continue. The ticket itself and the procedure of it's use are specified in the registration e-mail that was sent to you upon license purchase.

Sincerely yours
Eugene Mayevski
Posted: 10/25/2012 15:29:55
by Victor Villegas (Standard support level)
Joined: 02/27/2012
Posts: 18

Dear, now I have a license and need xmlboxsecurity SignedInfo Working Out for deployment only as
and not
<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">

I hope your help
Posted: 10/25/2012 17:18:15
by Dmytro Bogatskyy (Team)

XML-DSig standard requires that all elements (including SignedInfo element) that it defines has "http://www.w3.org/2000/09/xmldsig#" namespace URI unless otherwise stated.
What custom standard need this?
Do you have a sample xml document? Could you please post it (here or to helpdesk).

P.S. I think, you can achieve your goal by modifying xmlSignatureNamespace constant from SBXMLDefs unit.



Topic viewed 3822 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!