Reputation: 93
I am searching for nearly an hour so far to find a specification or list for valid values to fill this property.
I am using the javax.mail.Session and invoke the Session.getInstance(props) to set "mail.smtp.ssl.protocols".
I have an example in the code, i am working on: "TLSv1". I want to know, if there are more versions for TLS available or if i can leave the version out and just set it to "TLS" instead.
The hints and links i followed on the web, were not concrete enough or were dead links.
Where I searched yet so far:
Many links to Oracle documentation only show the Oracle landing page. Wikipedia description for SMTP mentions the RFC 821, but it does not contain a list of properties or a link to them.
Thank you for help.
Upvotes: 1
Views: 11188
Reputation: 2861
SSLSocket provides a method getSupportedProtocols()
:
SSLSocketFactory sf = new SSLSocketFactoryImpl();
SSLSocket s = (SSLSocket) sf.createSocket();
System.out.println( Arrays.toString( s.getSupportedProtocols() )) ;
Output: [SSLv2Hello, SSLv3, TLSv1, TLSv1.1, TLSv1.2]
Details:
https://javamail.java.net/nonav/docs/api/com/sun/mail/smtp/package-summary.html
mail.smtp.ssl.protocols - Specifies the SSL protocols that will be enabled for SSL connections. The property value is a whitespace separated list of tokens acceptable to the javax.net.ssl.SSLSocket.setEnabledProtocols method.
The protocols must have been listed by getSupportedProtocols() as being supported.
Upvotes: 8