【发布时间】:2015-06-25 08:04:50
【问题描述】:
我用 Java 编写了一个发送电子邮件的应用程序。对于发送电子邮件,我使用了 SMTP 和 TLS。
最近我搜索了有关 TLS 的信息,在 this website 上找到了有关 TLS 的流畅描述:Transport Layer Security (TLS), a protocol that encrypts and delivers mail securely, helps prevent eavesdropping and spoofing (message forgery) between mail servers.
上面这句话说的是TLS保证邮件会被安全送达,但它并没有说任何关于密码的事情……
假设我在我的应用程序中使用以下代码,所以你可以看到你需要有用户名和密码的硬代码,没有任何加密。
final String username = "...@hotmail.com";
final String password = "your Password";
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "smtp-mail.outlook.com");
props.put("mail.smtp.port", "587");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
在从我的服务器发送到另一台服务器时,TLS 是否会加密我的密码?我应该担心吗?
【问题讨论】:
标签: java security ssl encryption smtp