握手完成后,我调用了我在服务器套接字上使用的getPeerCertificates()
握手(socket.getHandshakeSession()
)setNeedClientAuth(true)
,所以我知道它必须获得客户端证书。
可能出了什么问题?SSLPeerUnverifiedException
不被抛出
ssf = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
serverSocket = (SSLServerSocket)ssf.createServerSocket(PORT);
serverSocket.setNeedClientAuth(true);
//added to after accept list and picked up by a worker thread.
SSLSocket socket = (SSLSocket) serverSocket.accept();
//worker thread.
SSLSession handshake = socket.getHandshakeSession();
Certificate[] certificates = handshake.getPeerCertificates(); // NULL