Announcement Announcement Module
Collapse
No announcement yet.
Storing Digital Certficate in LDAP Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Storing Digital Certficate in LDAP

    I wanted to store a X509 Digital Certificate in LDAP. I am using Apache DS. The User will first upload a Digital Certificate which will then be stored in the LDAP's userCertificate attribute. Currently i am able to upload the certificate successfully, but the LDAP's userCertificate attribute value shows Invalid Certificate. The following code snippets stores the certificate in the LDAP:

    DistinguishedName dn = new DistinguishedName();
    dn.add("ou=FS");
    dn.add("cn="+getUserName(userId));
    DirContextOperations context = ldapTemplate.lookupContext(dn);
    context.setAttributeValue("userCertificate",certif icate.getFile().getFileItem().get());
    ldapTemplate.modifyAttributes(context);


    The Following is my Certificate class:

    public class Certificate {

    private String name;
    private CommonsMultipartFile file;

    public void setFile(CommonsMultipartFile file) {
    this.file = file;
    this.name=file.getOriginalFilename();
    }

    public CommonsMultipartFile getFile() {
    return file;
    }

    public void setName(String name) {
    this.name = name;
    }

    public String getName() {
    return name;
    }

    @Override
    public String toString() {
    return "Certificate [name=" + name + ", file=" + file + "]";
    }

    }
Working...
X