kSecTrustResultRecoverableTrustFailure 的原因是什么?
我想通过一些额外的检查来验证我的 ssl 服务器证书。有时我会得到一个
kSecTrustResultRecoverableTrustFailure
而不是
kSecTrustResultProceed
或 kSecTrustResultUnspecified
则似乎会发生
- 如果证书是 md5 散列(IOS5),
- 服务器不提供根证书和中间证书
- 的情况>SecTrustSetAnchorCertificatesOnly(信任,YES) 已设置并且锚点证书仅存在于内置锚点证书中
- 证书已过期
- ?
这取决于用于评估信任的 AppleX509TP 策略。
我的问题是我不想信任链是否失败,但我想信任是否使用 MD5。
有没有办法找出评估失败的原因?
作为替代方案,是否有一种方法可以从 SecCertificateRef
中提取 CSSM_ALGID_MD5
?
I'd like to validate my ssl server certificates with some extra checks. And sometimes I get a
kSecTrustResultRecoverableTrustFailure
instead of
kSecTrustResultProceed
or kSecTrustResultUnspecified
It seems to happen if
- the certificate is md5 hashed (IOS5)
- the server does not present the root and intermediate certificates
- the
SecTrustSetAnchorCertificatesOnly(trust,YES)
is set and the anchor certificate is only in the built in anchor certificates - the certificate is expired
- ?
It depends on the AppleX509TP policy used to evaluate the trust.
My problem is I do not want to trust if the chain fails, but I want to trust if MD5 is used.
Is there a way to find out why the evaluation failed?
As an alternative is there a way to extract the CSSM_ALGID_MD5
from a SecCertificateRef
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能是服务器证书问题......
检查此处< /a>,我解决了我的 kSecTrustResultRecoverableTrustFailure 问题,将
subjectAltName = DNS:example.com
添加到 openssl 配置文件中,特别是在服务器密钥生成中...如果您没有使用 openssl 来生成它,很抱歉,但我可以帮助你..无论如何,如果你想使用 openssl,这里是一个很好的教程,用于生成这些密钥并使用您自己的根证书颁发机构进行签名。
在本教程中,我刚刚将 openssl 服务器配置文件更改为:
希望有帮助!
编辑:
我的服务器评估代码:
希望现在它有帮助:)!
It may be a server certificate problem....
Check here, I solved my kSecTrustResultRecoverableTrustFailure problem, adding
subjectAltName = DNS:example.com
into openssl config file, specifically in server key generation...If you are not using openssl to generate it, I'm sorry but I can help you.. Anyway if you want to use openssl, here is a good tutorial to generate those keys and sign then with your own root certificate authority.
From this tutorial, I just changed my openssl server config file to:
Hope it helps !
EDITED:
My Server evaluation code:
Hope now it helps :) !
在调用
SecTrustEvaluate()
后调用SecTrustCopyProperties()
:trustProperties
是一个字典数组,评估的证书链中的每个证书一个字典。每个字典都有一个条目title
,其中包含证书的名称,如果证书未评估,它还包含一个包含错误的条目error
。例如,如果问题是证书已过期,则error
的值将为CSSMERR_TP_CERT_EXPIRED
。Call
SecTrustCopyProperties()
after callingSecTrustEvaluate()
:trustProperties
is an array of dictionaries, one dictionary per cert in the cert chain evaluated. Every dictionary has an entrytitle
, containing the name of the cert and if the cert didn't evaluate, it also contains an entryerror
containing the error. E.g. if the problem was that the cert has expired, the value oferror
will beCSSMERR_TP_CERT_EXPIRED
.