I tried to send an email with SSL using javax.mail I received the next error:
Error: Sending the email to the following server failed : 10.100.65.159:465. Cause: javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
javax.net.ssl.SSLException: Received fatal alert: bad_record_mac
My java version:
openjdk version "1.8.0_242" OpenJDK Runtime Environment Corretto-8.242.07.1 (build 1.8.0_242-b07) OpenJDK 64-Bit Server VM Corretto-8.242.07.1 (build 25.242-b07, mixed mode)
My java code:
email.getMailSession().getProperties().put("mail.smtp.ssl.trust", "*");
email.getMailSession().getProperties().put("mail.smtp.starttls.enable", "true");
email.getMailSession().getProperties().put("mail.smtp.ssl.protocols", "SSLv3");
My javax.mail version: 1.4.5
and I removed the SSLv3 from the disabled algorithm list in the java.security file
and I still don't know what could be the problem
Any ideas?
CodePudding user response:
Because SSLv3 was deprecated since Jun 2015 you may face the fat that any of the related Hash Algorithms or Cipher Suites are deactivated or not provided by any of both (client/server) plattforms.
You can try to figure out the root cause by enabling SSL debug output with system option javax.net.debug=all and analyzing the output. But a better way is to move forward to TLSv1.2 if possible.
CodePudding user response:
in the end I just needed to remove the security.provider.1=org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider
from the java.security and it was fixed
