EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Include OCSP Response in XAdES

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#5767
Posted: 04/08/2008 06:07:03
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

Hi!,

I'm trying to fill RevocationValues in XAdES (Delphi) as I do with CAdES:
I've got a TList named SOCSP filled with TElOCSPResponses
Code
                  for ContOCSP:=0 to SOCSP.Count-1 do
                  begin
                    XAdESSigner.QualifyingProperties.UnsignedProperties.UnsignedSignatureProperties.RevocationValues.OCSPValues.Add(TElOCSPResponse(SOCSP[ContOCSP]));
                  end;


But obviously, it says that i cannot put a TElOCSPResponse to TElXMLEncapsulatedPKIData. And I don't really know how to assign it. Any clues?

Regards
#5768
Posted: 04/08/2008 06:33:12
by Dmytro Bogatskyy (EldoS Corp.)

Please, use the following code:
Code
var
OCSPResponse : TElOCSPResponse;
PKIData : TElXMLEncapsulatedPKIData;
Buf : ByteArray;
Size : Integer;

OCSPResponse := TElOCSPResponse(SOCSP[ContOCSP];
Size := 0;
OCSPResponse.Save(nil, Size);
SetLength(Buf, Size);
if OCSPResponse.Save(@Buf[0], Size) then
begin
  SetLength(Buf, Size);
  PKIData := TElXMLEncapsulatedPKIData.Create(XAdESSigner.XAdESVersion);
  PKIData.Encoding := xemDER;
  PKIData.Data := Buf;
  ...OCSPValues.Add(PKIData);
end;
#5769
Posted: 04/08/2008 06:56:26
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

I've come into a strange problem. Delphi says that PKIData.Data is a constant object, and cannot use SetLength method, but PKIData.Data is a ByteArray (array of byte) so i'm confused... what's happening?
#5770
Posted: 04/08/2008 06:59:50
by Dmytro Bogatskyy (EldoS Corp.)

Quote
I've come into a strange problem. Delphi says that PKIData.Data is a constant object, and cannot use SetLength method, but PKIData.Data is a ByteArray (array of byte) so i'm confused... what's happening?

That's right, you cann't pass property as var parameter. I modified code above.

Reply

Statistics

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