@Override public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { if (checkClientTrustedIntern(x509Certificates)) return; try { trustManager.checkClientTrusted(x509Certificates, s); } catch (CertificateException cex) { tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionOpenErrors)); tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionInvalidClientCertificates)); logger.warn("Client certificate validation failed for '"+x509Certificates[0]+"'"); throw cex; } }
@Override public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { if (preCheckServerTrusted(x509Certificates)) return; try { trustManager.checkServerTrusted(x509Certificates, s); } catch (CertificateException cex) { tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionOpenErrors)); tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionUnknownServerCertificate)); logger.warn("Server certificate validation failed for '"+x509Certificates[0]+"'"); throw cex; } postCheckServerTrusted(x509Certificates); }
@Override public void checkClientTrusted(X509Certificate[] x509Certificates, String s, SSLEngine sslEngine) throws CertificateException { logger.debug("checkClientTrusted with sslEngine"); if (checkClientTrustedIntern(x509Certificates)) return; try { if (trustManager instanceof X509ExtendedTrustManager) { logger.debug("extended checkClientTrusted with sslEngine"); ((X509ExtendedTrustManager)trustManager).checkClientTrusted(x509Certificates, s, sslEngine); } else { trustManager.checkClientTrusted(x509Certificates, s); } } catch (CertificateException cex) { tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionOpenErrors)); tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionInvalidClientCertificates)); logger.warn("Client certificate validation failed for '"+x509Certificates[0]+"'"); throw cex; } }
@Override public void checkClientTrusted(X509Certificate[] x509Certificates, String s, Socket socket) throws CertificateException { logger.debug("checkClientTrusted with socket"); if (checkClientTrustedIntern(x509Certificates)) return; try { if (trustManager instanceof X509ExtendedTrustManager) { logger.debug("extended checkClientTrusted with socket"); ((X509ExtendedTrustManager)trustManager).checkClientTrusted(x509Certificates, s, socket); } else { trustManager.checkClientTrusted(x509Certificates, s); } } catch (CertificateException cex) { tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionOpenErrors)); tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionInvalidClientCertificates)); logger.warn("Client certificate validation failed for '"+x509Certificates[0]+"'"); throw cex; } }
@Override public void checkServerTrusted(X509Certificate[] x509Certificates, String s, Socket socket) throws CertificateException { logger.debug("checkClientTrusted with socket"); if (preCheckServerTrusted(x509Certificates)) return; try { if (trustManager instanceof X509ExtendedTrustManager) { logger.debug("extended checkClientTrusted with socket"); ((X509ExtendedTrustManager)trustManager).checkServerTrusted(x509Certificates, s, socket); } else { trustManager.checkServerTrusted(x509Certificates, s); } } catch (CertificateException cex) { tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionOpenErrors)); tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionUnknownServerCertificate)); logger.warn("Server certificate validation failed for '"+x509Certificates[0]+"'"); throw cex; } postCheckServerTrusted(x509Certificates); }
@Override public void checkServerTrusted(X509Certificate[] x509Certificates, String s, SSLEngine sslEngine) throws CertificateException { logger.debug("checkServerTrusted with sslEngine"); if (preCheckServerTrusted(x509Certificates)) return; try { if (trustManager instanceof X509ExtendedTrustManager) { logger.debug("extended checkServerTrusted with sslEngine"); ((X509ExtendedTrustManager)trustManager).checkServerTrusted(x509Certificates, s, sslEngine); } else { trustManager.checkServerTrusted(x509Certificates, s); } } catch (CertificateException cex) { tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionOpenErrors)); tlstm.getCounterSupport().fireIncrementCounter(new CounterEvent(this, SnmpConstants.snmpTlstmSessionUnknownServerCertificate)); logger.warn("Server certificate validation failed for '"+x509Certificates[0]+"'"); throw cex; } postCheckServerTrusted(x509Certificates); }
protected void linkCounterListener() { agent.removeCounterListener(snmpv2MIB); agent.addCounterListener(snmpv2MIB); usm.getCounterSupport().removeCounterListener(snmpv2MIB); usm.getCounterSupport().addCounterListener(snmpv2MIB); agent.removeCounterListener(snmpMpdMib); agent.addCounterListener(snmpMpdMib); MPv3 mpv3 = (MPv3) dispatcher.getMessageProcessingModel(MPv3.ID); if ((mpv3 != null) && (mpv3.getCounterSupport() != null)) { mpv3.getCounterSupport().removeCounterListener(snmpMpdMib); mpv3.getCounterSupport().addCounterListener(snmpMpdMib); } dispatcher.removeCounterListener(snmpMpdMib); dispatcher.addCounterListener(snmpMpdMib); for (TransportMapping tm : dispatcher.getTransportMappings()) { if (tm instanceof TLSTM) { TLSTM tlstm = (TLSTM) tm; tlstm.getCounterSupport().removeCounterListener(tlsTmMib.getCounterListener()); tlstm.getCounterSupport().addCounterListener(tlsTmMib.getCounterListener()); } } }