I am working on a Java program which record data from sensors and send me the result by email (the computer is far from my office).
Properties props = new Properties();
props.put("mail.smtp.host", HOST);
props.put("mail.smtp.port", "587");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.ssl.enable", "false");
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(LOGIN, PASSWORD);
}
});
So I put my login/password non-encrypted in my code. It works but it is not safe because anyone can uncompress the jar file and find my login/password. What could be the best approach? Even if I use an encrypted external file, I have to provided the key to decrypt the file.