i am using iPlanet web server and LDAP server i am able to get all attributes of OU in directory serevr, in my directory server i have added one attribute of an OU that is cacertificate and now i want to access the thumbprint of that certiicate, Can you please help me in getting the thubmprint of certificates stored in differend directories.
my code is as follow:
public static LinkedList search(
String param[])
{
Hashtable env = new Hashtable();
String entries=null;
LinkedList entriesList=new LinkedList();
if((param[0]==null || param[0].length()==0))
entriesList.add("Host name not found....");
if((param[3]==null || param[3].length()==0))
entriesList.add("Search base not specified....");
if((param[4]==null || param[4].length()==0))
entriesList.add("Search criteria blank....");
if(entriesList.size()>0)
return entriesList;
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
/* param[0]=URL of LDAP Serever e.i.
ldap://host:389 */
env.put(Context.PROVIDER_URL,param[0]);
try{
DirContext ctx=new InitialDirContext(env);
SearchControls constraints = new
SearchControls();
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
/*
pram[3]=search base i.e. o=root and param[4]=Search condition i.e. objectClass=*
*/
NamingEnumeration results=ctx.search(param[3],param[4],constraints);
Attributes attr = null;
Enumeration enm=null;
while(results!=null && results.hasMore())
{
SearchResult sr = (SearchResult) results.next();
entries=sr.getName();
attr=sr.getAttributes();
enm=attr.getAll();
while(enm.hasMoreElements())
{
entries+=enm.nextElement()+", ";
}
entriesList.add(entries);
}
}catch(Exception e)
{
e.printStackTrace();
}
return entriesList;
}
Regards,
Alok