在Tomcat上运行一个JDK7应用程序,它确实具有以下env设置:
-Dhttps.protocols=TLSv1.1,TLSv1.2 上述设置确保在进行API调用时,在HTTPS上连接时不使用TLS1.0。
我们还使用org.springframework.mail.javamail.JavaMailSenderImpl类发送发送出去的SMTP电子邮件,并使用以下支持:
mail.smtp.auth=false;mail.smtp.socketFactory.port=2525;mail.smtp.socketFactory.fallback=true;mail.smtp.starttls.enable=true问题是,当SMTP电子邮件服务器升级到TLS1.2时,连接失败。
javax.net.ssl.SSLHandshakeException:握手时远程主机关闭连接
是否存在强制使用TLS1.2协议的设置或代码更改?
我做了一些搜索,看起来这些env设置只适用于applet和web客户端,而不是服务器端应用程序。
-Ddeployment.security.SSLv2Hello=false -Ddeployment.security.SSLv3=false -Ddeployment.security.TLSv1=false发布于 2017-12-08 18:42:55
这是下一个人的解决办法:
mail.smtp.starttls.enable=true;
mail.smtp.ssl.protocols=TLSv1.2;发布于 2020-04-17 07:42:06
在一款非常古老的应用程序中,它对我不起作用,我也不知道为什么。经过一些研究,我发现应用程序依赖项中的javax.mail版本为1.4。您必须升级到至少1.5。
发布于 2021-07-06 18:46:41
我需要Vojtech Zavrel和Sunny对我的回答。我运行的是Java1.8SpringBoot1.2.5,在Big 11.2.3和SpringVersion4.2.1.RELEASE上运行。
在我像这样更新了我的依赖性之后
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.5.0-b01</version>
</dependency>我更新了我的JavaMailSenderImpl
Properties prop = new Properties();
prop.setProperty("mail.smtp.auth", "true");
prop.setProperty("mail.smtp.starttls.enable", "true");
prop.setProperty("mail.smtp.ssl.protocols", "TLSv1.2"); // Added this line
prop.setProperty("mail.smtp.ssl.trust", mailUri.getHost());
mailSender.setJavaMailProperties(prop);我看到了Received fatal alert: protocol_version错误的解决方案。
https://stackoverflow.com/questions/47166425
复制相似问题