CertificateDataPK pk = new CertificateDataPK(); pk.fingerprint = CertTools.getFingerprintAsString(cert); CertificateData data2 = home.findByPrimaryKey(pk); assertNotNull("Failed to find cert", data2); log.debug("found by key! =" + data2); log.debug("fp=" + data2.getFingerprint()); log.debug("issuer=" + data2.getIssuerDN()); log.debug("subject=" + data2.getSubjectDN()); log.debug("cafp=" + data2.getCAFingerprint()); log.debug("status=" + data2.getStatus()); log.debug("type=" + data2.getType()); log.debug("serno=" + data2.getSerialNumber()); log.debug("expiredate=" + data2.getExpireDate()); log.debug("revocationdate=" + data2.getRevocationDate()); log.debug("revocationreason=" + data2.getRevocationReason());  data2.setCAFingerprint("12345"); data2.setStatus(CertificateData.CERT_REVOKED); data2.setType(SecConst.USER_ENDUSER); data2.setRevocationDate(new Date()); data2.setRevocationReason(RevokedCertInfo.REVOKATION_REASON_KEYCOMPROMISE); log.debug("Changed it");
String fp = CertTools.getFingerprintAsString(cert); ICertificateStoreSessionRemote store = storehome.create(); try { X509Certificate ce = (X509Certificate)store.findCertificateByFingerprint(admin,fp); assertNotNull("Cannot find certificate with fp="+fp,ce); CertificateInfo info = store.getCertificateInfo(admin, fp); assertEquals("fingerprint does not match.",fp,info.getFingerprint()); assertEquals("CAfingerprint does not match.","1234",info.getCAFingerprint()); assertEquals("serialnumber does not match.",ce.getSerialNumber(),info.getSerialNumber()); assertEquals("issuerdn does not match.",CertTools.getIssuerDN(ce),info.getIssuerDN()); assertEquals("subjectdn does not match.",CertTools.getSubjectDN(ce),info.getSubjectDN());  if (certAlreadyExists) { assertEquals("status does not match.",CertificateDataBean.CERT_REVOKED,info.getStatus()); } else { assertEquals("status does not match.",CertificateDataBean.CERT_INACTIVE,info.getStatus()); } assertEquals("type does not match.",CertificateDataBean.CERT_TYPE_ENCRYPTION,info.getType()); assertEquals("exiredate does not match.",ce.getNotAfter(),info.getExpireDate());  if (certAlreadyExists) { assertEquals("revocation reason does not match.",RevokedCertInfo.REVOKATION_REASON_AFFILIATIONCHANGED,info.getRevocationReason()); } else { assertEquals("revocation reason does not match.",RevokedCertInfo.NOT_REVOKED,info.getRevocationReason()); } log.info("revocationdate (before rev)=" + info.getRevocationDate()); store.revokeCertificate(admin,ce,null,RevokedCertInfo.REVOKATION_REASON_KEYCOMPROMISE); CertificateInfo info1 = store.getCertificateInfo(admin, fp); if (certAlreadyExists) { assertEquals("revocation reason does not match.",RevokedCertInfo.REVOKATION_REASON_AFFILIATIONCHANGED,info1.getRevocationReason()); } else { assertEquals("revocation reason does not match.",RevokedCertInfo.NOT_REVOKED,info1.getRevocationReason()); } log.info("revocationdate (after rev)=" + info1.getRevocationDate()); assertTrue("Revocation date in future.", new Date().compareTo(info1.getRevocationDate())>=0); } catch (RemoteException e) { log.error("Error getting or revoking certificate: ",e); assertTrue("Error getting or revoking certificate.", false); return; }
    public void test02FindAndChange() throws Exception {        log.debug(">test02FindAndChange()");        CertificateDataPK pk = new CertificateDataPK();        pk.fingerprint = CertTools.getFingerprintAsString(cert);        CertificateData data2 = home.findByPrimaryKey(pk);        assertNotNull("Failed to find cert", data2);        log.debug("found by key! =" + data2);        log.debug("fp=" + data2.getFingerprint());        log.debug("issuer=" + data2.getIssuerDN());        log.debug("subject=" + data2.getSubjectDN());        log.debug("cafp=" + data2.getCAFingerprint());        log.debug("status=" + data2.getStatus());        log.debug("type=" + data2.getType());        log.debug("serno=" + data2.getSerialNumber());        log.debug("expiredate=" + data2.getExpireDate());        log.debug("revocationdate=" + data2.getRevocationDate());        log.debug("revocationreason=" + data2.getRevocationReason());        data2.setCAFingerprint("12345");        data2.setStatus(CertificateData.CERT_REVOKED);        data2.setType(SecConst.USER_ENDUSER);        data2.setRevocationDate(new Date());        data2.setRevocationReason(RevokedCertInfo.REVOKATION_REASON_KEYCOMPROMISE);        log.debug("Changed it");        log.debug("<test02FindAndChange()");    }