1

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

Before asking this question I have googled, but have not found any useful info.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Daniil Harik
  • 4,619
  • 10
  • 55
  • 60

3 Answers3

3

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
  • 2,960
  • 17
  • 21
  • 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 Oct 27 '09 at 19:56
0

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

Or do you search an API Wrapper?

ba__friend
  • 5,783
  • 2
  • 27
  • 20
0

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.