private int getIssuerId(X509Cert issuerCert) throws DataAccessException { Args.notNull(issuerCert, "issuerCert"); Integer id = issuerStore.getIdForCert(issuerCert.getEncodedCert()); if (id == null) { throw new IllegalStateException("could not find issuer, " + "please start XiPKI in master mode first the restart this XiPKI system"); } return id.intValue(); }
void addIssuer(X509Cert issuerCert) throws DataAccessException { if (issuerStore.getIdForCert(issuerCert.getEncodedCert()) != null) { return; String sha1FpCert = HashAlgo.SHA1.base64Hash(issuerCert.getEncodedCert()); long maxId = datasource.getMax(null, "ISSUER", "ID"); int id = (int) maxId + 1; byte[] encodedCert = issuerCert.getEncodedCert(); long notBeforeSeconds = issuerCert.getCert().getNotBefore().getTime() / 1000; long notAfterSeconds = issuerCert.getCert().getNotAfter().getTime() / 1000;
void removeCert(X509Cert issuer, CertWithDbId cert) throws DataAccessException { Args.notNull(issuer, "issuer"); Args.notNull(cert, "cert"); Integer issuerId = issuerStore.getIdForCert(issuer.getEncodedCert()); if (issuerId == null) { return; } final String sql = "DELETE FROM CERT WHERE IID=? AND SN=?"; PreparedStatement ps = datasource.prepareStatement(sql); try { ps.setInt(1, issuerId); ps.setString(2, cert.getCert().getSerialNumber().toString(16)); ps.executeUpdate(); } catch (SQLException ex) { throw datasource.translate(sql, ex); } finally { datasource.releaseResources(ps, null); } } // method removeCert
Args.notNull(cert, "cert"); Integer issuerId = issuerStore.getIdForCert(issuer.getEncodedCert()); if (issuerId == null) { return;
root.put("caCert", ca.getCaInfo().getCert().getEncodedCert());
newCertTemp.getValue().setByteArrayValue(cert.getEncodedCert()); return newCertTemp;
respBytes = ca.getCaInfo().getCert().getEncodedCert(); } else if (RestAPIConstants.CMD_enroll_cert.equalsIgnoreCase(command)) { String profile = httpRetriever.getParameter(RestAPIConstants.PARAM_profile); respBytes = cert.getEncodedCert(); } else if (RestAPIConstants.CMD_revoke_cert.equalsIgnoreCase(command) || RestAPIConstants.CMD_delete_cert.equalsIgnoreCase(command)) {