certGen.setPublicKey(key_pair.getPublic());
certGen.setSignatureAlgorithm("SHA1withRSA");
final X509Certificate certificate = certGen.generate(key_pair.getPrivate(), "BC");
final String fingerprint = CertTools.getFingerprintAsString(certificate);
// We add all certificates that does not have a user already to "missing_user_name"
final UserDataVO missingUserDataVO = ejb.getUserAdminSession().findUser(getAdmin(), missing_user_name);
if (missingUserDataVO == null) {
// Add the user and change status to REVOKED
getLogger().debug("Loading/updating user " + missing_user_name);
final UserDataVO userdataNew = new UserDataVO(missing_user_name, CertTools.getSubjectDN(certificate), cainfo.getCAId(), null, null,
UserDataConstants.STATUS_NEW, SecConst.USER_ENDUSER, SecConst.EMPTY_ENDENTITYPROFILE,
SecConst.CERTPROFILE_FIXED_ENDUSER, null, null, SecConst.TOKEN_SOFT_BROWSERGEN, SecConst.NO_HARDTOKENISSUER, null);
userdataNew.setPassword("foo123");
ejb.getUserAdminSession().addUser(getAdmin(), userdataNew, false);
getLogger().info("User '" + missing_user_name + "' has been added.");
ejb.getUserAdminSession().setUserStatus(getAdmin(), missing_user_name, UserDataConstants.STATUS_REVOKED);
getLogger().info("User '" + missing_user_name + "' has been updated.");
}