@Test public void hasValidLocalSignCertTest() throws Exception { ClientId clientId = ClientId.create("FI", "GOV", "M1"); assertTrue(ClientUtils.hasValidLocalSignCert(clientId, createCertificateInfoList())); CertificateTestUtils.CertificateInfoBuilder certBuilder = new CertificateTestUtils.CertificateInfoBuilder(); certBuilder.ocspStatus(new UnknownStatus()); CertificateInfo cert = certBuilder.build(); assertFalse(ClientUtils.hasValidLocalSignCert(clientId, Arrays.asList(cert))); clientId = ClientId.create("FI", "GOV", "M2"); assertFalse(ClientUtils.hasValidLocalSignCert(clientId, createCertificateInfoList())); }
public static boolean hasValidLocalSignCert(ClientId clientId, List<CertificateInfo> certificateInfos) { for (CertificateInfo certificateInfo : certificateInfos) { String ocspResponseStatus = null; try { ocspResponseStatus = OcspUtils.getOcspResponseStatus(certificateInfo.getOcspBytes()); } catch (OcspUtils.OcspStatusExtractionException | RuntimeException e) { log.error(ERROR_OCSP_EXTRACT_MSG + " for client: " + clientId.toString(), e); return false; } if (clientId.memberEquals(certificateInfo.getMemberId()) && certificateInfo.getStatus().equals(CertificateInfo.STATUS_REGISTERED) && ocspResponseStatus.equals(CertificateInfo.OCSP_RESPONSE_GOOD)) { return true; } } return false; }
ClientUtils { public static boolean hasValidLocalSignCert(ClientId clientId, List<CertificateInfo> certificateInfos) { for (CertificateInfo certificateInfo : certificateInfos) { String ocspResponseStatus = null; try { ocspResponseStatus = OcspUtils.getOcspResponseStatus(certificateInfo.getOcspBytes()); } catch (OcspUtils.OcspStatusExtractionException | RuntimeException e) { log.error(ERROR_OCSP_EXTRACT_MSG + " for client: " + clientId.toString(), e); return false; } if (clientId.memberEquals(certificateInfo.getMemberId()) && certificateInfo.getStatus().equals(CertificateInfo.STATUS_REGISTERED) && ocspResponseStatus.equals(CertificateInfo.OCSP_RESPONSE_GOOD)) { return true; } } return false; } }
ClientUtils { public static boolean hasValidLocalSignCert(ClientId clientId, List<CertificateInfo> certificateInfos) { for (CertificateInfo certificateInfo : certificateInfos) { String ocspResponseStatus = null; try { ocspResponseStatus = OcspUtils.getOcspResponseStatus(certificateInfo.getOcspBytes()); } catch (OcspUtils.OcspStatusExtractionException | RuntimeException e) { log.error(ERROR_OCSP_EXTRACT_MSG + " for client: " + clientId.toString(), e); return false; } if (clientId.memberEquals(certificateInfo.getMemberId()) && certificateInfo.getStatus().equals(CertificateInfo.STATUS_REGISTERED) && ocspResponseStatus.equals(CertificateInfo.OCSP_RESPONSE_GOOD)) { return true; } } return false; } private  ClientUtils(); }
ClientUtils { public static boolean hasValidLocalSignCert(ClientId clientId, List<CertificateInfo> certificateInfos) { for (CertificateInfo certificateInfo : certificateInfos) { String ocspResponseStatus = null; try { ocspResponseStatus = OcspUtils.getOcspResponseStatus(certificateInfo.getOcspBytes()); } catch (OcspUtils.OcspStatusExtractionException | RuntimeException e) { log.error(ERROR_OCSP_EXTRACT_MSG + " for client: " + clientId.toString(), e); return false; } if (clientId.memberEquals(certificateInfo.getMemberId()) && certificateInfo.getStatus().equals(CertificateInfo.STATUS_REGISTERED) && ocspResponseStatus.equals(CertificateInfo.OCSP_RESPONSE_GOOD)) { return true; } } return false; } private  ClientUtils(); static boolean hasValidLocalSignCert(ClientId clientId, List<CertificateInfo> certificateInfos); }
ClientUtils { public static boolean hasValidLocalSignCert(ClientId clientId, List<CertificateInfo> certificateInfos) { for (CertificateInfo certificateInfo : certificateInfos) { String ocspResponseStatus = null; try { ocspResponseStatus = OcspUtils.getOcspResponseStatus(certificateInfo.getOcspBytes()); } catch (OcspUtils.OcspStatusExtractionException | RuntimeException e) { log.error(ERROR_OCSP_EXTRACT_MSG + " for client: " + clientId.toString(), e); return false; } if (clientId.memberEquals(certificateInfo.getMemberId()) && certificateInfo.getStatus().equals(CertificateInfo.STATUS_REGISTERED) && ocspResponseStatus.equals(CertificateInfo.OCSP_RESPONSE_GOOD)) { return true; } } return false; } private  ClientUtils(); static boolean hasValidLocalSignCert(ClientId clientId, List<CertificateInfo> certificateInfos); static final String ERROR_OCSP_EXTRACT_MSG; }