Class CertStoreBase

  • Direct Known Subclasses:
    CertStore

    public class CertStoreBase
    extends Object
    Base class to exec the database queries to manage CA system.
    Author:
    Lijun Liao (xipki)
    • Field Detail

      • SQL_ADD_CERT

        protected final String SQL_ADD_CERT
      • SQL_ADD_CRL

        protected final String SQL_ADD_CRL
      • dbSchemaVersion

        protected final int dbSchemaVersion
      • maxX500nameLen

        protected final int maxX500nameLen
      • keypairEncProvider

        protected String keypairEncProvider
      • keypairEncKeyId

        protected String keypairEncKeyId
      • keypairEncKey

        protected SecretKey keypairEncKey
      • caConfDatasource

        protected final org.xipki.datasource.DataSourceWrapper caConfDatasource
      • datasource

        protected final org.xipki.datasource.DataSourceWrapper datasource
    • Constructor Detail

      • CertStoreBase

        protected CertStoreBase​(org.xipki.datasource.DataSourceWrapper datasource,
                                org.xipki.datasource.DataSourceWrapper caConfDatasource,
                                org.xipki.password.PasswordResolver passwordResolver)
                         throws org.xipki.datasource.DataAccessException,
                                org.xipki.ca.api.mgmt.CaMgmtException
        Throws:
        org.xipki.datasource.DataAccessException
        org.xipki.ca.api.mgmt.CaMgmtException
    • Method Detail

      • updateDbInfo

        public void updateDbInfo​(org.xipki.password.PasswordResolver passwordResolver)
                          throws org.xipki.datasource.DataAccessException,
                                 org.xipki.ca.api.mgmt.CaMgmtException
        Throws:
        org.xipki.datasource.DataAccessException
        org.xipki.ca.api.mgmt.CaMgmtException
      • buildCertRevInfo

        protected static org.xipki.security.CertRevocationInfo buildCertRevInfo​(org.xipki.ca.server.db.ResultRow rs)
      • getMax

        protected long getMax​(String table,
                              String column)
                       throws org.xipki.util.exception.OperationException
        Throws:
        org.xipki.util.exception.OperationException
      • execUpdateStmt0

        protected int execUpdateStmt0​(String sql)
                               throws org.xipki.util.exception.OperationException
        Throws:
        org.xipki.util.exception.OperationException
      • execUpdatePrepStmt0

        protected int execUpdatePrepStmt0​(String sql,
                                          org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)
                                   throws org.xipki.util.exception.OperationException
        Throws:
        org.xipki.util.exception.OperationException
      • execQuery1PrepStmt0

        protected org.xipki.ca.server.db.ResultRow execQuery1PrepStmt0​(String sql,
                                                                       org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)
                                                                throws org.xipki.util.exception.OperationException
        Throws:
        org.xipki.util.exception.OperationException
      • execQueryPrepStmt0

        protected List<org.xipki.ca.server.db.ResultRow> execQueryPrepStmt0​(String sql,
                                                                            org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)
                                                                     throws org.xipki.util.exception.OperationException
        Throws:
        org.xipki.util.exception.OperationException
      • buildPrepStmt0

        protected PreparedStatement buildPrepStmt0​(String sql,
                                                   org.xipki.ca.server.db.QueryExecutor.SqlColumn2... columns)
                                            throws org.xipki.util.exception.OperationException
        Throws:
        org.xipki.util.exception.OperationException
      • execQueryLongPrepStmt

        protected long execQueryLongPrepStmt​(String sql,
                                             org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)
                                      throws org.xipki.util.exception.OperationException
        Throws:
        org.xipki.util.exception.OperationException
      • prepareStatement

        protected PreparedStatement prepareStatement​(String sqlQuery)
                                              throws org.xipki.util.exception.OperationException
        Throws:
        org.xipki.util.exception.OperationException
      • buildArraySql

        protected static String buildArraySql​(org.xipki.datasource.DataSourceWrapper datasource,
                                              String prefix,
                                              int num)
      • parseCert

        protected static org.xipki.security.X509Cert parseCert​(byte[] encodedCert)
                                                        throws org.xipki.util.exception.OperationException
        Throws:
        org.xipki.util.exception.OperationException
      • buildSelectFirstSql

        protected String buildSelectFirstSql​(String coreSql)
      • buildSelectFirstSql

        protected String buildSelectFirstSql​(String orderBy,
                                             String coreSql)
      • colBool

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn colBool​(String name,
                                                                                Boolean value)
      • colInt

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn colInt​(String name,
                                                                               Integer value)
      • colLong

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn colLong​(String name,
                                                                                Long value)
      • colStr

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn colStr​(String name,
                                                                               String value)
      • colStr

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn colStr​(String name,
                                                                               String value,
                                                                               boolean sensitive,
                                                                               boolean signerConf)
      • col2Bool

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2 col2Bool​(Boolean value)
      • col2Int

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2 col2Int​(Integer value)
      • col2Long

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2 col2Long​(Long value)
      • col2Str

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2 col2Str​(String value)
      • col2Timestamp

        protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2 col2Timestamp​(Timestamp value)
      • execUpdateStmt

        protected int execUpdateStmt​(String sql)
                              throws org.xipki.datasource.DataAccessException
        Throws:
        org.xipki.datasource.DataAccessException
      • execUpdatePrepStmt

        protected int execUpdatePrepStmt​(String sql,
                                         org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)
                                  throws org.xipki.datasource.DataAccessException
        Throws:
        org.xipki.datasource.DataAccessException
      • execQueryStmt

        protected List<org.xipki.ca.server.db.ResultRow> execQueryStmt​(String sql)
                                                                throws org.xipki.datasource.DataAccessException
        Throws:
        org.xipki.datasource.DataAccessException
      • execQuery1PrepStmt

        protected org.xipki.ca.server.db.ResultRow execQuery1PrepStmt​(String sql,
                                                                      org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)
                                                               throws org.xipki.datasource.DataAccessException
        Throws:
        org.xipki.datasource.DataAccessException
      • execQueryPrepStmt

        protected List<org.xipki.ca.server.db.ResultRow> execQueryPrepStmt​(String sql,
                                                                           org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)
                                                                    throws org.xipki.datasource.DataAccessException
        Throws:
        org.xipki.datasource.DataAccessException
      • buildPrepStmt

        protected PreparedStatement buildPrepStmt​(String sql,
                                                  org.xipki.ca.server.db.QueryExecutor.SqlColumn2... columns)
                                           throws org.xipki.datasource.DataAccessException
        Throws:
        org.xipki.datasource.DataAccessException