好的,我有一个点对点(客户端/服务器在同一主机上)设置(在本地局域网上),这是使用Java网络框架Netty。我使用原始的TCP/IP(即没有HTTP)进行通信和传输。
目前所有数据都以“明文”形式传输,我正在开始保护此类传输数据的过程。
我已经仔细阅读了各种加密/实践类型等(但可能只是浅尝辄止,已经让我的大脑燃烧了)
Netty包括SSL实现,以下是一些链接,希望能更好地解释自己:
http://docs.jboss.org/netty/3.2/xref/org/jboss/netty/example/securechat/package-summary.html
"SecureChatTrustManagerFactory"中有两个方法:
public void checkClientTrusted(
X509Certificate[] chain, String authType) throws CertificateException {
// Always trust - it is an example.
// You should do something in the real world.
// You will reach here only if you enabled client certificate auth,
// as described in SecureChatSslContextFactory.
System.err.println(
"UNKNOWN CLIENT CERTIFICATE: " + chain[0].getSubjectDN());
}
public void checkServerTrusted(
X509Certificate[] chain, String authType) throws CertificateException {
// Always trust - it is an example.
// You should do something in the real world.
System.err.println(
"UNKNOWN SERVER CERTIFICATE: " + chain[0].getSubjectDN());
}
"SecureChatKeyStore" 包含一个硬编码的证书,据我所见。
所以我的问题是:
- 我需要生成证书吗?
- 如果需要,每次运行应用程序都需要生成吗?
- 如果需要,每个客户端都需要生成吗?
- 如果需要,这个认证是在客户端和服务器之间传递的吗?
- 如果需要,如何安全地完成?
还有其他提示/建议吗?
提前感谢您。