EldoS | Feel safer!

Software components for data protection, secure storage and transfer

DigestAlgAndValue.DigestValue

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#11087
Posted: 09/17/2009 11:04:17
by Datadec Online (Basic support level)
Joined: 09/09/2009
Posts: 29

I need to generate the following XaDES information:

<etsi:OCSPRef>
<etsi:OCSPIdentifier URI="#OCSP296877">
<etsi:ResponderID>rzWapinGrrCZz8Ay+B3V4j+XOdY=</etsi:ResponderID>
<etsi:ProducedAt>2009-09-17T16:28:58+02:00</etsi:ProducedAt>
</etsi:OCSPIdentifier>
<etsi:DigestAlgAndValue>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>ixvaeXuffuLnO12mNAfcSfnDU4c=</ds:DigestValue>
</etsi:DigestAlgAndValue>
</etsi:OCSPRef>

I'm only capable of generate this:
<xades:OCSPRef>
<xades:OCSPIdentifier>
<xades:ResponderID>
<xades:ByName>rzWapinGrrCZz8Ay+B3V4j+XOdY=</xades:ByName>
</xades:ResponderID>
<xades:ProducedAt>2009-09-17T15:45:32.000Z</xades:ProducedAt>
</xades:OCSPIdentifier>
<xades:DigestAlgAndValue>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>rzWapinGrrCZz8Ay+B3V4j+XOdY=</ds:DigestValue>
</xades:DigestAlgAndValue>
</etsi:OCSPRef>

I am using this VB.NET code:
Code
OCSPRef.OCSPIdentifier.ResponderID = SBXMLSec.Unit.ConvertToBase64String(OCSPResponse.ResponderID.SHA1KeyHash)
OCSPRef.OCSPIdentifier.ResponderIDType = SBXMLAdES.Unit.xrtByName

OCSPRef.DigestAlgAndValue.DigestMethod = SBXMLSec.Unit.DigestMethodToURI(SBXMLSec.Unit.xdmSHA1)
OCSPRef.DigestAlgAndValue.DigestValue = OCSPResponse.ResponderID.SHA1KeyHash '&#191;?

OCSPRef.OCSPIdentifier.ProducedAtUTC = OCSPResponse.ProducedAt
    XAdESSigner.QualifyingProperties.UnsignedProperties.UnsignedSignatureProperties.CompleteRevocationRefs.OCSPRefs.Add(OCSPRef)


I don't know who to generate OCSPRef.DigestAlgAndValue.DigestValue. Any suggestion?

Thanks, regards,
Javier Gutiérrez
#11088
Posted: 09/17/2009 14:49:18
by Dmytro Bogatskyy (EldoS Corp.)

Quote
I don't know who to generate OCSPRef.DigestAlgAndValue.DigestValue. Any suggestion?

It should be a digest computed on the DER encoded OCSPResponse.
The correct code:
Code
  TElXMLOCSPRef OCSPRef = new TElXMLOCSPRef(XAdESSigner.XAdESVersion);
  if (OCSPResponse.ResponderID.Name.Count > 0)
  {
  OCSPRef.OCSPIdentifier.ResponderID = SBXMLSec.Unit.FormatRDN(OCSPResponse.ResponderID.Name);
  OCSPRef.OCSPIdentifier.ResponderIDType = SBXMLAdES.Unit.xrtByName;
  }
  else
  if (OCSPResponse.ResponderID.FSHA1KeyHash.Length() > 0)
  {
  OCSPRef.OCSPIdentifier.ResponderID = SBXMLSec.Unit.ConvertToBase64String(OCSPResponse.ResponderID.SHA1KeyHash)
  OCSPRef.OCSPIdentifier.ResponderIDType = SBXMLAdES.Unit.xrtByKey
  }
  OCSPRef.OCSPIdentifier.ProducedAtUTC = OCSPResponse.ProducedAt;
  OCSPRef.DigestAlgAndValue.DigestMethod = xmlDigestMethodSHA1;
  OCSPRef.DigestAlgAndValue.DigestValue = SBXMLSec.Unit.CalculateDigest(OCSPResponseBuf, SBXMLSec.Unit.xdmSHA1);
  ElXAdESSigner.QualifyingProperties.UnsignedProperties.UnsignedSignatureProperties.CompleteRevocationRefs.OCSPRefs.Add(OCSPRef);


Also, you can set OCSPRef.OCSPIdentifier.URI property.
#11093
Posted: 09/18/2009 02:25:59
by Datadec Online (Basic support level)
Joined: 09/09/2009
Posts: 29

It is possible to omit <xades:ByKey> or <xades:ByName> elements?
#11097
Posted: 09/18/2009 03:53:20
by Dmytro Bogatskyy (EldoS Corp.)

Quote
It is possible to omit <xades:ByKey> or <xades:ByName> elements?

What XAdES version do you need to use?
Because ByKey and ByName elements was added in XAdES version 1.3.2
For version 1.1.1 and 1.2.2 you don't need to set ResponderIDType property.
#11099
Posted: 09/18/2009 06:51:50
by Datadec Online (Basic support level)
Joined: 09/09/2009
Posts: 29

I have uploaded an xml document signed with XaDES-X-L format. Using the following validator http://www11.mityc.es/FacturaE/ it says that reference to timestamp could not be readed.

I need some help :)

Thanks, Regards,
Javier Gutiérrez


[ Download ]
#11101
Posted: 09/18/2009 13:03:20
by Dmytro Bogatskyy (EldoS Corp.)

Quote

I have uploaded an xml document signed with XaDES-X-L format. Using the following validator http://www11.mityc.es/FacturaE/ it says that reference to timestamp could not be readed.

It seems a problem in the "uri" attribute name of "Include" elements. It is in lower case as in specification. But in the XML Schema for XAdES 1.2.2 it is in upper case. I changed it to the upper case for the next version.
#11108
Posted: 09/21/2009 08:50:02
by Datadec Online (Basic support level)
Joined: 09/09/2009
Posts: 29

Ok,

Do you know when next version is going to be available?

Thanks, regards,
Javier Gutiérrez
#11110
Posted: 09/21/2009 09:47:59
by Eugene Mayevski (EldoS Corp.)

7.2 release is planned for the first half of October.


Sincerely yours
Eugene Mayevski
#16053
Posted: 03/15/2011 04:10:54
by mitja lojk (Basic support level)
Joined: 08/26/2010
Posts: 6

Hi!

I have installed sb 8.2.196
What happened with

Quote

sDigestAttZip := SBXMLSec.ConvertToBase64String(SBXMLSec.CalculateDigest(Buf,length(Buf), SBXMLSec.xdmSHA1));


I've also tried with :
Quote

SBXMLSec.Unit.ConvertToBase64String


but ConvertToBase64String is nowhere to be found !
#16054
Posted: 03/15/2011 04:22:26
by Eugene Mayevski (EldoS Corp.)

The function has been moved to SBXMLUtils.


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

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