use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class PublisherRemoveCmd method execute0.
@Override
protected Object execute0() throws Exception {
String msg = "publisher " + name;
try {
caManager.removePublisher(name);
println("removed " + msg);
return null;
} catch (CaMgmtException ex) {
throw new CmdFailure("could not remove " + msg + ", error: " + ex.getMessage(), ex);
}
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class RepublishCmd method execute0.
@Override
protected Object execute0() throws Exception {
if (publisherNames == null) {
throw new RuntimeException("should not reach here");
}
boolean allPublishers = false;
for (String publisherName : publisherNames) {
if ("all".equalsIgnoreCase(publisherName)) {
allPublishers = true;
break;
}
}
if (allPublishers) {
publisherNames = null;
}
if ("all".equalsIgnoreCase(caName)) {
caName = null;
}
String msg = "certificates";
try {
caManager.republishCertificates(caName, publisherNames, numThreads);
println("republished " + msg);
return null;
} catch (CaMgmtException ex) {
throw new CmdFailure("could not republish " + msg + ", error: " + ex.getMessage(), ex);
}
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class ResponderCheckCmd method execute0.
@Override
protected Object execute0() throws Exception {
println("checking responder " + name);
ResponderEntry cr = caManager.getResponder(name);
if (cr == null) {
throw new CmdFailure("responder named '" + name + "' is not configured");
}
if (CaManager.NULL.equalsIgnoreCase(certFile)) {
if (cr.getBase64Cert() != null) {
throw new CmdFailure("Cert: is configured but expected is none");
}
} else if (certFile != null) {
byte[] ex = IoUtil.read(certFile);
if (cr.getBase64Cert() == null) {
throw new CmdFailure("Cert: is not configured explicitly as expected");
}
if (!Arrays.equals(ex, Base64.decode(cr.getBase64Cert()))) {
throw new CmdFailure("Cert: the expected one and the actual one differ");
}
}
String signerConf = getSignerConf();
if (signerConf != null) {
MgmtQaShellUtil.assertEquals("conf", signerConf, cr.getConf());
}
println(" checked responder " + name);
return null;
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class GetCertCmd method execute0.
@Override
protected Object execute0() throws Exception {
Client client = getScepClient();
BigInteger serial = toBigInt(serialNumber);
CertStore certs = client.getCertificate(getIdentityCert(), getIdentityKey(), serial, null);
X509Certificate cert = extractEeCerts(certs);
if (cert == null) {
throw new CmdFailure("received no certificate from server");
}
saveVerbose("saved returned certificate to file", new File(outputFile), cert.getEncoded());
return null;
}
Aggregations