EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Searching for email with ELCertificateLookup

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#3580
Posted: 08/17/2007 03:41:38
by Alexander Bauer (Standard support level)
Joined: 08/17/2007
Posts: 3

I want to search an CertStorage for certificates which belongs to a specific email address.

I tried the following code:
Code
  CertificateLookup := TElCertificateLookup.Create(self);
  try
    CertificateLookup.SubjectRDN.Add(SB_CERT_OID_EMAIL, EmailAddress);
    CertificateLookup.Criteria := [lcSubject];
    CertificateLookup.Options := [loExactMatch];
    CertIndex := CertStorage.FindFirst(CertificateLookup);
    if (CertIndex >= 0) then
    begin
      Result := TElX509Certificate.Create(nil);
      CertStorage.Certificates[CertIndex].Clone(Result);
    end;
  finally
    CertificateLookup.Free;
  end;

But it dosen't find the certificate.

Now i'm using successfully this code:
Code
  for i:=0 to CertStorage.Count - 1 do
  begin
    address := GetOIDValue(CertStorage.Certificates[i].SubjectRDN, SB_CERT_OID_EMAIL);
    if CompareText(address, EmailAddress) = 0 then
    begin
      Result := TElX509Certificate.Create(nil);
      CertStorage.Certificates[i].Clone(Result);
    end;
  end;

Can you give me an example how to use ElCertificateLookup in the right way.

Alex
#3582
Posted: 08/17/2007 04:18:43
by Ken Ivanov (EldoS Corp.)

Please turn off the loExactMatch option. This should help. You can also use lcEmail lookup criterion instead of lcSubject.
#3583
Posted: 08/17/2007 04:59:19
by Alexander Bauer (Standard support level)
Joined: 08/17/2007
Posts: 3

Thanks for the fast response.

Now i'm happy with the following code:
Code
  CertificateLookup := TElCertificateLookup.Create(self);
  try
    CertificateLookup.EmailAddresses.Add(EmailAddress);
    CertificateLookup.Criteria := [lcEmail];
    CertIndex := CertStorage.FindFirst(CertificateLookup);
    if (CertIndex >= 0) then
    begin
      Result := TElX509Certificate.Create(nil);
      CertStorage.Certificates[CertIndex].Clone(Result);
    end;
  finally
    CertificateLookup.Free;
  end;


But my documentation (SecureBlackbox.chm) is missing the property 'EmailAddresses' and criteria 'lcEmail'.
Is an updated documentation available ?

Alex
#3585
Posted: 08/17/2007 05:10:12
by Ken Ivanov (EldoS Corp.)

Thank you for pointing us at this. I reported your message to the techwriter, so this lack will be fixed ASAP.

Reply

Statistics

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