通过浏览器生成 RSA 密钥

信息安全 证书 网页浏览器 公钥基础设施 RSA
2021-08-14 18:08:58

HTML5 具有将 SPKAC 发送到服务器的元素(据我所知)。

但是你如何在 IE 中做到这一点?

一个 CA 的网站给了我以下提示:

This Web site is attempting to perform a digital certificate operation on your behalf:

https://www.startssl.com/

You should only allow known Web sites to perform digital certificate operations on your behalf.
Do you want to allow this operation?

这很酷,但他们是如何做到的,我如何做到这一点,以便我的网站可以为人们生成私钥?IE 不支持 keygen 元素

2个回答

对于 Internet Explorer,对于此类工作,您应该使用CertEnroll API(在 Vista 之前的 Windows 中,这称为 XEnroll);它可以从 Javascript 中使用这意味着使用 Javascript 来检测浏览器的类型。

微软表示,缺乏支持<keygen>是“设计使然”。

当这个问题在 2013 年被问到时,我们没有Web Crypto API,但现在我们有了。SubtleCrypto.generateKey() 函数可用于在客户端以 javascript 生成 RSA 密钥对。有关更多信息,请参阅https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/generateKey