【问题标题】:Self signed certificated - java.security.NoSuchAlgorithmException: Error constructing implementation自签名证书 - java.security.NoSuchAlgorithmException:构造实现时出错
【发布时间】:2020-03-20 18:03:54
【问题描述】:

我为本地部署创建自己的 CA 授权。还有 APIRest、网络和应用程序。所以我的证书在网络上运行良好。

在 android 中,我一直这样配置我的 network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config>
        <trust-anchors>
            <certificates src="@raw/myca"/>
            <certificates src="system"/>
            <certificates src="user"/>
        </trust-anchors>
    </domain-config>
</network-security-config>

当我运行 tns run android 并尝试连接到我的 api 时,控制台会显示此错误:

“错误”:{ JS:“originalStack”:“错误:java.net.SocketException: java.security.NoSuchAlgorithmException:构造错误 实现(算法:默认,提供者:AndroidOpenSSL,类: com.android.org.conscrypt.DefaultSSLContextImpl)\n 在新 区域感知错误 (file:///data/data/org.nativescript.ngsample/files/app/vendor.js:91593:33)\n 在 onRequestComplete (file:///data/data/org.nativescript.ngsample/files/app/vendor.js:97990:34)\n 在 Object.onComplete (file:///node_modules/@nativescript/core/http/http-request/http-request.js:43:0)"

可能是什么问题?

【问题讨论】:

    标签: android ssl openssl nativescript


    【解决方案1】:

    这很容易。我的错误是没有阅读文档。我只需要改misecurity_network_config.xml

            <domain-config>
                <domain includeSubdomains="true">192.168.1.67</domain>
                <trust-anchors>
                    <certificates src="@raw/myca"/>
                </trust-anchors>
            </domain-config>
    

    【讨论】:

    • 这种情况需要includeSubdomains吗?
    • 在这种情况下,是的。
    • 我们如何知道子域IP地址是什么?
    猜你喜欢
    • 2017-02-18
    • 2021-11-13
    • 2021-06-29
    • 2017-09-12
    • 2021-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多