简体   繁体   English

相当于Java中的openssl

[英]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. 我目前正在编写一个pop3电子邮件客户端,以了解有关电子邮件客户端和RFC的更多信息...命令:openssl s_client -connect pop.gmail.com:995将连接到谷歌服务器,并使您能够在身份验证后检索和检查电子邮件。 How would I do this in Java after initiating a TCP socket connection? 启动TCP套接字连接后,如何在Java中执行此操作? 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. 您将打开SSL套接字而不是常规套接字。 SSLSockets require you to do a couple of extra things like setup the private key and a cert. SSLSockets要求您执行一些额外的操作,例如设置私钥和证书。 If you search for "SSLSocket java examples" you should get a bunch of sample code to help you set it up. 如果你搜索“SSLSocket java examples”,你应该得到一堆示例代码来帮助你进行设置。 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. 在创建SSLSocket并连接到gmail之后,您可以像使用常规Socket一样从套接字获取输入/输出流。

Also see: Java client certificates over HTTPS/SSL 另请参阅: 通过HTTPS / SSL的Java客户端证书

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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