Comments (2)
I think it should be android.util.Base64?
Yes.
You should remove these lines.
byte[] publicKeyShaBase64 = Base64.getEncoder().encode(publicKeySha256);
return "sha256/" + new String(publicKeyShaBase64);
And add:
return "sha256/" + Base64.encodeToString(publicKeySha256, Base64.DEFAULT);
from okhttp-peer-certificate-extractor.
@fabiomsr I found out that using okhttp3
you can call the method okhttp3.CertificatePinner.pin(x509Certificate)
for example:
let inputStream: java.io.FileInputStream
try {
let file = new java.io.File(options.certificateURI)
inputStream = new java.io.FileInputStream(file)
let x509Certificate = java.security.cert.CertificateFactory.getInstance('X509').generateCertificate(inputStream)
peer.x509Certificate = x509Certificate
certificate = okhttp3.CertificatePinner.pin(x509Certificate)
inputStream.close()
} catch (error) {
try {
if (inputStream) {
inputStream.close()
}
} catch (e) { }
console.error('nativescript-https > enableSSLPinning error', error)
return
}
// certificate = sha256/u4QJrwx7aSejc080BBQKGyTaoJovFBg4SbQ9nhoohb8=
Used in this library I wrote for Nativescript https://github.com/gethuman/nativescript-https/blob/master/https.android.ts#L41
from okhttp-peer-certificate-extractor.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from okhttp-peer-certificate-extractor.