use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class UserInfoCmd method execute0.
@Override
protected Object execute0() throws Exception {
UserEntry userEntry = caManager.getUser(name);
if (userEntry == null) {
throw new CmdFailure("no user named '" + name + "' is configured");
}
StringBuilder sb = new StringBuilder();
sb.append(userEntry);
Map<String, CaHasUserEntry> caHasUsers = caManager.getCaHasUsersForUser(name);
for (String ca : caHasUsers.keySet()) {
CaHasUserEntry entry = caHasUsers.get(ca);
sb.append("\n----- CA ").append(ca).append("-----");
sb.append("\nprofiles: ").append(entry.getProfiles());
sb.append("\npermission: ").append(entry.getPermission());
}
println(sb.toString());
return null;
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class CrlAction method execute0.
@Override
protected Object execute0() throws Exception {
CaEntry ca = caManager.getCa(caName);
if (ca == null) {
throw new CmdFailure("CA " + caName + " not available");
}
X509CRL crl = null;
try {
crl = retrieveCrl();
} catch (Exception ex) {
throw new CmdFailure("received no CRL from server: " + ex.getMessage());
}
if (crl == null) {
throw new CmdFailure("received no CRL from server");
}
if (outFile != null) {
saveVerbose("saved CRL to file", new File(outFile), crl.getEncoded());
}
return null;
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class UnrevokeCertCmd method execute0.
@Override
protected Object execute0() throws Exception {
BigInteger serialNo = getSerialNumber();
String msg = "certificate (serial number = 0x" + serialNo.toString(16) + ")";
try {
caManager.unrevokeCertificate(caName, serialNo);
println("unrevoked " + msg);
return null;
} catch (CaMgmtException ex) {
throw new CmdFailure("could not unrevoke " + msg + ", error: " + ex.getMessage(), ex);
}
}
use of org.xipki.console.karaf.CmdFailure in project xipki by xipki.
the class ProfileRemoveCmd method execute0.
@Override
protected Object execute0() throws Exception {
String msg = "certificate profile " + name;
try {
caManager.removeCertprofile(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 PublisherInfoCmd method execute0.
@Override
protected Object execute0() throws Exception {
if (name == null) {
Set<String> names = caManager.getPublisherNames();
int size = names.size();
StringBuilder sb = new StringBuilder();
if (size == 0 || size == 1) {
sb.append((size == 0) ? "no" : "1");
sb.append(" publisher is configured\n");
} else {
sb.append(size).append(" publishers are configured:\n");
}
List<String> sorted = new ArrayList<>(names);
Collections.sort(sorted);
for (String entry : sorted) {
sb.append("\t").append(entry).append("\n");
}
println(sb.toString());
} else {
PublisherEntry entry = caManager.getPublisher(name);
if (entry == null) {
throw new CmdFailure("\tno publisher named '" + name + "' is configured");
} else {
println(entry.toString());
}
}
return null;
}
Aggregations