use of org.xipki.audit.AuditEvent in project xipki by xipki.
the class X509Ca method newAuditEvent.
private AuditEvent newAuditEvent(String name, String eventType, String msgId) {
ParamUtil.requireNonNull("name", name);
ParamUtil.requireNonNull("eventType", eventType);
ParamUtil.requireNonNull("msgId", msgId);
AuditEvent event = new AuditEvent(new Date());
event.setApplicationName(CaAuditConstants.APPNAME);
event.setName(name);
event.addEventData(CaAuditConstants.NAME_ca, caIdent.getName());
event.addEventType(eventType);
event.addEventData(CaAuditConstants.NAME_mid, msgId);
return event;
}
use of org.xipki.audit.AuditEvent in project xipki by xipki.
the class X509Ca method unrevokeCa.
// method revokeCa
public void unrevokeCa(String msgId) throws OperationException {
caInfo.setRevocationInfo(null);
if (caInfo.isSelfSigned()) {
AuditEvent event = newPerfAuditEvent(CaAuditConstants.TYPE_unrevoke_cert, msgId);
boolean successful = true;
try {
unrevokeCertificate0(caInfo.getSerialNumber(), true, event);
successful = true;
} finally {
finish(event, successful);
}
}
boolean failed = false;
for (IdentifiedX509CertPublisher publisher : publishers()) {
NameId ident = publisher.getIdent();
boolean successful = publisher.caUnrevoked(caCert);
if (successful) {
LOG.info("published event caUnrevoked of CA {} to publisher {}", caIdent, ident);
} else {
failed = true;
LOG.error("could not publish event caUnrevoked of CA {} to publisher {}", caIdent, ident);
}
}
if (failed) {
final String message = "could not event caUnrevoked of CA " + caIdent + " to at least one publisher";
throw new OperationException(ErrorCode.SYSTEM_FAILURE, message);
}
}
use of org.xipki.audit.AuditEvent in project xipki by xipki.
the class X509Ca method unrevokeCertificate.
// method revokeCertificate
public X509CertWithDbId unrevokeCertificate(BigInteger serialNumber, String msgId) throws OperationException {
if (caInfo.isSelfSigned() && caInfo.getSerialNumber().equals(serialNumber)) {
throw new OperationException(ErrorCode.NOT_PERMITTED, "insufficient permission unrevoke CA certificate");
}
AuditEvent event = newPerfAuditEvent(CaAuditConstants.TYPE_unrevoke_cert, msgId);
boolean successful = true;
try {
X509CertWithDbId ret = unrevokeCertificate0(serialNumber, false, event);
successful = true;
return ret;
} finally {
finish(event, successful);
}
}
use of org.xipki.audit.AuditEvent in project xipki by xipki.
the class X509Ca method revokeCertificate.
// method publishCrl
public X509CertWithRevocationInfo revokeCertificate(BigInteger serialNumber, CrlReason reason, Date invalidityTime, String msgId) throws OperationException {
if (caInfo.isSelfSigned() && caInfo.getSerialNumber().equals(serialNumber)) {
throw new OperationException(ErrorCode.NOT_PERMITTED, "insufficient permission to revoke CA certificate");
}
CrlReason tmpReason = reason;
if (tmpReason == null) {
tmpReason = CrlReason.UNSPECIFIED;
}
switch(tmpReason) {
case CA_COMPROMISE:
case AA_COMPROMISE:
case REMOVE_FROM_CRL:
throw new OperationException(ErrorCode.NOT_PERMITTED, "Insufficient permission revoke certificate with reason " + tmpReason.getDescription());
case UNSPECIFIED:
case KEY_COMPROMISE:
case AFFILIATION_CHANGED:
case SUPERSEDED:
case CESSATION_OF_OPERATION:
case CERTIFICATE_HOLD:
case PRIVILEGE_WITHDRAWN:
break;
default:
throw new RuntimeException("unknown CRL reason " + tmpReason);
}
// switch (reason)
AuditEvent event = newPerfAuditEvent(CaAuditConstants.TYPE_revoke_cert, msgId);
boolean successful = true;
try {
X509CertWithRevocationInfo ret = revokeCertificate0(serialNumber, reason, invalidityTime, false, event);
successful = (ret != null);
return ret;
} finally {
finish(event, successful);
}
}
use of org.xipki.audit.AuditEvent in project xipki by xipki.
the class X509Ca method removeExpirtedCerts.
// method getCrlNextUpdate
private int removeExpirtedCerts(Date expiredAtTime, String msgId) throws OperationException {
LOG.debug("revoking suspended certificates");
AuditEvent event = newPerfAuditEvent(CaAuditConstants.TYPE_remove_expiredCerts, msgId);
boolean successful = false;
try {
int num = removeExpirtedCerts0(expiredAtTime, event, msgId);
LOG.info("removed {} expired certificates of CA {}", num, caIdent);
successful = true;
return num;
} finally {
finish(event, successful);
}
}
Aggregations