@Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { pinningTrustManager.checkClientTrusted(chain, authType); }
@Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { pinningTrustManager.checkServerTrusted(chain, authType); }
@Override public X509Certificate[] getAcceptedIssuers() { return pinningTrustManager.getAcceptedIssuers(); }
protected final X509TrustManager tmForPins(Collection<Pin> pins) { PinningTrustManager pinningTrustManager = new PinningTrustManager(pins); X509TrustManager trustManager = eventuallySpecialize(pinningTrustManager); return trustManager; }
@Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { final X509Certificate leafCertificate = chain[0]; if (isPinned(leafCertificate)) { return; } // Throw a CertificateException with a meaningful message. Note that we // use CERTPLAIN, which tends to be long, so colons as separator are of // no use and most other software UIs show the "public key" without // colons (and using lowercase letters). final String pinHexString = HexUtilities.encodeToHex(leafCertificate.getEncoded()); throw new CertificateNotPinnedException("Certificate not pinned. Use 'CERTPLAIN:" + pinHexString + "' to pin this certificate. But only pin the certificate if you are sure this is the correct certificate!"); }
protected final X509TrustManager tmForPins(Collection<Pin> pins) { PinningTrustManager pinningTrustManager = new PinningTrustManager(pins); X509TrustManager trustManager = eventuallySpecialize(pinningTrustManager); return trustManager; }
@Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { final X509Certificate leafCertificate = chain[0]; if (isPinned(leafCertificate)) { return; } // Throw a CertificateException with a meaningful message. Note that we // use CERTPLAIN, which tends to be long, so colons as separator are of // no use and most other software UIs show the "public key" without // colons (and using lowercase letters). final String pinHexString = HexUtilities.encodeToHex(leafCertificate.getEncoded()); throw new CertificateNotPinnedException("Certificate not pinned. Use 'CERTPLAIN:" + pinHexString + "' to pin this certificate. But only pin the certificate if you are sure this is the correct certificate!"); }