Retreive CA Certificate from LDAP

Apr 4 2006 6:30 AM

hi,
   i have a C# application that sends encrypted email messages. this piece of code needs the user's SMIME certificate inorder to send the encrypted mail. At Present there is a page that requests the user to upload hi/her certificate to our server and the application will pick up the certificate from there and send the encrypted email. Now i need to fetch these certificate details from LDAP insted of asking the user to upload the certificate. i have tried to fetch the certificate details by using some of the LDAP attributes like 'usercertificate', 'userSMIMEcertificate' but i havent been able to get a result. I need to know how i can do this.... can anyone pls tell me how to go about realising this.. i am working on .NET 2005.

This is the piece of code i am using -

ICryptoManager cryptoManager = new CryptoManager();

// HP.BI.Core.Security.UserIdentity ldap = new HP.BI.Core.Security.UserIdentity();
LDAP ldap = new LDAP();
//ldap.PropertiesToLoad = new string[18] { "usercertificate", "employeeNumber", "uid", "ntUserDomainId", "hpStatus", "cn", "sn", "givenName", "telephoneNumber", "l", "co", "hpOrganizationChart", "hpBusinessGroup", "hpBusinessRegion", "managerEmployeeNumber", "objectClass", "modifyTimestamp", "ou" };
ldap.PropertiesToLoad = new string[1] { "userSMIMECertificate;binary" };
StringDictionary res = ldap.search_employeeNumber("00542573");

foreach (string key in res.Keys)
{
Response.Write(key + " = " + res[key].ToString() + "<br>");
}


Thanks & Regards
Soumya