@Override public List<Certificate> getServerCertificateChain() throws SSLPeerUnverifiedException { if (handshake == null) return null; // Java requires null, not an empty list here. List<Certificate> certificates = handshake.peerCertificates(); return certificates.size() > 0 ? certificates : null; }
@Override public Certificate[] getServerCertificates() throws SSLPeerUnverifiedException { Handshake handshake = handshake(); if (handshake == null) return null; List<Certificate> result = handshake.peerCertificates(); return !result.isEmpty() ? result.toArray(new Certificate[result.size()]) : null; }
public void run() throws Exception { Request request = new Request.Builder() .url("https://publicobject.com/robots.txt") .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) throw new IOException("Unexpected code " + response); for (Certificate certificate : response.handshake().peerCertificates()) { System.out.println(CertificatePinner.pin(certificate)); } } }
@Override public Response intercept(Chain chain) throws IOException { for (Certificate certificate : chain.connection().handshake().peerCertificates()) { String pin = CertificatePinner.pin(certificate); if (blacklist.contains(pin)) { throw new IOException("Blacklisted peer certificate: " + pin); } } return chain.proceed(chain.request()); } };
public boolean supportsUrl(HttpUrl url) { if (url.port() != route.address().url().port()) { return false; // Port mismatch. } if (!url.host().equals(route.address().url().host())) { // We have a host mismatch. But if the certificate matches, we're still good. return handshake != null && OkHostnameVerifier.INSTANCE.verify( url.host(), (X509Certificate) handshake.peerCertificates().get(0)); } return true; // Success. The URL is supported. }
public boolean supportsUrl(HttpUrl url) { if (url.port() != route.address().url().port()) { return false; // Port mismatch. } if (!url.host().equals(route.address().url().host())) { // We have a host mismatch. But if the certificate matches, we're still good. return handshake != null && OkHostnameVerifier.INSTANCE.verify( url.host(), (X509Certificate) handshake.peerCertificates().get(0)); } return true; // Success. The URL is supported. }
List<Certificate> peerCertificates = unverifiedHandshake.peerCertificates(); if (!peerCertificates.isEmpty()) { X509Certificate cert = (X509Certificate) peerCertificates.get(0); unverifiedHandshake.peerCertificates());
address.certificatePinner().check(address.url().host(), handshake().peerCertificates()); } catch (SSLPeerUnverifiedException e) { return false;
List<Certificate> peerCertificates = unverifiedHandshake.peerCertificates(); if (!peerCertificates.isEmpty()) { X509Certificate cert = (X509Certificate) peerCertificates.get(0); unverifiedHandshake.peerCertificates());
address.certificatePinner().check(address.url().host(), handshake().peerCertificates()); } catch (SSLPeerUnverifiedException e) { return false;
sink.writeUtf8(handshake.cipherSuite().javaName()) .writeByte('\n'); writeCertList(sink, handshake.peerCertificates()); writeCertList(sink, handshake.localCertificates()); sink.writeUtf8(handshake.tlsVersion().javaName()).writeByte('\n');
sink.writeUtf8(handshake.cipherSuite().javaName()) .writeByte('\n'); writeCertList(sink, handshake.peerCertificates()); writeCertList(sink, handshake.localCertificates()); sink.writeUtf8(handshake.tlsVersion().javaName()).writeByte('\n');
bufferedSink.writeUtf8(handshake.cipherSuite().javaName()) .writeByte('\n'); writeCertList(bufferedSink, handshake.peerCertificates()); writeCertList(bufferedSink, handshake.localCertificates());
@Override public List<Certificate> getServerCertificateChain() throws SSLPeerUnverifiedException { if (handshake == null) return null; // Java requires null, not an empty list here. List<Certificate> certificates = handshake.peerCertificates(); return certificates.size() > 0 ? certificates : null; }
@Override public Certificate[] getServerCertificates() throws SSLPeerUnverifiedException { Handshake handshake = handshake(); if (handshake == null) return null; List<Certificate> result = handshake.peerCertificates(); return !result.isEmpty() ? result.toArray(new Certificate[result.size()]) : null; }
@Override public Certificate[] getServerCertificates() throws SSLPeerUnverifiedException { Handshake handshake = handshake(); if (handshake == null) return null; List<Certificate> result = handshake.peerCertificates(); return !result.isEmpty() ? result.toArray(new Certificate[result.size()]) : null; }
@Override public Certificate[] getServerCertificates() throws SSLPeerUnverifiedException { Handshake handshake = handshake(); if (handshake == null) return null; List<Certificate> result = handshake.peerCertificates(); return !result.isEmpty() ? result.toArray(new Certificate[result.size()]) : null; }
public boolean supportsUrl(HttpUrl url) { if (url.port() != route.address().url().port()) { return false; // Port mismatch. } if (!url.host().equals(route.address().url().host())) { // We have a host mismatch. But if the certificate matches, we're still good. return handshake != null && OkHostnameVerifier.INSTANCE.verify( url.host(), (X509Certificate) handshake.peerCertificates().get(0)); } return true; // Success. The URL is supported. }
public boolean supportsUrl(HttpUrl url) { if (url.port() != route.address().url().port()) { return false; // Port mismatch. } if (!url.host().equals(route.address().url().host())) { // We have a host mismatch. But if the certificate matches, we're still good. return handshake != null && OkHostnameVerifier.INSTANCE.verify( url.host(), (X509Certificate) handshake.peerCertificates().get(0)); } return true; // Success. The URL is supported. }
sink.writeUtf8(handshake.cipherSuite().javaName()); sink.writeByte('\n'); writeCertList(sink, handshake.peerCertificates()); writeCertList(sink, handshake.localCertificates());