Search in sources :

Example 66 with CaMgmtException

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

the class ProfileAddCmd method execute0.

@Override
protected Object execute0() throws Exception {
    if (conf == null && confFile != null) {
        conf = new String(IoUtil.read(confFile));
    }
    CertprofileEntry entry = new CertprofileEntry(new NameId(null, name), type, conf);
    String msg = "certificate profile " + name;
    try {
        caManager.addCertprofile(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) NameId(org.xipki.ca.api.NameId) CmdFailure(org.xipki.console.karaf.CmdFailure) CertprofileEntry(org.xipki.ca.server.mgmt.api.CertprofileEntry)

Example 67 with CaMgmtException

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

the class ProfileUpdateCmd method execute0.

@Override
protected Object execute0() throws Exception {
    if (type == null && conf == null && confFile == null) {
        throw new IllegalCmdParamException("nothing to update");
    }
    if (conf == null && confFile != null) {
        conf = new String(IoUtil.read(confFile));
    }
    String msg = "certificate profile " + name;
    try {
        caManager.changeCertprofile(name, type, conf);
        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) IllegalCmdParamException(org.xipki.console.karaf.IllegalCmdParamException)

Example 68 with CaMgmtException

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

the class CaAddCmd method execute0.

@Override
protected Object execute0() throws Exception {
    X509CaEntry caEntry = getCaEntry();
    if (certFile != null) {
        X509Certificate caCert = X509Util.parseCert(certFile);
        caEntry.setCert(caCert);
    }
    String msg = "CA " + caEntry.getIdent().getName();
    try {
        caManager.addCa(caEntry);
        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) X509Certificate(java.security.cert.X509Certificate) X509CaEntry(org.xipki.ca.server.mgmt.api.x509.X509CaEntry)

Example 69 with CaMgmtException

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

the class CaAliasAddCmd method execute0.

@Override
protected Object execute0() throws Exception {
    String msg = "CA alias " + caAlias + " associated with CA " + caName;
    try {
        caManager.addCaAlias(caAlias, 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) CmdFailure(org.xipki.console.karaf.CmdFailure)

Example 70 with CaMgmtException

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

the class CaAliasRemoveCmd method execute0.

@Override
protected Object execute0() throws Exception {
    String msg = "CA alias " + caAlias;
    try {
        caManager.removeCaAlias(caAlias);
        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)

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