简体   繁体   中英

Equivalent of openssl in Java

I am currently programming a pop3 email client to learn more about email clients and the RFC... The command: openssl s_client -connect pop.gmail.com:995 would connect to google server and will enable you to retrieve and check email after authentication. How would I do this in Java after initiating a TCP socket connection? A really bad alternative is to spawn a process that runs that command externally

Thanks

You would open a SSL Socket instead of a regular socket. SSLSockets require you to do a couple of extra things like setup the private key and a cert. If you search for "SSLSocket java examples" you should get a bunch of sample code to help you set it up. After you've created a SSLSocket and connected to gmail, you can get Input/Output streams from the socket just like you would with a regular Socket.

Also see: Java client certificates over HTTPS/SSL

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