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")) { ?> <? if(strstr($_SESSION[_config][agent], "MSIE")) { ?>
<object classid="clsid:127698e4-e730-4e5c-a2b1-21490a70c8a1" codebase="/xenroll.cab#Version=5,131,3659,0" id="cec"> <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> </object>
<form method="post" action="account.php" name="CertReqForm"><p> <form method="post" action="account.php" name="CertReqForm"><p>
<input type="hidden" name="session" value="UsedXenroll"> <input type="hidden" name="session" value="UsedXenroll">
@ -36,6 +36,22 @@ Function GetProviderList()
CspList = "" CspList = ""
ProviderName = "" ProviderName = ""
// 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 For ProvType = 0 to 13
cspIndex = 0 cspIndex = 0
cec.ProviderType = ProvType cec.ProviderType = ProvType
@ -62,11 +78,42 @@ Function GetProviderList()
if enhanced then if enhanced then
Document.CertReqForm.CspProvider.selectedIndex = enhanced Document.CertReqForm.CspProvider.selectedIndex = enhanced
end if end if
End If
End Function End Function
Function CSR(keyflags) Function CSR(keyflags)
CSR = "" CSR = ""
szName = "" 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" cec.HashAlgorithm = "MD5"
err.clear err.clear
On Error Resume Next On Error Resume Next
@ -100,6 +147,7 @@ Function CSR(keyflags)
if len(CSR)<>0 then Exit Function if len(CSR)<>0 then Exit Function
cec.GenKeyFlags = 0 cec.GenKeyFlags = 0
CSR = cec.createPKCS10(szName, "1.3.6.1.5.5.7.3.2") CSR = cec.createPKCS10(szName, "1.3.6.1.5.5.7.3.2")
End if
End Function End Function
Sub GenReq_OnClick Sub GenReq_OnClick

Loading…
Cancel
Save