Package org.xipki.ca.server.db
Class DbCertStore
- java.lang.Object
-
- org.xipki.ca.server.db.DbCertStore
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.xipki.ca.server.CertStore
CertStore.CertStatus, CertStore.SerialWithId
-
-
Field Summary
Fields Modifier and Type Field Description protected org.xipki.datasource.DataSourceWrapperdatasource
-
Constructor Summary
Constructors Constructor Description DbCertStore(org.xipki.datasource.DataSourceWrapper datasource, CaConfStore caConfStore, UniqueIdGenerator idGenerator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCa(org.xipki.ca.api.NameId ident, org.xipki.security.X509Cert caCert, org.xipki.security.CertRevocationInfo caRevInfo)booleanaddCert(org.xipki.ca.api.CertificateInfo certInfo, boolean saveKeypair)voidaddCertProfile(org.xipki.ca.api.NameId ident)voidaddCrl(org.xipki.ca.api.NameId ca, org.bouncycastle.cert.X509CRLHolder crl)voidaddRequestor(org.xipki.ca.api.NameId ident)protected PreparedStatementbuildPrepStmt(String sql, org.xipki.ca.server.db.QueryExecutor.SqlColumn2... columns)protected StringbuildSelectFirstSql(String coreSql)protected StringbuildSelectFirstSql(String orderBy, String coreSql)intcleanupCrls(org.xipki.ca.api.NameId ca, int numCrls)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2col2Bool(Boolean value)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2col2Int(Integer value)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2col2Long(Long value)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2col2Str(String value)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumn2col2Timestamp(Timestamp value)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumncolBool(String name, Boolean value)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumncolInt(String name, Integer value)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumncolLong(String name, Long value)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumncolStr(String name, String value)protected static org.xipki.ca.server.db.QueryExecutor.SqlColumncolStr(String name, String value, boolean sensitive, boolean signerConf)protected org.xipki.ca.server.db.ResultRowexecQuery1PrepStmt(String sql, org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)protected List<org.xipki.ca.server.db.ResultRow>execQueryPrepStmt(String sql, org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)protected List<org.xipki.ca.server.db.ResultRow>execQueryStmt(String sql)protected intexecUpdatePrepStmt(String sql, org.xipki.ca.server.db.QueryExecutor.SqlColumn2... params)protected intexecUpdateStmt(String sql)org.xipki.security.X509CertgetCert(org.bouncycastle.asn1.x500.X500Name subjectName, String transactionId)Get certificate for given subject and transactionId.org.xipki.ca.api.CertificateInfogetCertForId(org.xipki.ca.api.NameId ca, org.xipki.security.X509Cert caCert, long certId, CaIdNameMap idNameMap)longgetCertId(org.xipki.ca.api.NameId ca, BigInteger serial)org.xipki.ca.api.CertificateInfogetCertInfo(org.xipki.ca.api.NameId ca, org.xipki.security.X509Cert caCert, BigInteger serial, CaIdNameMap idNameMap)List<CertRevInfoWithSerial>getCertsForDeltaCrl(org.xipki.ca.api.NameId ca, BigInteger baseCrlNumber, Instant notExpiredAt)CertStore.CertStatusgetCertStatusForSubject(org.xipki.ca.api.NameId ca, org.bouncycastle.asn1.x500.X500Name subject)org.xipki.ca.api.mgmt.CertWithRevocationInfogetCertWithRevocationInfo(int caId, BigInteger serial, CaIdNameMap idNameMap)org.xipki.ca.api.mgmt.CertWithRevocationInfogetCertWithRevocationInfo(long certId, CaIdNameMap idNameMap)org.xipki.ca.api.mgmt.CertWithRevocationInfogetCertWithRevocationInfoBySubject(int caId, org.bouncycastle.asn1.x500.X500Name subject, byte[] san, CaIdNameMap idNameMap)longgetCountOfCerts(long notBeforeSince)longgetCountOfCerts(org.xipki.ca.api.NameId ca, boolean onlyRevoked)byte[]getEncodedCrl(org.xipki.ca.api.NameId ca, BigInteger crlNumber)List<CertStore.SerialWithId>getExpiredUnrevokedSerialNumbers(org.xipki.ca.api.NameId ca, long expiredAt, int numEntries)longgetMaxCrlNumber(org.xipki.ca.api.NameId ca)longgetMaxFullCrlNumber(org.xipki.ca.api.NameId ca)List<CertRevInfoWithSerial>getRevokedCerts(org.xipki.ca.api.NameId ca, Instant notExpiredAt, long startId, int numEntries)List<CertStore.SerialWithId>getSerialNumbers(org.xipki.ca.api.NameId ca, long startId, int numEntries, boolean onlyRevoked)List<CertStore.SerialWithId>getSuspendedCertSerials(org.xipki.ca.api.NameId ca, Instant latestLastUpdate, int numEntries)longgetThisUpdateOfCurrentCrl(org.xipki.ca.api.NameId ca, boolean deltaCrl)booleanisHealthy()List<org.xipki.ca.api.mgmt.CertListInfo>listCerts(org.xipki.ca.api.NameId ca, org.bouncycastle.asn1.x500.X500Name subjectPattern, Instant validFrom, Instant validTo, org.xipki.ca.api.mgmt.CertListOrderBy orderBy, int numEntries)protected voidnotNulls(Object param1, String name1, Object param2, String name2)protected voidnotNulls(Object param1, String name1, Object param2, String name2, Object param3, String name3)protected voidnotNulls(Object param1, String name1, Object param2, String name2, Object param3, String name3, Object param4, String name4)voidremoveCa(String name)voidremoveCert(long id)voidremoveCertProfile(String name)voidremoveRequestor(String name)voidrevokeCa(String caName, org.xipki.security.CertRevocationInfo revocationInfo)org.xipki.ca.api.mgmt.CertWithRevocationInforevokeCert(org.xipki.ca.api.NameId ca, BigInteger serialNumber, org.xipki.security.CertRevocationInfo revInfo, boolean force, CaIdNameMap idNameMap)org.xipki.ca.api.mgmt.CertWithRevocationInforevokeSuspendedCert(org.xipki.ca.api.NameId ca, CertStore.SerialWithId serialNumber, org.xipki.security.CrlReason reason, CaIdNameMap idNameMap)voidunrevokeCa(String caName)org.xipki.ca.api.CertWithDbIdunsuspendCert(org.xipki.ca.api.NameId ca, BigInteger serialNumber, boolean force, CaIdNameMap idNamMap)voidupdateDbInfo()
-
-
-
Constructor Detail
-
DbCertStore
public DbCertStore(org.xipki.datasource.DataSourceWrapper datasource, CaConfStore caConfStore, UniqueIdGenerator idGenerator) throws org.xipki.datasource.DataAccessException, org.xipki.ca.api.mgmt.CaMgmtException- Throws:
org.xipki.datasource.DataAccessExceptionorg.xipki.ca.api.mgmt.CaMgmtException
-
-
Method Detail
-
removeCa
public void removeCa(String name) throws org.xipki.ca.api.mgmt.CaMgmtException
-
removeCertProfile
public void removeCertProfile(String name) throws org.xipki.ca.api.mgmt.CaMgmtException
- Specified by:
removeCertProfilein interfaceCertStore- Throws:
org.xipki.ca.api.mgmt.CaMgmtException
-
removeRequestor
public void removeRequestor(String name) throws org.xipki.ca.api.mgmt.CaMgmtException
- Specified by:
removeRequestorin interfaceCertStore- Throws:
org.xipki.ca.api.mgmt.CaMgmtException
-
addCertProfile
public void addCertProfile(org.xipki.ca.api.NameId ident) throws org.xipki.ca.api.mgmt.CaMgmtException- Specified by:
addCertProfilein interfaceCertStore- Throws:
org.xipki.ca.api.mgmt.CaMgmtException
-
addRequestor
public void addRequestor(org.xipki.ca.api.NameId ident) throws org.xipki.ca.api.mgmt.CaMgmtException- Specified by:
addRequestorin interfaceCertStore- Throws:
org.xipki.ca.api.mgmt.CaMgmtException
-
addCa
public void addCa(org.xipki.ca.api.NameId ident, org.xipki.security.X509Cert caCert, org.xipki.security.CertRevocationInfo caRevInfo) throws org.xipki.ca.api.mgmt.CaMgmtException
-
revokeCa
public void revokeCa(String caName, org.xipki.security.CertRevocationInfo revocationInfo) throws org.xipki.ca.api.mgmt.CaMgmtException
-
unrevokeCa
public void unrevokeCa(String caName) throws org.xipki.ca.api.mgmt.CaMgmtException
- Specified by:
unrevokeCain interfaceCertStore- Throws:
org.xipki.ca.api.mgmt.CaMgmtException
-
addCert
public boolean addCert(org.xipki.ca.api.CertificateInfo certInfo, boolean saveKeypair)
-
getMaxFullCrlNumber
public long getMaxFullCrlNumber(org.xipki.ca.api.NameId ca) throws org.xipki.pki.OperationException- Specified by:
getMaxFullCrlNumberin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getMaxCrlNumber
public long getMaxCrlNumber(org.xipki.ca.api.NameId ca) throws org.xipki.pki.OperationException- Specified by:
getMaxCrlNumberin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getThisUpdateOfCurrentCrl
public long getThisUpdateOfCurrentCrl(org.xipki.ca.api.NameId ca, boolean deltaCrl) throws org.xipki.pki.OperationException- Specified by:
getThisUpdateOfCurrentCrlin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
addCrl
public void addCrl(org.xipki.ca.api.NameId ca, org.bouncycastle.cert.X509CRLHolder crl) throws org.xipki.pki.OperationException, CRLException- Specified by:
addCrlin interfaceCertStore- Throws:
org.xipki.pki.OperationExceptionCRLException
-
revokeCert
public org.xipki.ca.api.mgmt.CertWithRevocationInfo revokeCert(org.xipki.ca.api.NameId ca, BigInteger serialNumber, org.xipki.security.CertRevocationInfo revInfo, boolean force, CaIdNameMap idNameMap) throws org.xipki.pki.OperationException- Specified by:
revokeCertin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
revokeSuspendedCert
public org.xipki.ca.api.mgmt.CertWithRevocationInfo revokeSuspendedCert(org.xipki.ca.api.NameId ca, CertStore.SerialWithId serialNumber, org.xipki.security.CrlReason reason, CaIdNameMap idNameMap) throws org.xipki.pki.OperationException- Specified by:
revokeSuspendedCertin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
unsuspendCert
public org.xipki.ca.api.CertWithDbId unsuspendCert(org.xipki.ca.api.NameId ca, BigInteger serialNumber, boolean force, CaIdNameMap idNamMap) throws org.xipki.pki.OperationException- Specified by:
unsuspendCertin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
removeCert
public void removeCert(long id) throws org.xipki.pki.OperationException- Specified by:
removeCertin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCountOfCerts
public long getCountOfCerts(org.xipki.ca.api.NameId ca, boolean onlyRevoked) throws org.xipki.pki.OperationException- Specified by:
getCountOfCertsin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCountOfCerts
public long getCountOfCerts(long notBeforeSince) throws org.xipki.pki.OperationException- Specified by:
getCountOfCertsin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getSerialNumbers
public List<CertStore.SerialWithId> getSerialNumbers(org.xipki.ca.api.NameId ca, long startId, int numEntries, boolean onlyRevoked) throws org.xipki.pki.OperationException
- Specified by:
getSerialNumbersin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getExpiredUnrevokedSerialNumbers
public List<CertStore.SerialWithId> getExpiredUnrevokedSerialNumbers(org.xipki.ca.api.NameId ca, long expiredAt, int numEntries) throws org.xipki.pki.OperationException
- Specified by:
getExpiredUnrevokedSerialNumbersin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getSuspendedCertSerials
public List<CertStore.SerialWithId> getSuspendedCertSerials(org.xipki.ca.api.NameId ca, Instant latestLastUpdate, int numEntries) throws org.xipki.pki.OperationException
- Specified by:
getSuspendedCertSerialsin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getEncodedCrl
public byte[] getEncodedCrl(org.xipki.ca.api.NameId ca, BigInteger crlNumber) throws org.xipki.pki.OperationException- Specified by:
getEncodedCrlin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
cleanupCrls
public int cleanupCrls(org.xipki.ca.api.NameId ca, int numCrls) throws org.xipki.pki.OperationException- Specified by:
cleanupCrlsin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCertForId
public org.xipki.ca.api.CertificateInfo getCertForId(org.xipki.ca.api.NameId ca, org.xipki.security.X509Cert caCert, long certId, CaIdNameMap idNameMap) throws org.xipki.pki.OperationException- Specified by:
getCertForIdin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCertWithRevocationInfo
public org.xipki.ca.api.mgmt.CertWithRevocationInfo getCertWithRevocationInfo(long certId, CaIdNameMap idNameMap) throws org.xipki.pki.OperationException- Specified by:
getCertWithRevocationInfoin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCertWithRevocationInfo
public org.xipki.ca.api.mgmt.CertWithRevocationInfo getCertWithRevocationInfo(int caId, BigInteger serial, CaIdNameMap idNameMap) throws org.xipki.pki.OperationException- Specified by:
getCertWithRevocationInfoin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCertWithRevocationInfoBySubject
public org.xipki.ca.api.mgmt.CertWithRevocationInfo getCertWithRevocationInfoBySubject(int caId, org.bouncycastle.asn1.x500.X500Name subject, byte[] san, CaIdNameMap idNameMap) throws org.xipki.pki.OperationException- Specified by:
getCertWithRevocationInfoBySubjectin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCertId
public long getCertId(org.xipki.ca.api.NameId ca, BigInteger serial) throws org.xipki.pki.OperationException
-
getCertInfo
public org.xipki.ca.api.CertificateInfo getCertInfo(org.xipki.ca.api.NameId ca, org.xipki.security.X509Cert caCert, BigInteger serial, CaIdNameMap idNameMap) throws org.xipki.pki.OperationException- Specified by:
getCertInfoin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCert
public org.xipki.security.X509Cert getCert(org.bouncycastle.asn1.x500.X500Name subjectName, String transactionId) throws org.xipki.pki.OperationExceptionGet certificate for given subject and transactionId.
-
listCerts
public List<org.xipki.ca.api.mgmt.CertListInfo> listCerts(org.xipki.ca.api.NameId ca, org.bouncycastle.asn1.x500.X500Name subjectPattern, Instant validFrom, Instant validTo, org.xipki.ca.api.mgmt.CertListOrderBy orderBy, int numEntries) throws org.xipki.pki.OperationException
-
getRevokedCerts
public List<CertRevInfoWithSerial> getRevokedCerts(org.xipki.ca.api.NameId ca, Instant notExpiredAt, long startId, int numEntries) throws org.xipki.pki.OperationException
- Specified by:
getRevokedCertsin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCertsForDeltaCrl
public List<CertRevInfoWithSerial> getCertsForDeltaCrl(org.xipki.ca.api.NameId ca, BigInteger baseCrlNumber, Instant notExpiredAt) throws org.xipki.pki.OperationException
- Specified by:
getCertsForDeltaCrlin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
getCertStatusForSubject
public CertStore.CertStatus getCertStatusForSubject(org.xipki.ca.api.NameId ca, org.bouncycastle.asn1.x500.X500Name subject) throws org.xipki.pki.OperationException
- Specified by:
getCertStatusForSubjectin interfaceCertStore- Throws:
org.xipki.pki.OperationException
-
updateDbInfo
public void updateDbInfo() throws org.xipki.datasource.DataAccessException, org.xipki.ca.api.mgmt.CaMgmtException- Specified by:
updateDbInfoin interfaceCertStore- Throws:
org.xipki.datasource.DataAccessExceptionorg.xipki.ca.api.mgmt.CaMgmtException
-
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
-
notNulls
protected void notNulls(Object param1, String name1, Object param2, String name2, Object param3, String name3)
-
-