attributeSet = getAttributeSet(incert, getUserObjectClass(), certdn, email, true, true, password, extendedinformation);
}
try {
attribute = getUserCertAttribute();
LDAPAttribute certAttr = new LDAPAttribute(getUserCertAttribute(), incert.getEncoded());
if (oldEntry != null) {
String oldDn = oldEntry.getDN();
if (getAddMultipleCertificates()) {
modSet.add(new LDAPModification(LDAPModification.ADD, certAttr));
if (log.isDebugEnabled()) {
log.debug("Appended new certificate in user entry; " + username+": "+oldDn);
}
} else {
modSet.add(new LDAPModification(LDAPModification.REPLACE, certAttr));
if (log.isDebugEnabled()) {
log.debug("Replaced certificate in user entry; " + username+": "+oldDn);
}
}
} else {
attributeSet.add(certAttr);
if (log.isDebugEnabled()) {
log.debug("Added new certificate to user entry; " + username+": "+dn);
}
}
} catch (CertificateEncodingException e) {
String msg = intres.getLocalizedMessage("publisher.errorldapencodestore", "certificate");
log.error(msg, e);
throw new PublisherException(msg);
}
} else if ((type == SecConst.CERTTYPE_SUBCA) || (type == SecConst.CERTTYPE_ROOTCA)) {
if (log.isDebugEnabled()) {
log.debug("Publishing CA certificate to first available server of " + getHostnames());
}
if (oldEntry != null) {
modSet = getModificationSet(oldEntry, certdn, null, false, false, password);
} else {
objectclass = getCAObjectClass(); // just used for logging
attributeSet = getAttributeSet(incert, getCAObjectClass(), certdn, null, true, false, password, extendedinformation);
}
try {
attribute = getCACertAttribute();
LDAPAttribute certAttr = new LDAPAttribute(getCACertAttribute(), incert.getEncoded());
if (oldEntry != null) {
modSet.add(new LDAPModification(LDAPModification.REPLACE, certAttr));
} else {
attributeSet.add(certAttr);
// Also create using the crlattribute, it may be required
LDAPAttribute crlAttr = new LDAPAttribute(getCRLAttribute(), getFakeCRL());
attributeSet.add(crlAttr);
// Also create using the arlattribute, it may be required
LDAPAttribute arlAttr = new LDAPAttribute(getARLAttribute(), getFakeCRL());
attributeSet.add(arlAttr);
if (log.isDebugEnabled()) {
log.debug("Added (fake) attribute for CRL and ARL.");
}
}