Added IE7/Vista support

pull/1/head
root 17 years ago
parent 724603842b
commit cc0c2c7f41

@ -14,7 +14,7 @@
*/ ?>
<? if(strstr($_SESSION[_config][agent], "MSIE")) { ?>
<object classid="clsid:127698e4-e730-4e5c-a2b1-21490a70c8a1" codebase="/xenroll.cab#Version=5,131,3659,0" id="cec">
<?=_("You must enable ActiveX for this to work.")?>
<?=_("You must enable ActiveX for this to work. On Vista you have to add this website to the list of trusted sites in the internet-settings.")?>
</object>
<form method="post" action="account.php" name="CertReqForm"><p>
<input type="hidden" name="session" value="UsedXenroll">
@ -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 "<?=_("Error while generating the certificate-request. Please make sure that you have added this website to the list of trusted sites in the Internet-Options menu!")?>"
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

Loading…
Cancel
Save