secure connection to imap from java by storing key for password encryption

Viewed 90

Is there any way to connect from java application to IMAP server without storing password?? Though i explored and couldn't find any way. So I am encrypting the password with a key and decided to divide key in parts and store in different place- database and some session. Any other way?

1 Answers

What authentication functions can be used depends on the server. The client has to use what the server provides.

By default the authentication mechanism that every IMAP server supports in plain authentication using username/password which of course means that you have to store the password.

There are other authentication mechanisms like Kerberos - see RFC1731 but as far as I know most servers do not support this.

On the other had there are servers that support OAuth2 authentication via IMAP, but I am not sure if this is really something standardized. As far as I know it is for example used by Microsoft and Google. Yahoo even seems to require oAuth for IMAP but I wasn't able to find a link to Yahoo describing this.

Related