0
votes

We are currently consuming a soap based webservice in an delphi application running on an XP (yes still running XP) and porting to a windows 8.1 OS. Our current implementation also uses CAPICOM for certificate management which is now also desupported.

We are planning on upgrading from wininet to winhttp (being faster) remaining with the current version of Delphi 2010. Components I have found are: SynCrtSock , ICS and Indy. From my review, these either use wininet or dont support soap?

Any information on components and examples with the minimum of: soap support, winhttp and certificate management would be greatly appreciated.

Thanks in advance.

1

1 Answers

0
votes

I now have resolved the key point of my issue in the certificate management and thought I would post my solution.

The certificate management requirements were limited to only attaching to the SOAP message, I was able to achieve the solution by using the wcrypt2 library. My original code using CAPICOM (with the help of many internet searches) was

   Certificate1.Load(CertFile, certpword, CAPICOM_KEY_STORAGE_DEFAULT,
    CAPICOM_CURRENT_USER_KEY);
  Cert2 := Certificate1.DefaultInterface;
  CertContext := Cert2 as ICertContext;
  CertContext.Get_CertContext(Integer(PCertContext));
  if internetsetOption(Data, INTERNET_OPTION_CLIENT_CERT_CONTEXT,
    PCertContext, SizeOf(CERT_CONTEXT)) = False then
  begin
    'Error Handling'
  end;

By using wcrypt2 I was able to read from the certificate store and attach to the soap message by a simple change to my BeforePost function with

hMyStore:=CertOpenSystemStore(0,'MY');
pCertContext:=CertFindCertificateInStore(
  hMyStore,
  X509_ASN_ENCODING,
  0,
  CERT_FIND_SUBJECT_STR,
  PCHAR('KeyName'),Nil
  );

  if internetsetOption(Data, INTERNET_OPTION_CLIENT_CERT_CONTEXT,
        PCertContext, SizeOf(CERT_CONTEXT)) = False then
  begin
    'error handling'
  end;

And now I am compatible with Windows 8.1, as wininet is still compatible with 8.1 this is not on my critical path and have further time to deploy a solution.

Any further advice on my solution would be greatly appreciated.