Search in sources :

Example 46 with CaMgmtException

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

the class ResponderUpdateCmd method execute0.

@Override
protected Object execute0() throws Exception {
    String cert = null;
    if (CaManager.NULL.equalsIgnoreCase(certFile)) {
        cert = CaManager.NULL;
    } else if (certFile != null) {
        byte[] certBytes = IoUtil.read(certFile);
        X509Util.parseCert(new ByteArrayInputStream(certBytes));
        cert = Base64.encodeToString(certBytes);
    }
    String msg = "CMP responder " + name;
    try {
        caManager.changeResponder(name, signerType, getSignerConf(), cert);
        println("updated " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not update " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) ByteArrayInputStream(java.io.ByteArrayInputStream) CmdFailure(org.xipki.console.karaf.CmdFailure)

Example 47 with CaMgmtException

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

the class UserAddCmd method execute0.

@Override
protected Object execute0() throws Exception {
    if (password == null) {
        password = new String(readPassword());
    }
    AddUserEntry userEntry = new AddUserEntry(new NameId(null, name), !inactive, password);
    String msg = "user " + name;
    try {
        caManager.addUser(userEntry);
        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) AddUserEntry(org.xipki.ca.server.mgmt.api.AddUserEntry)

Example 48 with CaMgmtException

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

the class UserRemoveCmd method execute0.

@Override
protected Object execute0() throws Exception {
    String msg = "user " + name;
    try {
        caManager.removeUser(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 49 with CaMgmtException

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

the class CaSystemUnlockCmd method execute0.

@Override
protected Object execute0() throws Exception {
    try {
        caManager.unlockCa();
        println("unlocked CA system, calling ca:restart to restart CA system");
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not unlock CA system, error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure)

Example 50 with CaMgmtException

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

the class CaUpdateCmd method execute0.

// method getChangeCaEntry
@Override
protected Object execute0() throws Exception {
    String msg = "CA " + caName;
    try {
        caManager.changeCa(getChangeCaEntry());
        println("updated " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not update " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure)

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