EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ElXMLSigner - generate KeyInfo

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#22162
Posted: 10/24/2012 08:46:07
by medax (Standard support level)
Joined: 08/28/2012
Posts: 36

Good day,
I use TElXMLSigner to sign XML file. It works fine, but I need element "<dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">" and program generate only "<dsig:KeyInfo>".

Thank you, Martin
#22163
Posted: 10/24/2012 09:00:26
by Dmytro Bogatskyy (EldoS Corp.)

Thank you for contacting us.

You can handle OnFormatElement event and add this attribute (using TElXMLDOMElement.SetAttributeNS method) for KeyInfo element. Or you can add this attribute into KeyInfo element after signing (because KeyInfo element by default is not signed/referenced), for example:
Code
Signer.Signature.KeyInfo.XMLElement.SetAttributeNS('', 'xmlns:dsig', 'http://...');
#22164
Posted: 10/24/2012 09:34:36
by medax (Standard support level)
Joined: 08/28/2012
Posts: 36

It works. Thank you very much, Martin.
#22175
Posted: 10/25/2012 03:20:58
by medax (Standard support level)
Joined: 08/28/2012
Posts: 36

Good day,

I have code:
Code
C14NTransform := TElXMLC14NTransform.Create;
    C14NTransform.CanonicalizationMethod := xcmExclCanon;
    C14NTransform.TransformAlgorithmURI := 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315';
    Ref.TransformChain.Add(C14NTransform);


Result in XML is:
Code
...
<dsig:SignedInfo>
  <dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
...


Algorithm in XML is different, than I need.
Thank you, Martin
#22176
Posted: 10/25/2012 03:28:38
by medax (Standard support level)
Joined: 08/28/2012
Posts: 36

XmlSigner generate element <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>.
How I change algorithm to "http://www.w3.org/2000/09/xmldsig#enveloped-signature" ?

Thank you, Martin
#22179
Posted: 10/25/2012 03:52:01
by Vsevolod Ievgiienko (EldoS Corp.)

Hello.

You should use TElXMLEnvelopedSignatureTransform instead of TElXMLC14NTransform.
#22181
Posted: 10/25/2012 04:05:12
by medax (Standard support level)
Joined: 08/28/2012
Posts: 36

Thank you very much. Now element <Transform> is OK.
How do I change CanonicalizationMethod Algorithm?

-----
I have another question: How do I remove element <X509IssuerSerial>?

Thank you, Martin
#22182
Posted: 10/25/2012 04:15:09
by Vsevolod Ievgiienko (EldoS Corp.)

Quote
How do I change CanonicalizationMethod Algorithm?

You can set it using TElXMLSigner.CanonicalizationMethod.

Quote
I have another question: How do I remove element <X509IssuerSerial>?

You can remove it using TElXMLKeyInfoX509Data.IncludeDataParams property.
#22193
Posted: 10/25/2012 06:13:24
by medax (Standard support level)
Joined: 08/28/2012
Posts: 36

It works. Thank you, Martin.
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 681 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!