2

我写了下面的代码来确定远程套接字是否是 SSL/TLS。我正在发送内容类型为BEEP+XML的以下消息。

在响应中,我得到了响应字节“128 3 0 0 1 -1 -1”。在这里,TLS/SSL 消息类型是128,但我不知道 128 代表什么消息类型。

我发现下面的链接列出了可能的消息类型 ID,但在其中找不到 128。 http://blogs.msdn.com/b/kaushal/archive/2012/10/06/ssl-tls-alert-protocol-amp-the-alert-codes.aspx

任何人都可以分享他们对此事的了解。

我正在尝试通过此代码连接到 Webseal 反向代理。

        byte[] TEST_MESSAGE = null;
        StringBuffer buffer = new StringBuffer();
        buffer.append("RPY 0 0 . 0 110\r\n");
        buffer.append("Content-Type: application/beep+xml\r\n");
        buffer.append("\r\n");
        buffer.append("<greeting>");
        buffer.append("   <profile uri='http://iana.org/beep/TLS' />\r\n");
        buffer.append("</greeting>\r\n");
        buffer.append("END");
        byte[] bytes = null;

        try {
            bytes = buffer.toString().getBytes("UTF-8");
        } catch (UnsupportedEncodingException ex) {
            // impossible; UTF-8 always supported
        }

        TEST_MESSAGE = bytes;

        Socket socket = null;
        try {
            // connect to the server
            socket = new Socket("localhost", 443);
        } catch (ConnectException e) {
            // Any connect exception here is most likely because the port is
            // not open at all...

        }

        try {
            // send a message to the server
            OutputStream output = socket.getOutputStream();
            output.write(TEST_MESSAGE);

            // Read the server's response. Since we sent a clear message,
            // an SSL server should return an error message in the format
            // described by the TLS protocol specification.

            InputStream input = socket.getInputStream();
4

0 回答 0