AppDevelopment:在应用程序本身中创建证书

AppDevelopment: Create Certificate in app itself

我的客户正在胖客户端中创建证书,因此他最终使用的是服务器证书和应用程序安装后创建的个人客户端证书。现在客户端和服务器都验证彼此的证书。

有人问我这种方法是否适用于 iOS 和 Android 应用程序。我在网上发现的所有内容都是服务器始终创建证书并且 public 密钥随应用程序一起部署。

对此有什么建议吗?它会提供额外的安全层吗?

简单的答案是肯定的,您可以在应用程序中创建一个密钥 - 例如,在 Java 域中有几个库可以执行此操作,主要构建在 Java JCE Api标准:

关于如何使用库和提供程序有多种选择,还有独立的加密库,最著名的是 BouncyCastle,它是 Android 衍生的 SpobgyCastle:

这里有一个稍旧但非常好的答案,它为 Android 提供了很好的背景:

上面的 Java 密码学文档中有一个很好的说明,还有:

WARNING: The JCA makes it easy to incorporate security features into your application. However, this document does not cover the theory of security/cryptography beyond an elementary introduction to concepts necessary to discuss the APIs. This document also does not cover the strengths/weaknesses of specific algorithms, not does it cover protocol design. Cryptography is an advanced topic and one should consult a solid, preferably recent, reference in order to make best use of these tools.

You should always understand what you are doing and why: DO NOT simply copy random code and expect it to fully solve your usage scenario. Many applications have been deployed that contain significant security or performance problems because the wrong tool or algorithm was selected.

你会发现这在许多密码学文本中也得到了回应 - 本质上它是说你的安全性与最弱的一样强 link,并且存在将密码学添加到应用程序并思考的危险然后一切都很好

最弱 link 的一个易于理解的示例是,如果您生成一个非常强大的 private/public 密钥对,但私钥本身的安全性较弱,允许黑客调试您的应用程序发现它。

My customer is creating an certificate within a fat client so in the end he is using a server certificate and an individual client certificate that was created after the app installation. Now both client and server validate each others certificate.

Any suggestions regarding this?

您可以使用两种模型之一(据我所知)。在第一个模型中,组织运行私有 PKI,服务器颁发客户端证书。在第二个中,客户端颁发自己的证书。

对于第一个模型,您可能应该使用 Simple Certificate Enrollment Protocol (SCEP)。它允许用户和设备向组织或服务器注册。组织也可以密码保护注册,并发送密码out-of-band(如电子邮件)。

Peter Gutmann 最近接手 RFC draft. I believe Microsoft calls is something else, and their server is called a NDES server

对于第二个模型,那么你可能应该使用Origin Bound Certificates (OBC)。它们是在客户需要时即时创建的“tear-off”证书。服务器在第一次使用时信任它们 (TOFU)。


Will it provide an extra layer of security?

视情况而定。我们需要查看威胁模型和现有的安全控制措施。然后,我们需要确定 SCEP 或 OBC 是否弥补了现有控制措施的额外差距。