Announcement Announcement Module
No announcement yet.
Reading userCertificate from LDAP Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading userCertificate from LDAP

    I have to read the certificate from LDAP to check for its expiry date. My code is like this,,,,

    List<?> CNs ="", andFilter.encode(), new AttributesMapper() {

    public Object mapFromAttributes(Attributes attributes) throws NamingException {
    // TODO Auto-generated method stub
    return (Object) attributes.get("userCertificate").get(); //LINE-1get the certificate given uid:

    System.out.println("Cert List size: "+CNs.size()); // prints 1
    String temp = CNs.get(0).toString();
    InputStream in = new ByteArrayInputStream(temp.getBytes());
    CertificateFactory factory = CertificateFactory.getInstance("X509");
    X509Certificate cert = (X509Certificate) factory.generateCertificate(in); // ERROR :Could not parse certificate: Empty input

    when "userCertficate;binary" is used, it throws NullPointerException at the LINE-1
    Any idea?????????????