ios – OSX上的AWS MQTT

前端之家收集整理的这篇文章主要介绍了ios – OSX上的AWS MQTT前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在OSX应用程序 here中,我可以使用AWS MQTT与iOS9,但是当我尝试与OSX10.11相同时,我得到这个错误

CFNetwork SSLHandshake Failed (-9829)

错误-9828被定义为

erRSSLPeerCertUnknown = -9829,/* unknown certificate */

我的OSX info.plist是

<key>NSAppTransportSecurity</key>
    <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
            <key>NSExceptionDomains</key>
            <dict>
                    <key>amazonaws.com</key>
                    <dict>
                            <key>NSExceptionRequiresForwardSecrecy</key>
                            <false/>
                            <key>NSExceptionAllowsInsecureHTTPLoads</key>
                            <true/>
                            <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                            <string>TLSv1.0</string>
                            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                            <false/>
                            <key>NSIncludesSubdomains</key>
                            <true/>
                    </dict>
                    <key>amazonaws.com.cn</key>
                    <dict>
                            <key>NSExceptionRequiresForwardSecrecy</key>
                            <false/>
                            <key>NSExceptionAllowsInsecureHTTPLoads</key>
                            <true/>
                            <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                            <string>TLSv1.0</string>
                            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                            <false/>
                            <key>NSIncludesSubdomains</key>
                            <true/>
                    </dict>
            </dict>
    </dict>

p12(来自“openssl pkcs12 -info -in awsiot-identity.p12”)是:

MAC Iteration 2048
MAC verified OK
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC,Iteration 2048
Certificate bag
Bag Attributes
    localKeyID: 5F 80 DC 6E AB F1 98 6A AA FC 0B 7B 04 F9 0E 66 99 E9 86 4F 
subject=/CN=AWS IoT Certificate
issuer=/OU=Amazon Web Services O=Amazon.com Inc. L=Seattle ST=Washington C=US
-----BEGIN CERTIFICATE-----
MIIDWTCCAkGgAwIBAgIUJQgfGjmoboOQ7eJo+NTRs5w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LUEvkQ81Q
Lzv/yReCVHO4M0+JTW4Fu6BWEaTThPzdN3kQbIzJsViIL9Q6dfAXlvepkHr4
-----END CERTIFICATE-----
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC,Iteration 2048
Bag Attributes
    localKeyID: 5F 80 DC 6E AB F1 98 6A AA FC 0B 7B 04 F9 0E 66 99 E9 86 4F 
Key Attributes: <No Attributes>

为什么OSX失败但iOS成功?

解决方法

由于SSL握手问题,它是失败的.它正在检测到一个无效的证书.

报告和解决了类似的问题here,引用相同的错误代码.由于p12文件中有多个身份,该问题被追溯到身份不匹配.

在这种情况下,p12文件中有两个证书,但代码只读取第一个.

我建议倾销.p12文件内容,并确认证书.发布在这里审查.

原文链接:https://www.f2er.com/iOS/329830.html

猜你在找的iOS相关文章