download a certificate from a ldap server in java -
can explain me whether following code correct download certificate ties specific person in java? getting exception "unknown protocol: ldaps".
public void downloadcert() { string urlstr="ldaps://aserversomewhere:636/cn=doe%20john,ou=personnel,o=comany123,c=us?cacertificate;binary"; url url = null; try { url = new url(urlstr); urlconnection con = url.openconnection(); inputstream = con.getinputstream(); certificatefactory certfactory = certificatefactory.getinstance("x.509"); x509certificate cert = (x509certificate)certfactory.generatecertificate(is); system.out.println("getversion: " + cert.getversion()); } catch (exception e) { system.out.println(e.getmessage()); } }
no isn't correct. there no handler ldaps: protocol in url/urlconnection system.
you can use jndi cacertificate attribute of user, via dircontext.getattributes().
Comments
Post a Comment