【问题标题】:Enable SSL pinning in ionic 3 using ionic-native http使用 ionic-native http 在 ionic 3 中启用 SSL 固定
【发布时间】:2018-05-24 06:57:36
【问题描述】:

我正在尝试使用@ionic-native http 在 ionic3 中实现 SSL 固定。 我已将证书(.cer)文件复制到 platforms/android/assets 文件夹中。我尝试运行以下代码并收到错误消息: 您必须添加至少 1 个证书才能固定到证书
谁能帮助我为什么会收到此错误?

private getHtpRequest(url: string){
            return new Promise((resolve, reject) => {
             this.htp.enableSSLPinning(true);
              this.htp.post(url, {}, {'Content-Type': 'application/json','reqId': Math.floor((Math.random() * 1000000) + 1).toString()}) 
              .then(
                (res: any) => {
                  this.results = res.json();
                // Dismiss the loader and return response back.
                resolve(this.results)
                },
                (error: any) => {
                // Dismiss the loader and return error back.
                reject(error)
                }
              )

            });
          }

【问题讨论】:

  • 有人可以删除sunil的垃圾邮件吗?

标签: angular ionic-framework


【解决方案1】:

我看到您已添加到资产文件夹,但请先尝试其他方式。

作为替代方案,您可以将 .cer 文件存储在 www/certificates 文件夹。

所以,只需在您的 www 文件夹中创建一个证书文件夹并添加证书。

注意:请确保在拨打电话之前启用 SSL Pinning,例如:

this.http.enableSSLPinning(true);

希望对你有所帮助。

【讨论】:

  • 您好,wils..抱歉回复晚了。我已添加,但我可以在 burp suit 工具中看到所有 https(流量)请求。如果 SSL pinning 工作正常,它应该看不到 https 流量。..
  • 嗨@vishnu 我已经更新了这个例子。您需要在拨打电话之前启用 SSL Pinning,请参阅我添加的示例。
猜你喜欢
  • 2019-05-01
  • 2018-02-17
  • 1970-01-01
  • 2019-06-18
  • 2021-01-10
  • 1970-01-01
  • 2018-06-03
  • 2018-04-10
  • 1970-01-01
相关资源
最近更新 更多