use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class PublisherCheckCmd method execute0.
@Override
protected Object execute0() throws Exception {
println("checking publisher " + name);
PublisherEntry cp = caManager.getPublisher(name);
if (cp == null) {
throw new CmdFailure("publisher named '" + name + "' is not configured");
}
if (cp.getType() != null) {
MgmtQaShellUtil.assertEquals("type", type, cp.getType());
}
if (cp.getConf() != null) {
MgmtQaShellUtil.assertEquals("signer conf", conf, cp.getConf());
}
println(" checked publisher " + name);
return null;
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class CertPollCmd method execute0.
@Override
protected Object execute0() throws Exception {
PKCS10CertificationRequest csr = new PKCS10CertificationRequest(IoUtil.read(csrFile));
Client client = getScepClient();
TransactionId transId = TransactionId.createTransactionId(CertificationRequestUtils.getPublicKey(csr), "SHA-1");
EnrollmentResponse resp = client.poll(getIdentityCert(), getIdentityKey(), new X500Principal(csr.getSubject().getEncoded()), transId);
if (resp.isFailure()) {
throw new CmdFailure("server returned 'failure'");
}
if (resp.isPending()) {
throw new CmdFailure("server returned 'pending'");
}
X509Certificate cert = extractEeCerts(resp.getCertStore());
if (cert == null) {
throw new Exception("received no certificate");
}
saveVerbose("saved polled certificate to file", new File(outputFile), cert.getEncoded());
return null;
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class EnrollCertAction method execute0.
@Override
protected Object execute0() throws Exception {
Client client = getScepClient();
PKCS10CertificationRequest csr = new PKCS10CertificationRequest(IoUtil.read(csrFile));
EnrollmentResponse resp = requestCertificate(client, csr, getIdentityKey(), getIdentityCert());
if (resp.isFailure()) {
throw new CmdFailure("server returned 'failure'");
}
if (resp.isPending()) {
throw new CmdFailure("server returned 'pending'");
}
X509Certificate cert = extractEeCerts(resp.getCertStore());
if (cert == null) {
throw new Exception("received no certificate");
}
saveVerbose("saved enrolled certificate to file", new File(outputFile), cert.getEncoded());
return null;
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class CaPublisherCheckCmd method execute0.
@Override
protected Object execute0() throws Exception {
println("checking CA publisher CA='" + caName + "', publisher='" + publisherName + "'");
if (caManager.getCa(caName) == null) {
throw new CmdFailure("could not find CA '" + caName + "'");
}
List<PublisherEntry> entries = caManager.getPublishersForCa(caName);
String upPublisherName = publisherName.toLowerCase();
for (PublisherEntry m : entries) {
if (m.getIdent().getName().equals(upPublisherName)) {
println(" checked CA publisher CA='" + caName + "', publisher='" + publisherName + "'");
return null;
}
}
throw new CmdFailure("CA is not associated with publisher '" + publisherName + "'");
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class CmpControlCheckCmd method execute0.
@Override
protected Object execute0() throws Exception {
println("checking CMP control " + name);
CmpControlEntry ce = caManager.getCmpControl(name);
if (ce == null) {
throw new CmdFailure("no CMP control named '" + name + "' is configured");
}
String is = ce.getConf();
String ex = new CmpControl(new CmpControlEntry(name, conf)).getDbEntry().getConf();
MgmtQaShellUtil.assertEquals("CMP control", ex, is);
println(" checked CMP control " + name);
return null;
}
Aggregations