how to Capture https with fiddler, in java

前端 未结 4 2007
春和景丽
春和景丽 2020-11-28 01:58

I am running the following java program in the Eclipse IDE:

import java.net.*;
import java.io.*;

public class HH
{
    public static void main(String[] arg         


        
4条回答
  •  北海茫月
    2020-11-28 02:31

    You can also import the Fiddler key into the Java trusted certificates store (as long as you are aware that this is not secure and you don't do this on any non-development environment):

    1. Export Fiddler's root certificate from within Fiddler:

    Tools → Fiddler Options... → HTTPS → Actions → Export Root Certificate to Desktop

    1. Start an elevated Command Prompt and use the following command to import the certificate. Replace the jdk1.7.0_79 part with your appropriate JDK/JRE version. If you have multiple JDK/JRE's installed, you'll need to perform this action per environment.
    "keytool.exe" -import -noprompt -trustcacerts -alias FiddlerRoot -file c:\work\FiddlerRoot.cer  -keystore "C:\Program Files\Java\jdk1.7.0_79\jre\lib\security\cacerts"  -storepass changeit
    

    I also had a problem with decrypting HTTPS traffic using the Google API Client in combination with Fiddler. The problem was that by default, the client uses it's own cert store:

    InputStream keyStoreStream = GoogleUtils.class.getResourceAsStream("google.jks");
    SecurityUtils.loadKeyStore(certTrustStore, keyStoreStream, "notasecret");
    

    And this is how i fixed this:

    HttpTransport transport = new NetHttpTransport() 
    //instead of transport = GoogleNetHttpTransport.newTrustedTransport();
    

提交回复
热议问题