EldoS | Feel safer!

Software components for data protection, secure storage and transfer

A problem with SignedInfo

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#19213
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>
#19214
Posted: 02/27/2012 08:12:30
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

You can remove it using TElXMLSigner.OnFormatElement event handler.
#19217
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:

Code
Signer: = TElXMLSigner.Create (Self);
       try
         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.
Code
TFrmEnvioDTE.FormatElement procedure (Sender:} {$ ifndef DELPHI_NET TObject {$ else} {$ endif} System.Object;
   Element: TElXMLDOMElement; Level: Integer; const Path: xmlString;
   var StartTagWhitespace, EndTagWhitespace: xmlString);
var
   Node: TElXMLDOMNode;
   s: xmlString;
   i: Integer;
   HasElements: Boolean;
begin
   StartTagWhitespace: = # 10;
   s: ='';
   for i: = 0 to Level - 2 do
     s: = s + # 9;

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

       Node: = Node.NextSibling;
     end;

     Then if HasElements
       EndTagWhitespace: = # 10 + s;
   end;
end;

So how could change the SignedInfo as this?
#19220
Posted: 02/27/2012 10:53:21
by Vsevolod Ievgiienko (EldoS Corp.)

The code should look like this:
Code
if LowerCase(Element.NodeName) = 'signedinfo' then
  Element.SetAttribute('xmlns', '');
#19222
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#">
#19223
Posted: 02/27/2012 14:56:07
by Dmytro Bogatskyy (EldoS Corp.)

Quote
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.
#19230
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:

Quote


<SignedInfo>
<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">
<Transforms>
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>HCSYcAdcXUZNVtd3uxfq0Q7PJQo=</DigestValue>
</Reference>


Gfm49OQN09oozSrmEjskqy1QjHFY0+L9qapM2LPdcCUnTCjyUnJmpLUzuW9aznm9
UwuFlQeTqY3Bv53lz4d+TtVwSaWgVggm0XtO8OhyDMKxOZWvI/Raf/tYnBQFOlAG
XTwYbaZ6XfA8bqpV0p7Jwd2SUy5Bg/dXkl0w+UzczoA=

<KeyInfo>
<KeyValue>
<RSAKeyValue>
<Modulus>
rJDvOkUdsRb6YFSTvQ60aK48wmRty9XsxZL5lY0oepAnvXk2FV9fNZuNNLCfVt8K
ncJA7gij27dXrDXYSDalveC21EXGLL7imTZEwEVk76MHdHQC1R9JtlwHA3RxUAw4
iokNNEvuVl69COxzPzWT06lJaDFlsT8odk/+8zBlb6M=
</Modulus>
#19235
Posted: 02/28/2012 09:47:32
by Eugene Mayevski (EldoS Corp.)

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
#22207
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
<SignedInfo>
and not
<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">

I hope your help
#22209
Posted: 10/25/2012 17:18:15
by Dmytro Bogatskyy (EldoS Corp.)

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.
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

Topic viewed 3467 times

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




|

Back to top

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

Got it!