diff --git a/pages/account/4.php b/pages/account/4.php index 6e2b655..97f39ca 100644 --- a/pages/account/4.php +++ b/pages/account/4.php @@ -14,7 +14,7 @@ */ ?> - +

@@ -36,7 +36,23 @@ Function GetProviderList() CspList = "" ProviderName = "" - For ProvType = 0 to 13 + // Vista: + Set csps = CreateObject("X509Enrollment.CCspInformations") + If IsObject(csps) Then + csps.AddAvailableCsps() + Document.CertReqForm.keytype.value="VI" + For j = 0 to csps.Count-1 + Set oOption = document.createElement("OPTION") + oOption.text = csps.ItemByIndex(j).Name + oOption.value = j + Document.CertReqForm.CspProvider.add(oOption) + Next + + Else + + // 2000,XP: + + For ProvType = 0 to 13 cspIndex = 0 cec.ProviderType = ProvType ProviderName = cec.enumProviders(cspIndex,0) @@ -56,17 +72,48 @@ Function GetProviderList() ProviderName = "" ProviderName = cec.enumProviders(cspIndex,0) count = count + 1 - wend - Next - Document.CertReqForm.CspProvider.selectedIndex = base - if enhanced then + wend + Next + Document.CertReqForm.CspProvider.selectedIndex = base + if enhanced then Document.CertReqForm.CspProvider.selectedIndex = enhanced - end if + end if + End If End Function Function CSR(keyflags) CSR = "" szName = "" + + + // Vista + if Document.CertReqForm.keytype.value="VI" Then + + Dim g_objClassFactory + Dim obj + Dim objPrivateKey + Dim g_objRequest + Dim g_objRequestCMC + + Set g_objClassFactory=CreateObject("X509Enrollment.CX509EnrollmentWebClassFactory") + Set obj=g_objClassFactory.CreateObject("X509Enrollment.CX509Enrollment") + Set objPrivateKey=g_objClassFactory.CreateObject("X509Enrollment.CX509PrivateKey") + Set objRequest=g_objClassFactory.CreateObject("X509Enrollment.CX509CertificateRequestPkcs10") + objPrivateKey.ProviderName = "Microsoft Enhanced RSA and AES Cryptographic Provider" + objPrivateKey.ProviderType = "24" + objPrivateKey.KeySpec = "1" + objRequest.InitializeFromPrivateKey 1, objPrivateKey, "" + // obj.Initialize(1) + obj.InitializeFromRequest(objRequest) + obj.CertificateDescription="Description" + obj.CertificateFriendlyName="FriendlyName" + CSR=obj.CreateRequest(1) + If len(CSR)<>0 Then Exit Function + Msgbox "" + + else + // XP + cec.HashAlgorithm = "MD5" err.clear On Error Resume Next @@ -100,6 +147,7 @@ Function CSR(keyflags) if len(CSR)<>0 then Exit Function cec.GenKeyFlags = 0 CSR = cec.createPKCS10(szName, "1.3.6.1.5.5.7.3.2") + End if End Function Sub GenReq_OnClick