简体   繁体   中英

TCP Proxy SSL/HTTPS using Java

I am trying to create my very own proxy with Java. I am not the best with this kind of networking stuff, so please consider that when I look dumb.

Well anyway to describe my problem: I am running a simple java Socket-Server , and registered it as a proxy in Firefox. The proxy itself works with HTTP-Server with no problem. If I try a HTTPS server, Firefox gives me the following Error: "SSL_ERROR_RX_RECORD_TOO_LONG" I know that SSL/TSL is the protocol used to decode and encode the transported data. What irritates me here is that if I try to read the byte-Array, which I receive as an answer, as an String it shows me the decoded HTML Code.

Click here to view the code: https://hastebin.com/muyusalopu.java

Can someone explain to me what the exact problem is and how I could fix it?

What irritates me here is that if I try to read the byte-Array, which I recieve as an answer, as an String it shows me the decoded HTML Code.

this is the definition of the constuctor of the String class that you are using

String (byte[] bytes)

Constructs a new String by decoding the specified array of bytes using the platform's default charset.

why there is no encryption ?

Because you are using urlConnection if you want to have encryption then you should use httpsUrlConnection class

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM