本文主要通过简单实例,展示javascript调用微软CertEnroll及相关控件,实现对CSP数字证书的申请操作。
1. CSP读取及列表展示
...
var providerList = document.getElementById("cspprovider");
var certEnrollFactory = document.getElementById("oCertEnrollFactory");
var csps = certEnrollFactory.CreateObject("X509Enrollment.CCspInformations");
var csp = certEnrollFactory.CreateObject("X509Enrollment.CCspInformation");
var providerName = "";
var index = 0;
csps.AddAvailableCsps();
while (csps.Count > index) {
csp = csps.ItemByIndex(index);
providerName = csp.Name;
option = new Option(providerName, index, false, true);
providerList.add(option);
providerName = "";
index++;
}
...
2. 生成P10
...
var pkcs10 = "";
var dn =