use of org.xipki.console.karaf.IllegalCmdParamException in project xipki by xipki.
the class PublisherUpdateCmd method execute0.
@Override
protected Object execute0() throws Exception {
if (type == null && conf == null && confFile == null) {
throw new IllegalCmdParamException("nothing to update");
}
if (conf == null && confFile != null) {
conf = new String(IoUtil.read(confFile));
}
String msg = "publisher " + name;
try {
caManager.changePublisher(name, type, conf);
println("updated " + msg);
return null;
} catch (CaMgmtException ex) {
throw new CmdFailure("could not update " + msg + ", error: " + ex.getMessage(), ex);
}
}
use of org.xipki.console.karaf.IllegalCmdParamException in project xipki by xipki.
the class UnRevRmCertAction method getSerialNumber.
protected BigInteger getSerialNumber() throws CmdFailure, IllegalCmdParamException, CertificateException, IOException {
CaEntry ca = caManager.getCa(caName);
if (ca == null) {
throw new CmdFailure("CA " + caName + " not available");
}
if (!(ca instanceof X509CaEntry)) {
throw new CmdFailure("CA " + caName + " is not an X.509-CA");
}
BigInteger serialNumber;
if (serialNumberS != null) {
serialNumber = toBigInt(serialNumberS);
} else if (certFile != null) {
X509Certificate caCert = ((X509CaEntry) ca).getCert();
X509Certificate cert = X509Util.parseCert(IoUtil.read(certFile));
if (!X509Util.issues(caCert, cert)) {
throw new CmdFailure("certificate '" + certFile + "' is not issued by CA " + caName);
}
serialNumber = cert.getSerialNumber();
} else {
throw new IllegalCmdParamException("neither serialNumber nor certFile is specified");
}
return serialNumber;
}
Aggregations