EldoS | Feel safer!

Software components for data protection, secure storage and transfer

How to include Cert info in XML Signed w/ distributed Cryptography

Posted: 11/22/2012 07:09:03
by Daniel Oliveira (Basic support level)
Joined: 11/20/2012
Posts: 19

I'm using the Distributed Cryptography Add-on to sign XML files, but must include the information in the signature certificate used (X509Data). I need to display the information and the signature certificate used on a specific page.

thank you
Posted: 11/22/2012 07:16:12
by Vsevolod Ievgiienko (Team)


You can enable this using ((TElXMLKeyInfoX509Data)TElXMLSigner.KeyData).IncludeDataParams property. Please refer to the documentation for details: http://www.eldos.com/documentation/sb...arams.html
Posted: 11/22/2012 07:51:57
by Daniel Oliveira (Basic support level)
Joined: 11/20/2012
Posts: 19

Thank you for the awnser.

I put this code on my PreSigner class:

((TElXMLKeyInfoX509Data) signer.KeyData).IncludeDataParams = SBXMLSec.Unit.xkidX509Certificate;


But, in result.aspx page the property KeyData is null.
Posted: 11/22/2012 07:56:23
by Vsevolod Ievgiienko (Team)

It must be assigned manually. Please refer to the next sample for details: \EldoS\SecureBlackbox.NET\Samples\C#\XMLBlackbox\Signer
Posted: 11/22/2012 08:30:27
by Dmytro Bogatskyy (Team)

You would need to create an instance of TElXMLKeyInfoX509Data, and then set a Certificate property with a signing certificate. To obtain a signing certificate from a state object, please do following:
  TElDCBaseMessage Msg = State.FindMessageByType(TElDCOperationResponseMessage);
  if (Msg != null)
    byte[] buf = TElDCOperationResponseMessage(Msg).KeysRDN.GetFirstValueByOID(      SBDCPKIConstants.Unit.SB_OID_DC_SIGNING_CERTIFICATE)
   // then load certificate from a buffer

P.S. Please also ensure that TElXMLSigner.IncludeKey property is set to true for both steps.
Posted: 11/22/2012 12:06:06
by Daniel Oliveira (Basic support level)
Joined: 11/20/2012
Posts: 19

Thanks, Dmytro and Vesevolod.

Works, with a little adjusts. I will put here the code for future references:

byte[] buf = ((TElDCOperationResponseMessage)Msg).KeysRDN.GetFirstValueByOID(SBDCPKIConstants.Unit.SB_OID_DC_SIGNING_CERTIFICATE);
                var cert = new TElX509Certificate();



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