I\'m trying to pull messages from an email server in java using imap and i run into this exception:
DEBUG: JavaMail version 1.4.2
DEBUG: successfully loaded
Actually all you need to do is use Windows-ROOT
as trustStoreType
. This will use built-in certificates so if anything works in your browser then it should work.
-Djavax.net.ssl.trustStoreType=Windows-ROOT
-Djavax.net.ssl.trustStore=C:\\Windows\\win.ini
Note! Probably any readable file can be used as a trustStore
path. It's not really used.
You can also use Windows-MY
instead so:
-Djavax.net.ssl.trustStoreType=Windows-MY
See also: https://github.com/gradle/gradle/issues/6584#issuecomment-431862413.
The error is that java can't find a certificate to invoke the server in your keystore.
You are using the default keystore from java. Make sure that you put the server certificate in it.
Or you can create your keystore. Use the standard Java keytool, for example:
keytool -genkey -dname "cn=CLIENT" -alias truststorekey -keyalg RSA -keystore ./client-truststore.jks -keypass whatever -storepass whatever
keytool -import -keystore ./client-truststore.jks -file servercert.crt -alias myca
You should first check what certificate server is sending you.To do it:
BTW: