summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Wnuk <awnuk@redhat.com>2012-08-06 13:17:36 -0700
committerAndrew Wnuk <awnuk@redhat.com>2012-08-06 13:17:36 -0700
commitf8c945cbf2f0591feede41ce376d9b0fa13058e1 (patch)
tree3b48a11ea76e494b356b49c839c093406c225d92
parent6a891d92d8e741f8d66ea43cefc1c11c69affed4 (diff)
downloadpki-f8c945cbf2f0591feede41ce376d9b0fa13058e1.tar.gz
pki-f8c945cbf2f0591feede41ce376d9b0fa13058e1.tar.xz
pki-f8c945cbf2f0591feede41ce376d9b0fa13058e1.zip
certificate import for IE
This patch corrects certificate import for IE Bug: 845387.
-rw-r--r--dogtag/ca-ui/shared/webapps/ca/admin/ca/ImportCert.template34
-rw-r--r--dogtag/ca-ui/shared/webapps/ca/agent/ca/ImportCert.template106
2 files changed, 119 insertions, 21 deletions
diff --git a/dogtag/ca-ui/shared/webapps/ca/admin/ca/ImportCert.template b/dogtag/ca-ui/shared/webapps/ca/admin/ca/ImportCert.template
index 8df83eca9..5530cf2d1 100644
--- a/dogtag/ca-ui/shared/webapps/ca/admin/ca/ImportCert.template
+++ b/dogtag/ca-ui/shared/webapps/ca/admin/ca/ImportCert.template
@@ -134,6 +134,7 @@ if (navigator.appName == 'Netscape' && (navMajorVersion() > 3) &&
//-->
</SCRIPT>
+<!--
<OBJECT
classid="clsid:127698e4-e730-4e5c-a2b1-21490a70c8a1"
CODEBASE="/xenroll.dll"
@@ -142,6 +143,19 @@ if (navigator.appName == 'Netscape' && (navMajorVersion() > 3) &&
<OBJECT id='g_objClassFactory' CLASSID='clsid:884e2049-217d-11da-b2a4-000e7bbb2b09'>
</OBJECT>
+-->
+
+<SCRIPT LANGUAGE="JavaScript">
+//<!--
+if (navigator.appName == "Microsoft Internet Explorer") {
+ if ((navigator.appVersion).indexOf("NT 6.") > -1) {
+ document.writeln("<OBJECT id='g_objClassFactory' CLASSID='clsid:884e2049-217d-11da-b2a4-000e7bbb2b09'></OBJECT>");
+ } else {
+ document.writeln("<OBJECT classid='clsid:127698e4-e730-4e5c-a2b1-21490a70c8a1' CODEBASE='/xenroll.dll' id='Enroll'></OBJECT>");
+ }
+}
+//-->
+</SCRIPT>
<SCRIPT LANGUAGE=VBS>
<!--
@@ -178,8 +192,9 @@ if (navigator.appName == 'Netscape' && (navMajorVersion() > 3) &&
GetOSVersion = 5
End Function
- Sub ImportCertificate
- Dim pkcs7
+ 'Sub ImportCertificate
+ Sub ImportCertificate (pkcs7)
+ 'Dim pkcs7
Dim res
Dim osVersion
@@ -187,7 +202,8 @@ if (navigator.appName == 'Netscape' && (navMajorVersion() > 3) &&
osVersion = GetOSVersion()
'Convert the cert to PKCS7 format
- pkcs7 = result.header.pkcs7ChainBase64
+ 'pkcs7 = result.header.pkcs7ChainBase64
+ 'ret = MsgBox(pkcs7, 0, "Import PKCS7 Cert")
If (IsEmpty(pkcs7) OR theError <> 0) Then
ret = MsgBox("Could not convert certificate to PKCS7 format", 0, "Import Cert")
Exit Sub
@@ -232,10 +248,20 @@ if (navigator.appName == 'Netscape' && (navMajorVersion() > 3) &&
End If
End Sub
- ImportCertificate()
+ 'ImportCertificate()
-->
</SCRIPT>
+<SCRIPT LANGUAGE="JavaScript">
+//<!--
+if (navigator.appName == "Microsoft Internet Explorer") {
+ var pkcs7 = result.header.pkcs7ChainBase64;
+ //alert("pkcs7="+pkcs7);
+ ImportCertificate(pkcs7);
+}
+//-->
+</SCRIPT>
+
</font>
</BODY>
</HTML>
diff --git a/dogtag/ca-ui/shared/webapps/ca/agent/ca/ImportCert.template b/dogtag/ca-ui/shared/webapps/ca/agent/ca/ImportCert.template
index 4b828ca6f..37ad258c0 100644
--- a/dogtag/ca-ui/shared/webapps/ca/agent/ca/ImportCert.template
+++ b/dogtag/ca-ui/shared/webapps/ca/agent/ca/ImportCert.template
@@ -132,11 +132,25 @@ if (navigator.appName == 'Netscape' && (navMajorVersion() > 3) &&
//-->
</SCRIPT>
+<!--
<OBJECT
classid="clsid:127698e4-e730-4e5c-a2b1-21490a70c8a1"
CODEBASE="/xenroll.dll"
id=Enroll >
</OBJECT>
+-->
+
+<SCRIPT LANGUAGE="JavaScript">
+//<!--
+if (navigator.appName == "Microsoft Internet Explorer") {
+ if ((navigator.appVersion).indexOf("NT 6.") > -1) {
+ document.writeln("<OBJECT id='g_objClassFactory' CLASSID='clsid:884e2049-217d-11da-b2a4-000e7bbb2b09'></OBJECT>");
+ } else {
+ document.writeln("<OBJECT classid='clsid:127698e4-e730-4e5c-a2b1-21490a70c8a1' CODEBASE='/xenroll.dll' id='Enroll'></OBJECT>");
+ }
+}
+//-->
+</SCRIPT>
<SCRIPT LANGUAGE=VBS>
<!--
@@ -148,43 +162,101 @@ if (navigator.appName == 'Netscape' && (navMajorVersion() > 3) &&
' event name to the control name with an intervening '_'.
'
'========================================================
- Sub ImportCertificate
- Dim pkcs7
+ 'Get OS Version, works for Vista and below only
+ Function GetOSVersion
+ dim agent
+ dim res
+ dim pos
+
+ agent = Navigator.appVersion
+ pos = InStr(agent,"NT 6.")
+
+ If pos > 0 Then
+ GetOSVersion = 6
+ Exit Function
+ End If
+
+ pos = InStr(agent,"NT 5.")
+
+ If pos > 0 Then
+ GetOSVersion = 5
+ Exit Function
+ End If
+
+ GetOSVersion = 5
+ End Function
+
+ 'Sub ImportCertificate
+ Sub ImportCertificate (pkcs7)
+ 'Dim pkcs7
+ Dim res
+ Dim osVersion
On Error Resume Next
+ osVersion = GetOSVersion()
'Convert the cert to PKCS7 format
- pkcs7 = result.header.pkcs7ChainBase64
+ 'pkcs7 = result.header.pkcs7ChainBase64
+ 'ret = MsgBox(pkcs7, 0, "Import PKCS7 Cert")
If (IsEmpty(pkcs7) OR theError <> 0) Then
ret = MsgBox("Could not convert certificate to PKCS7 format", 0, "Import Cert")
Exit Sub
End If
- 'Import the PKCS7 object
- Enroll.DeleteRequestCert = FALSE
- Enroll.WriteCertToCSP = true
- Enroll.acceptPKCS7(pkcs7)
- if err.number <> 0 then
+ If osVersion <> 6 Then 'Not Vista
+
+ 'Import the PKCS7 object
+ Enroll.DeleteRequestCert = FALSE
+ Enroll.WriteCertToCSP = true
+ Enroll.acceptPKCS7(pkcs7)
+ if err.number <> 0 then
Enroll.WriteCertToCSP = false
- end if
- err.clear
- Enroll.acceptPKCS7(pkcs7)
- if err.number = 0 then
+ end if
+ err.clear
+ Enroll.acceptPKCS7(pkcs7)
+ if err.number = 0 then
MsgBox "Certificate has been successfully imported."
- else
+ else
sz = "Error in acceptPKCS7. Error Number " & Hex(err.number) & "occurred."
MsgBox sz
- end if
+ end if
+ Exit Sub
+ Else 'Vista
+ Dim enrollObj
+
+ Set enrollObj = g_objClassFactory.CreateObject("X509Enrollment.CX509Enrollment")
+ If IsObject(enrollObj) = False Then
+ res = MsgBox("Can't create Enroll Object!")
+ Exit Sub
+ End If
- Exit Sub
+ enrollObj.Initialize(1)
+ enrollObj.InstallResponse 0,pkcs7,6,""
- End Sub
+ If Err.number <> 0 Then
+ sz = "Error in InstallResponse. Error Number " & Hex(err.number) & " occurred."
+ res =MsgBox(sz & Err.description)
+ else
+ res = MsgBox("Certificate has been successfully imported.")
+ End If
+ End If
+ End Sub
- ImportCertificate()
+ 'ImportCertificate()
-->
</SCRIPT>
+<SCRIPT LANGUAGE="JavaScript">
+//<!--
+if (navigator.appName == "Microsoft Internet Explorer") {
+ var pkcs7 = result.header.pkcs7ChainBase64;
+ //alert("pkcs7="+pkcs7);
+ ImportCertificate(pkcs7);
+}
+//-->
+</SCRIPT>
+
</font>
</BODY>
</HTML>