【问题标题】:How to do SSL Pinning in react native app with Azure server?如何在与 Azure 服务器反应本机应用程序中进行 SSL 固定?
【发布时间】:2021-02-19 02:45:07
【问题描述】:

我想按照 PEN 测试结果的建议在我的 react-native 应用中实现 SSL Pinning。我们的 API 服务器位于 Azure 中。当我搜索 SSL Pinning 时,我发现我们需要使用 openssl 命令生成证书。但我收到错误

s_client: -connect argument or target parameter malformed or ambiguous
unable to load certificate
4565851584:error:0909006C:PEM routines:get_name:no start line:crypto/pem/pem_lib.c:745:Expecting: TRUSTED CERTIFICATE
unable to load Public Key
4369083840:error:0909006C:PEM routines:get_name:no start line:crypto/pem/pem_lib.c:745:Expecting: PUBLIC KEY
47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=

我使用了以下命令:

openssl s_client -servername <AZURE API SERVERNAME> -connect <AZURE API SERVERNAME>:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

我正在关注这个链接

https://itnext.io/react-native-security-ssl-pinning-cde086210d58

我们需要先在 Azure 门户中做些什么。我需要一些帮助。如果有人已经使用 Azure 服务器在 React Native 应用程序中完成 SSL Pinning,请分享一些链接作为参考。

【问题讨论】:

  • 能否请您与 SSL Pinning 分享您的代码?

标签: azure react-native ssl pinning


【解决方案1】:

请在运行该 OpenSSL 命令之前尝试以下两个步骤:

  1. ping {AZURE API SERVERNAME}
  2. telnet {AZURE API SERVERNAME} {端口}

如果 {AZURE API SERVERNAME} 不是公共域/IP 地址,请确保将其添加到 hosts 文件(在 Windows 上)或 Keychain (MacOS)。

如果以上两项检查成功,那么您的 OpenSSL 将能够正常返回正确的值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-05
    • 2021-11-03
    • 1970-01-01
    • 1970-01-01
    • 2018-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多