return getChannelBindingData(serverCert); } catch (NoSuchAlgorithmException | CertificateEncodingException e) { return null;
static byte[] getChannelBindingData(X509Certificate serverCert) throws NoSuchAlgorithmException, CertificateEncodingException { if (serverCert == null) { return null; } final String digestAlgorithm = TLSServerEndPointChannelBinding.getDigestAlgorithm(serverCert.getSigAlgOID()); if (digestAlgorithm == null) { return null; } return MessageDigest.getInstance(digestAlgorithm).digest(serverCert.getEncoded()); } }
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); final Iterator<Callback> iterator = list.iterator(); while (iterator.hasNext()) { Callback callback = iterator.next(); if (callback instanceof SSLCallback) { final SSLCallback sslCallback = (SSLCallback) callback; certs = X500.asX509CertificateArray(sslCallback.getSslSession().getPeerCertificates()); } else if (callback instanceof ChannelBindingCallback) { TLSServerEndPointChannelBinding.handleChannelBindingCallback((ChannelBindingCallback) callback, certs); iterator.remove(); } } if (! list.isEmpty()) { cbh.handle(list.toArray(new Callback[list.size()])); } } });
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); final Iterator<Callback> iterator = list.iterator(); while (iterator.hasNext()) { Callback callback = iterator.next(); if (callback instanceof SSLCallback) { final SSLCallback sslCallback = (SSLCallback) callback; peerCerts = X500.asX509CertificateArray(sslCallback.getSslSession().getPeerCertificates()); } else if (callback instanceof ChannelBindingCallback) { TLSServerEndPointChannelBinding.handleChannelBindingCallback((ChannelBindingCallback) callback, peerCerts); iterator.remove(); } } if (!list.isEmpty()) { cbh.handle(list.toArray(new Callback[list.size()])); } } });
/** * Convenience method to handle a channel binding callback. * * @param channelBindingCallback the callback (must not be {@code null}) * @param serverCerts the server certificate chain * @throws UnsupportedCallbackException if the server certificates are not present or unsupported and the callback is not optional */ public static void handleChannelBindingCallback(ChannelBindingCallback channelBindingCallback, X509Certificate[] serverCerts) throws UnsupportedCallbackException { if (serverCerts != null && serverCerts.length > 0) { // tls-server-end-point try { final byte[] bindingData = getChannelBindingData(serverCerts[0]); if (bindingData != null) { channelBindingCallback.setBindingData(bindingData); channelBindingCallback.setBindingType(TLS_SERVER_ENDPOINT); return; } } catch (CertificateEncodingException | NoSuchAlgorithmException e) { // fail silently } } CallbackUtil.unsupported(channelBindingCallback); }
static byte[] getChannelBindingData(X509Certificate serverCert) throws NoSuchAlgorithmException, CertificateEncodingException { if (serverCert == null) { return null; } final String digestAlgorithm = TLSServerEndPointChannelBinding.getDigestAlgorithm(serverCert.getSigAlgOID()); if (digestAlgorithm == null) { return null; } return MessageDigest.getInstance(digestAlgorithm).digest(serverCert.getEncoded()); } }
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); final Iterator<Callback> iterator = list.iterator(); while (iterator.hasNext()) { Callback callback = iterator.next(); if (callback instanceof SSLCallback) { final SSLCallback sslCallback = (SSLCallback) callback; peerCerts = X500.asX509CertificateArray(sslCallback.getSslSession().getPeerCertificates()); } else if (callback instanceof ChannelBindingCallback) { TLSServerEndPointChannelBinding.handleChannelBindingCallback((ChannelBindingCallback) callback, peerCerts); iterator.remove(); } } if (!list.isEmpty()) { cbh.handle(list.toArray(new Callback[list.size()])); } } });
return getChannelBindingData(serverCert); } catch (NoSuchAlgorithmException | CertificateEncodingException e) { return null;
static byte[] getChannelBindingData(X509Certificate serverCert) throws NoSuchAlgorithmException, CertificateEncodingException { if (serverCert == null) { return null; } final String digestAlgorithm = TLSServerEndPointChannelBinding.getDigestAlgorithm(serverCert.getSigAlgOID()); if (digestAlgorithm == null) { return null; } return MessageDigest.getInstance(digestAlgorithm).digest(serverCert.getEncoded()); } }
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); final Iterator<Callback> iterator = list.iterator(); while (iterator.hasNext()) { Callback callback = iterator.next(); if (callback instanceof SSLCallback) { final SSLCallback sslCallback = (SSLCallback) callback; certs = X500.asX509CertificateArray(sslCallback.getSslSession().getPeerCertificates()); } else if (callback instanceof ChannelBindingCallback) { TLSServerEndPointChannelBinding.handleChannelBindingCallback((ChannelBindingCallback) callback, certs); iterator.remove(); } } if (! list.isEmpty()) { cbh.handle(list.toArray(new Callback[list.size()])); } } });
return getChannelBindingData(serverCert); } catch (NoSuchAlgorithmException | CertificateEncodingException e) { return null;
static byte[] getChannelBindingData(X509Certificate serverCert) throws NoSuchAlgorithmException, CertificateEncodingException { if (serverCert == null) { return null; } final String digestAlgorithm = TLSServerEndPointChannelBinding.getDigestAlgorithm(serverCert.getSigAlgOID()); if (digestAlgorithm == null) { return null; } return MessageDigest.getInstance(digestAlgorithm).digest(serverCert.getEncoded()); } }
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); final Iterator<Callback> iterator = list.iterator(); while (iterator.hasNext()) { Callback callback = iterator.next(); if (callback instanceof SSLCallback) { final SSLCallback sslCallback = (SSLCallback) callback; peerCerts = X500.asX509CertificateArray(sslCallback.getSslSession().getPeerCertificates()); } else if (callback instanceof ChannelBindingCallback) { TLSServerEndPointChannelBinding.handleChannelBindingCallback((ChannelBindingCallback) callback, peerCerts); iterator.remove(); } } if (!list.isEmpty()) { cbh.handle(list.toArray(new Callback[list.size()])); } } });
return getChannelBindingData(serverCert); } catch (NoSuchAlgorithmException | CertificateEncodingException e) { return null;
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); final Iterator<Callback> iterator = list.iterator(); while (iterator.hasNext()) { Callback callback = iterator.next(); if (callback instanceof SSLCallback) { final SSLCallback sslCallback = (SSLCallback) callback; certs = X500.asX509CertificateArray(sslCallback.getSslSession().getPeerCertificates()); } else if (callback instanceof ChannelBindingCallback) { TLSServerEndPointChannelBinding.handleChannelBindingCallback((ChannelBindingCallback) callback, certs); iterator.remove(); } } if (! list.isEmpty()) { cbh.handle(list.toArray(new Callback[list.size()])); } } });
/** * Convenience method to handle a channel binding callback. * * @param channelBindingCallback the callback (must not be {@code null}) * @param serverCerts the server certificate chain * @throws UnsupportedCallbackException if the server certificates are not present or unsupported and the callback is not optional */ public static void handleChannelBindingCallback(ChannelBindingCallback channelBindingCallback, X509Certificate[] serverCerts) throws UnsupportedCallbackException { if (serverCerts != null && serverCerts.length > 0) { // tls-server-end-point try { final byte[] bindingData = getChannelBindingData(serverCerts[0]); if (bindingData != null) { channelBindingCallback.setBindingData(bindingData); channelBindingCallback.setBindingType(TLS_SERVER_ENDPOINT); return; } } catch (CertificateEncodingException | NoSuchAlgorithmException e) { // fail silently } } CallbackUtil.unsupported(channelBindingCallback); }
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); final Iterator<Callback> iterator = list.iterator(); while (iterator.hasNext()) { Callback callback = iterator.next(); if (callback instanceof SSLCallback) { final SSLCallback sslCallback = (SSLCallback) callback; certs = X500.asX509CertificateArray(sslCallback.getSslSession().getPeerCertificates()); } else if (callback instanceof ChannelBindingCallback) { TLSServerEndPointChannelBinding.handleChannelBindingCallback((ChannelBindingCallback) callback, certs); iterator.remove(); } } if (! list.isEmpty()) { cbh.handle(list.toArray(new Callback[list.size()])); } } });
/** * Convenience method to handle a channel binding callback. * * @param channelBindingCallback the callback (must not be {@code null}) * @param serverCerts the server certificate chain * @throws UnsupportedCallbackException if the server certificates are not present or unsupported and the callback is not optional */ public static void handleChannelBindingCallback(ChannelBindingCallback channelBindingCallback, X509Certificate[] serverCerts) throws UnsupportedCallbackException { if (serverCerts != null && serverCerts.length > 0) { // tls-server-end-point try { final byte[] bindingData = getChannelBindingData(serverCerts[0]); if (bindingData != null) { channelBindingCallback.setBindingData(bindingData); channelBindingCallback.setBindingType(TLS_SERVER_ENDPOINT); return; } } catch (CertificateEncodingException | NoSuchAlgorithmException e) { // fail silently } } CallbackUtil.unsupported(channelBindingCallback); }
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException { ArrayList<Callback> list = new ArrayList<>(Arrays.asList(callbacks)); final Iterator<Callback> iterator = list.iterator(); while (iterator.hasNext()) { Callback callback = iterator.next(); if (callback instanceof SSLCallback) { final SSLCallback sslCallback = (SSLCallback) callback; peerCerts = X500.asX509CertificateArray(sslCallback.getSslSession().getPeerCertificates()); } else if (callback instanceof ChannelBindingCallback) { TLSServerEndPointChannelBinding.handleChannelBindingCallback((ChannelBindingCallback) callback, peerCerts); iterator.remove(); } } if (!list.isEmpty()) { cbh.handle(list.toArray(new Callback[list.size()])); } } });
/** * Convenience method to handle a channel binding callback. * * @param channelBindingCallback the callback (must not be {@code null}) * @param serverCerts the server certificate chain * @throws UnsupportedCallbackException if the server certificates are not present or unsupported and the callback is not optional */ public static void handleChannelBindingCallback(ChannelBindingCallback channelBindingCallback, X509Certificate[] serverCerts) throws UnsupportedCallbackException { if (serverCerts != null && serverCerts.length > 0) { // tls-server-end-point try { final byte[] bindingData = getChannelBindingData(serverCerts[0]); if (bindingData != null) { channelBindingCallback.setBindingData(bindingData); channelBindingCallback.setBindingType(TLS_SERVER_ENDPOINT); return; } } catch (CertificateEncodingException | NoSuchAlgorithmException e) { // fail silently } } CallbackUtil.unsupported(channelBindingCallback); }