Git Product home page Git Product logo

Comments (3)

DirtyJerz avatar DirtyJerz commented on June 26, 2024

Did you ever figure this out?

from androidpinning.

ajinabraham avatar ajinabraham commented on June 26, 2024

As of now what I do as a workaround is to run a separate thread every 30 seconds which will send a Pinned request using Android's native SSL library. So if anything goes wrong, It will kill the app.

Here is the Sample code.
try {
String[] pins = "pin_here";
URL url = new URL("URL_here");
HttpsURLConnection connection = PinningHelper.getPinnedHttpsURLConnection(getBaseContext(), pins, url);
byte[] data = new byte[4096];
connection.getInputStream().read(data);
YLog.i("SSL", "Success " + new String(data));
}
catch (SSLKeyException e) {
android.os.Process.killProcess(android.os.Process.myPid());
}
catch (SSLHandshakeException e) {
android.os.Process.killProcess(android.os.Process.myPid());
}
catch (SSLProtocolException e) {
android.os.Process.killProcess(android.os.Process.myPid());
}
catch (SSLPeerUnverifiedException e) {
android.os.Process.killProcess(android.os.Process.myPid());
}
catch (IOException ioe) {
YLog.i("SSL", "IOException: Not Success: " + ioe.getMessage().toString());
} catch (StringIndexOutOfBoundsException sio) {
YLog.i("SSL", "StringIndexOutOfBoundsException: Not Success: " + sio.getMessage().toString());
}
catch (Exception e) {
YLog.i("SSL", "Exception: Not Success: " + e.getMessage().toString());
}

from androidpinning.

DirtyJerz avatar DirtyJerz commented on June 26, 2024

Ah ok, your volley request queue is using the default http stack which uses the singleton. My volley instance is using Okhttp. OkHttp creates it's own httpclient (separate ssl context). I think all I need to do is to set the SSLSocketFactory for the OkHttpClient befor passing it to the volley.newRequestQueue.

from androidpinning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.