Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SSL By Pass

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 303
    Comment on it

    When we have a client/server application. There is certificate(SSL installed) in server side. So In that case we have a problem , how to extract data.In this case we can by pass the SSL just writing few lines of code.

    Write the below code before hitting "https://url/" based URL.

     try
          {
              final SSLContext ctx = SSLContext.getInstance("TLS");
              final X509TrustManager tm = new X509TrustManager()
              {
                  public void checkClientTrusted(final X509Certificate[] xcs, final String string) throws CertificateException
                  {
                      // do nothing
                  }
                  public void checkServerTrusted(final X509Certificate[] xcs, final String string) throws CertificateException
                  {
                      // do nothing
                  }
                  public X509Certificate[] getAcceptedIssuers()
                  {
                      return null;
                  }
              };
              ctx.init(null, new TrustManager[]{ tm }, null);
              SSLContext.setDefault(ctx);
          }
          catch (final Exception ex)
          {
              ex.printStackTrace();
          }
    


    Enjoy https !!

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: