我最近开始使用 PJ 项目和 GTK+ 开发一个小型 SIP 软电话应用程序。我的主要目标是创建一个支持 TLS 和 SRTP 加密(和 MWI)的软电话。但是,我一直卡在图书馆注册帐户的部分,因为应用程序在我请求时无法验证服务器。 我以为我在编码时误解了一些东西,因为我是新手,但今天我刚刚使用源代码中附带的 PJSUA 应用程序测试了该库,除非我启动该程序,否则它可以注册我的 SIP 帐户使用 --tls-verify-server 标志。 为了清楚起见,我为 Asterisk 创建了我自己的证书颁发机构、 key 和证书,并且我已经将 CA 安装到我的机器上。 我必须注意,此设置适用于商业软件,它可以毫无问题地验证证书。
我使用过的 PJSUA 标志:
--use-tls
--tls-ca-file /etc/ssl/certs/ca-certificates.crt
--id=sip:u-kuklinistvan1@kingdom.info.tm;transport=tls
--registrar=sip:kingdom.info.tm;transport=tls
--realm=kingdom.info.tm
--username=u-kuklinistvan1
--password=xxxxxx
--use-srtp=2
--mwi
--tls-verify-server
上面写着(please follow the link for the long version):
19:21:44.728 pjsua_app.c TLS cert verification result of [94.21.11.229:5061] : The server identity does not match to any identities specified in the certificate
...这不可能是真的,因为 OpenSSL 本身接受证书:
openssl s_client -CAfile /etc/ssl/certs/ca-certificates.crt -connect kingdom.info.tm:5061
Verify return code: 0 (ok)
额外信息 我通过主机名 kingdom.info.tm 将 PJSUA 作为端点连接到注册商。
有没有可能我遇到了错误或者我只是不明白什么? 感谢您的帮助!
最佳答案
... does not match to any identities specified in the certificate
... which could be not true as OpenSSL itself accepts the certificate: ...
openssl s_client ...
错误消息指的是根据证书检查身份,即您提供的主机名与证书中的名称(主题备用名称、通用名称)。 openssl s_client
不做任何身份检查,只检查有效的信任链。
查看它实际包含的服务器提供的证书包含kingdom.info.tm
的通用名称。但从错误消息看来,它需要 IP 地址:[94.21.11.229:5061] 的 TLS 证书验证结果:...
。您是否使用 IP 地址指定了对等方的 SIP URL?
关于ssl - PJSIP TLS 验证错误(PJSIP_TLS_ECERTVERIF),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29545339/