Last active
July 5, 2016 18:40
-
-
Save develodroid/7beee0a6aba18e3f2c96c1ce73af9ade to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//In order to extract a peer certificate: | |
File certificate = new File(certificateUri); | |
String peerCertificate = PeerCertificateExtractor.extract(certificate); | |
//Retrieved peer certificates format: | |
sha256/u4QJrwx7aSejc080BBQKGyTaoJovFBg4SbQ9nhoohb8= | |
//Enabling okhttp certificate pinning is now made the following way: | |
client = new OkHttpClient.Builder() | |
.certificatePinner(new CertificatePinner.Builder() | |
.add("publicobject.com", peerCertificate) | |
.build()) | |
.build(); | |
https://github.com/fabiomsr/okhttp-peer-certificate-extractor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment