certGen.setNotBefore( startDate );
certGen.setNotAfter( expiryDate );
certGen.setSubjectDN( subjectName );
certGen.setPublicKey( publicKey );
certGen.setSignatureAlgorithm( "SHA1With" + keyAlgo );
X509Certificate cert = certGen.generate( privateKey, "BC" );
modifications.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
USER_CERTIFICATE_AT, cert.getEncoded() ) ) );
// Write the modifications
ldapServer.getDirectoryService().getAdminSession().modify( dn, modifications );