views:

545

answers:

3

Hello,

My questions if pretty simple: is there a simple way to access Windows X509 Certificate Store using Delphi 7?

Before asking this questions I have googeled, but have not found any useful info

Thank You

A: 

Isn't that what you are looking for? Cryptography Reference

Or do you search an API Wrapper?

bassfriend
More of an API Wrapper
Daniil Harik
+3  A: 

the easiest way is to use capicom, hitting the win capi api directly is painful.

once you've registered the com object and created your typelib unit from it..

open the appropriate store, and from there use the certificates() method..

  var
    store: TStore;
    certificates: ICertificates;
    certificate: ICertificate2

  store := TStore.Create(nil);
  store.Open(CAPICOM_CURRENT_USER_STORE, 'My', CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED or CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED or CAPICOM_STORE_OPEN_EXISTING_ONLY);

  certificates := store.Certificates;
  for i := 1 to certificates.count do
  begin
    certificate := IInterface(certificates.Item[i]) as ICertificate2;
    // work with the cert
  end;

  store.close();
  store.Free;

capicom reference is at http://msdn.microsoft.com/en-us/library/ms995332.aspx

if you're ok with spending money, i've heard good things about PKIBlackbox from eldos.

glob
Yes, CAPICOM is the way I would go too. I've done it in the past with CAPICOM, but I don't have any example code available anymore.
Conor Boyd
A: 

There are a complex library fom ELDOS that add complete support for work with X509 Certificates and more; Read complete description here:
components for Public Key Infrastructure (PKI) support

See the Reference for the class ElX509CertificateClass here.

Regards.

Neftalí