android - 如何支持 IBM Worklight 6.2 for Android 的客户端证书相互认证?

标签 android cordova ssl ibm-mobilefirst

我是 Android 的新手,但我一直是移动网络应用程序的 Web 开发人员。我们需要将此 Web 应用程序包装在 Worklight Android 混合应用程序中。 我们有一个移动网络应用程序,它使用 X509 证书依赖客户端证书相互身份验证来确保安全。

我们已经有一个 iOS 混合应用程序可以执行以下操作:

- Check if Certificate is installed
- Redirect to Certificate Repository
- Download Certificate from the Repo
- Install Cert in App KeyChain
- Redirect to Secured WebApp with Client Cert Authentication

我们通过覆盖 UIViewController 并基于 Apple 代码创建 CustomHTTPProtocol 在 iOS 中实现了这一点: https://developer.apple.com/library/ios/samplecode/CustomHTTPProtocol/Listings/Read_Me_About_CustomHTTPProtocol_txt.html , 提供一个 fragment 有点大。

简单来说:我们只想知道如何在 Android 和 WorkLight 中处理带有客户端证书的网页。 是来自 MainActivity、CordovaWebView 还是 CordovaWebViewClient? 我们不想像这里的代码那样忽略证书: https://www.ibm.com/developerworks/community/blogs/mobileblog/entry/apache_cordova_working_with_certificates_on_android?lang=en

我正在挖掘所有相关的解决方案,但找不到任何可以提供答案的解决方案。 也许我需要在 Android 中直接处理 HttpsURLConnection,我不确定。

最佳答案

在 worklight 中,您通过适配器联系您的后端。因此,您可以从您的应用程序调用适配器,然后适配器调用后端。安全等在适配器层得到处理。 因此,在这种类型的架构中,您通过定义您的 keystore (以及要在该 keystore 中使用的证书)来配置 Worklight 服务器。当适配器尝试联系已配置相互身份验证的后端时,它会使用它。您会将后端的 CA 证书添加到运行 Worklight 的应用程序服务器的信任库中,以便 Worklight 也可以对后端进行身份验证。 因此,您主要需要执行以下操作:

  • 使用 Worklight 适配器联系后端
  • 通过在 worklight.properties 或 JNDI 条目中指定,使用 keystore 配置 Worklight 服务器
  • 将后端的CA证书添加到运行worklight server的App server的trust store
  • 在适配器的 xml 文件中提及 sslCertificateAlias、密码等
  • 从应用程序调用此适配器以到达后端

可以找到有关要在适配器中完成的 keystore 和 SSL 配置的信息 here .

而且这种方法应该适用于 Android 和 iOS。

关于android - 如何支持 IBM Worklight 6.2 for Android 的客户端证书相互认证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31957356/

相关文章:

android - WhatsApp 如何从技术上获取电话号码?

android - 更改方向时如何让 Activity 继续流式传输视频

android - 在 PhoneGap 中的 Android 后退按钮上停止退出 - 构建

android - 使用 as3 在 iphone 和 android 中通知

xml - 列表项背景在滚动时发生变化

cordova - phonegap 应用程序中的外部链接无法正常打开

android - cordova inAppBrowser 无法在 android 上运行

docker - Nginx docker 容器在 Ubuntu 20.04 中退出并出现错误 “fopen:No such file or directory:fopen('/etc/nginx/ssl/live/test.example.dev/fullchain.pem'”

ssl - 在 autocert.Manager 中省略 HostPolicy 是否有任何危险?

ssl - 在 openssh 中是否可以明智地编辑 ssh/ssh_config 或 sshd_config 文件密码?