EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Search for issuer in storage

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#30816
Posted: 09/25/2014 10:22:32
by Martin ANDRES (Standard support level)
Joined: 09/25/2014
Posts: 18

Hi,
I would like to search the ROOT storage to check the presence of a certain certificate.
To do that I have written the following source code:

Code
WinStorageROOT := TElWinCertStorage.Create(nil);
WinStorageROOT.SystemStores.Clear;
WinStorageROOT.SystemStores.Add('ROOT');

certificateLookup := TElCertificateLookup.Create(nil);
//certificateLookup.Criteria := [lcEmail];
//certificateLookup.EmailAddresses.Add('postmaster@mpba.gov.ar');
certificateLookup.Criteria := [lcIssuer];

issuerRDN := TElRelativeDistinguishedName.Create;
issuerRDN.LoadFromDNString('/C=AR/ST=BS AS/L=La Plata/O=Ministerio P├║blico/OU=MPBA/CN=MPBA CA/E=postmaster@mpba.gov.ar', true);

certificateLookup.IssuerRDN.Assign(issuerRDN);

certificateIndex := WinStorageROOT.FindFirst(certificateLookup);

if certificateIndex = -1 then
           ShowMessage('The certicate doesn't exist');


I always get certificateIndex = -1 but if I do the search using email the certificate is found.

What am I doing wrong?

I attach the certificate that I'm trying to find. It's a crt file but I've changed the extension to txt.

I'll appreciate your help.

Thanks and regards,
Martin


[ Download ]
#30819
Posted: 09/26/2014 03:09:31
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Try to add next option to TElCertificateLookup.Options property:

Code
Lookup.Options := Lookup.Options + [loCompareRDNAsStrings];


and check if this helps.
#30823
Posted: 09/26/2014 06:09:25
by Martin ANDRES (Standard support level)
Joined: 09/25/2014
Posts: 18

Excellent!!!.

That property makes it work.

Thanks a lot for your help.

Regards,
Martin

Reply

Statistics

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