【发布时间】:2014-07-21 17:04:56
【问题描述】:
我问是因为我的PHP websocket 服务器处于死胡同。我正在寻找 2 周的解决方案,我访问了 Google 中的所有结果,标签为:websocket、SSL、WSS。
问题是使用WSS(websocket secure)引起的,我的服务器与WS完美配合。但是我必须使用SSL,我不能放弃这个。更准确地说,当客户端(浏览器)向服务器发送握手时,它是加密的。我想是的,因为它混合了非常奇怪的字符。接下来,我想我应该用openssl_*函数解密这个字符串,所以我写了一个代码:
//$pKey - decrypted private key of my SSL certificate
//$buffer - string with strange chars - probably encrypted handshake
$privateKey = openssl_pkey_get_private($pKey);
openssl_private_decrypt($buffer , $open , $privateKey);
openssl_free_key($privateKey);
我得到错误:
error:0407006A:rsa routines:RSA_padding_check_PKCS1_type_1:block type is not 01
或
error:04065072:rsa routines:RSA_EAY_PRIVATE_DECRYPT:padding check failed
当然$open 为空。我尝试了每个填充选项,错误都是一样的。
有什么想法吗?
【问题讨论】:
-
您的网络服务器应该已经为您解密了所有内容。
-
但不是,我的主机服务的帮助台/支持人员说这是正常的,我必须自己解密。
标签: php ssl encryption websocket