Search in sources :

Example 51 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class CaUserRemoveCmd method execute0.

@Override
protected Object execute0() throws Exception {
    String msg = "user " + userName + " from CA " + caName;
    try {
        caManager.removeUserFromCa(userName, caName);
        println("removed " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not remove " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure)

Example 52 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class CmpControlAddCmd method execute0.

@Override
protected Object execute0() throws Exception {
    CmpControlEntry entry = new CmpControlEntry(name, conf);
    String msg = "CMP control " + name;
    try {
        caManager.addCmpControl(entry);
        println("added " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not add " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure) CmpControlEntry(org.xipki.ca.server.mgmt.api.CmpControlEntry)

Example 53 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class CmpControlRemoveCmd method execute0.

@Override
protected Object execute0() throws Exception {
    String msg = "CMP control " + name;
    try {
        caManager.removeCmpControl(name);
        println("removed " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not remove " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure)

Example 54 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class CrlSignerAddCmd method execute0.

@Override
protected Object execute0() throws Exception {
    String base64Cert = null;
    if (!"CA".equalsIgnoreCase(signerType)) {
        if (signerCertFile != null) {
            byte[] encodedCert = IoUtil.read(signerCertFile);
            base64Cert = IoUtil.base64Encode(encodedCert, false);
            X509Util.parseCert(encodedCert);
        }
        if (signerConf != null) {
            if ("PKCS12".equalsIgnoreCase(signerType) || "JKS".equalsIgnoreCase(signerType)) {
                signerConf = ShellUtil.canonicalizeSignerConf(signerType, signerConf, passwordResolver, securityFactory);
            }
        }
    }
    X509CrlSignerEntry entry = new X509CrlSignerEntry(name, signerType, signerConf, base64Cert, crlControl);
    String msg = "CRL signer " + name;
    try {
        caManager.addCrlSigner(entry);
        println("added " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not add " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure) X509CrlSignerEntry(org.xipki.ca.server.mgmt.api.x509.X509CrlSignerEntry)

Example 55 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class CaRequestorAddCmd method execute0.

@Override
protected Object execute0() throws Exception {
    boolean ra = isEnabled(raS, false, "ra");
    CaHasRequestorEntry entry = new CaHasRequestorEntry(new NameId(null, requestorName));
    entry.setRa(ra);
    entry.setProfiles(profiles);
    int intPermission = ShellUtil.getPermission(permissions);
    entry.setPermission(intPermission);
    String msg = "requestor " + requestorName + " to CA " + caName;
    try {
        caManager.addRequestorToCa(entry, caName);
        println("added " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not add " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) NameId(org.xipki.ca.api.NameId) CmdFailure(org.xipki.console.karaf.CmdFailure) CaHasRequestorEntry(org.xipki.ca.server.mgmt.api.CaHasRequestorEntry)

Aggregations

CaMgmtException (org.xipki.ca.server.mgmt.api.CaMgmtException)157 PreparedStatement (java.sql.PreparedStatement)63 SQLException (java.sql.SQLException)63 CmdFailure (org.xipki.console.karaf.CmdFailure)52 NameId (org.xipki.ca.api.NameId)31 ResultSet (java.sql.ResultSet)24 OperationException (org.xipki.ca.api.OperationException)18 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)16 InvalidConfException (org.xipki.common.InvalidConfException)11 DataAccessException (org.xipki.datasource.DataAccessException)11 CertificateEncodingException (java.security.cert.CertificateEncodingException)9 CaHasRequestorEntry (org.xipki.ca.server.mgmt.api.CaHasRequestorEntry)9 CertificateException (java.security.cert.CertificateException)8 ObjectCreationException (org.xipki.common.ObjectCreationException)8 X509Certificate (java.security.cert.X509Certificate)7 Date (java.util.Date)7 X509CaEntry (org.xipki.ca.server.mgmt.api.x509.X509CaEntry)7 IOException (java.io.IOException)6 Statement (java.sql.Statement)6 CaHasUserEntry (org.xipki.ca.server.mgmt.api.CaHasUserEntry)6