how to do ssl socket programming

前端 未结 3 1334
情话喂你
情话喂你 2020-12-06 02:55

I am doing socket communication through follwing IP address it working but no i want to do communication in ssl mode but how can I change InetAddress serverAddr = Ine

3条回答
  •  广开言路
    2020-12-06 03:09

    Basically you need to use SSLSocket which is for SSL communication in Java.

    When creating the SSLSocket, you first need to configure the trust store which is to verify the server certificate.

    Then you need to get the SSLSocket and connect to the server and then start to do handshake with the server.

    Once the handshake complete successfully, you can start to exchange application data with server normally like other plain socket connection.

    A HTTPS client and HTTPS server demo in Java provides a demo on how to create SSL server and SSL client in Java. It's quite useful.

提交回复
热议问题