Tag: tls psk

当使用TLS PSK加密时,如何正确检测流的结尾?

我已经准备了一个基于Bouncy Castle的MockPSKTlsClient 的简单TLS PSK客户端测试用例 。 在main方法中我打电话: public static void main(String[] args) throws IOException { SecureRandom random = new SecureRandom(); TlsPSKIdentity identity = new BasicTlsPSKIdentity(“Client_identity”, Hex.decode(“1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A”)); Socket socket = new Socket(InetAddress.getLocalHost(), 12345); TlsClientProtocol proto = new TlsClientProtocol(socket.getInputStream(), socket.getOutputStream(), random); MockPSKTlsClient client = new MockPSKTlsClient(null, identity); proto.connect(client); OutputStream clearOs = proto.getOutputStream(); InputStream clearIs = proto.getInputStream(); clearOs.write(“GET / […]