summaryrefslogtreecommitdiffstats
path: root/dogtag/ca-ui/shared/webapps/ca/ee/ca/ProfileSelect.template
blob: bcb047dbf80c578c05ef83d8ac407189235502f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
<!-- --- BEGIN COPYRIGHT BLOCK ---
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; version 2 of the License.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License along
     with this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

     Copyright (C) 2007 Red Hat, Inc.
     All rights reserved.
     --- END COPYRIGHT BLOCK --- -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<CMS_TEMPLATE>
<font size="+1" face="PrimaSans BT, Verdana, Arial, Helvetica, sans-serif">
Certificate Profile
</font><br>
  <Font size="-1" face="PrimaSans BT, Verdana, Arial, Helvetica, sans-serif">
  Use this form to submit the request.
<p>
</font>
<table border="0" cellspacing="0" cellpadding="0" background="/pki/images/hr.gif"
width="100%">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<p>

<SCRIPT LANGUAGE="JavaScript">

var dual = 'false';
var encryptionKeyOnly = 'false';
var signingKeyOnly = 'false';

var keyList = new Array();
var key = new Object();
key.type = "RSA";
keyList[0] = key;
var key = new Object();
key.type = "EC";
keyList[1] = key;

function keyTypeOptions (keyPurpose)
{
  var keyType = "RSA";

  for (var i = 0; i < policySetListSet.length; i++) {
    for (var j = 0; j < policySetListSet[i].policySet.length; j++) {
      if (typeof(policySetListSet[i].policySet[j].constraintSet) != "undefined") {
        for (var k = 0; k < policySetListSet[i].policySet[j].constraintSet.length; k++) {
          if (policySetListSet[i].policySet[j].constraintSet[k].name == "keyType") {
            if (policySetListSet[i].policySet[j].constraintSet[k].value != "-") {
              if (keyPurpose.length == 0 || (keyPurpose.length > 0 && policySetListSet[i].setId.indexOf(keyPurpose) > -1)) {
                keyType = policySetListSet[i].policySet[j].constraintSet[k].value;
              }
            }
          }
        }
      }
    }
  }
  var keyFound = 0;
  for (var i = 0; i < keyList.length; i++) {
    if (keyList[i].type == keyType) {
        keyFound = 1;
    }
  }
  if (keyFound == 0) {
    keyType = "RSA";
  }
  if ((navigator.appName == "Microsoft Internet Explorer") &&
      ((navigator.appVersion).indexOf("NT 6.") == -1)) {
    keyType = "RSA";
  }

  return keyType;
}

function translateCurveName (name)
{
  var translated = "";
  if (navigator.appName == "Microsoft Internet Explorer") {
    if (name == "nistp256" || name == "ECDSA_P256") {
      translated = "ECDSA_P256";
    } else if (name == "nistp384" || name == "ECDSA_P384") {
      translated = "ECDSA_P384";
    } else if (name == "nistp521" || name == "ECDSA_P521") {
      translated = "ECDSA_P521";
    }
  } else {
    if (name == "ECDSA_P256") {
      translated = "nistp256";
    } else if (name == "ECDSA_P384") {
      translated = "nistp384";
    } else if (name == "ECDSA_P521") {
      translated = "nistp521";
    } else {
      translated = name;
    }
  }
  return translated;
}

function keyLengthsCurvesOptions (keyPurpose)
{
  var keyType = "RSA";
  var options = "";
  var lengthsOrCurves = null;
  var keyLengthsCurves = "";

  for (var i = 0; i < policySetListSet.length; i++) {
    for (var j = 0; j < policySetListSet[i].policySet.length; j++) {
      if (typeof(policySetListSet[i].policySet[j].constraintSet) != "undefined") {
        for (var k = 0; k < policySetListSet[i].policySet[j].constraintSet.length; k++) {
          if (policySetListSet[i].policySet[j].constraintSet[k].name == "keyType") {
            if (policySetListSet[i].policySet[j].constraintSet[k].value != "-") {
              if (keyPurpose.length == 0 || (keyPurpose.length > 0 && policySetListSet[i].setId.indexOf(keyPurpose) > -1)) {
                keyType = policySetListSet[i].policySet[j].constraintSet[k].value;
              }
            }
          }

          if (keyPurpose.length == 0 || (keyPurpose.length > 0 && policySetListSet[i].setId.indexOf(keyPurpose) > -1)) {
              if (policySetListSet[i].policySet[j].constraintSet[k].name == "keyParameters") {
                  keyLengthsCurves = policySetListSet[i].policySet[j].constraintSet[k].value;
                  lengthsOrCurves = keyLengthsCurves.split(",");
              }
          }
        }
      }
    }
  }
  if ((navigator.appName == "Microsoft Internet Explorer") &&
      ((navigator.appVersion).indexOf("NT 6.") == -1)) {
    keyType = "RSA";
  }

  var value = 0;
  var l = 0;
  for (l = 0 ; l < lengthsOrCurves.length; l++) {
      var included = true;

      value = lengthsOrCurves[l];

      if (keyType != "EC" && !isNumeric(value)) {
          included = false;
      } else if (keyType == "EC" &&
                 navigator.appName == "Microsoft Internet Explorer" &&
                 value != "nistp256" && value != "nistp384" && value != "nistp521" &
                 value != "ECDSA_P256" && value != "ECDSA_P384" && value != "ECDSA_P521") {
          included = false;
      }

      if (included) {
          if (keyType == "EC") {
              options += '<OPTION VALUE="' + translateCurveName(value) + '"';
          } else {
              options += '<OPTION VALUE="' + value + '"';
          }
          if (i == 0) {
              options += ' SELECTED';
          }
          options += '>' + value;
     }
  }

  if (options.length == 0) {
     if (keyType != "EC") {
         options = '<OPTION VALUE=1024 SELECTED>1024';
     } else {
         if (navigator.appName == "Microsoft Internet Explorer") {
             options = '<OPTION VALUE="ECDSA_P256">nistp256';
         } else {
             options = '<OPTION VALUE="nistp256">nistp256';
         }
     }
  }
  //alert("options="+options);

  return options;
}

function isNumeric(sText)
{
   var validChars = "0123456789";
   var isNumber=true;
   var char;

   if( !sText)
     return false;
 
   for (i = 0; i < sText.length && isNumber == true; i++)  {
      char = sText.charAt(i); 
      if (validChars.indexOf(char) == -1)  {
         isNumber = false;
      }
   }
   return isNumber;
}

function validate()
{
   if (keygen_request == 'false')
      return false;
    with (document.forms[0]) {
        /////////////////////////////////////////////////////////////////
        // To enable dual key feature, this page must be customized with
        // appropriate Javascript call. For example,
        //
        //      crmfObject = crypto.generateCRMFRequest(
        //              "CN=undefined",
        //              "regToken", "authenticator",
        //              null,
        //              "setCRMFRequest();",
        //              512, null, "rsa-ex",
        //              1024, null, "rsa-sign");
        // Note: This archival text below only applies to CS 7.1 and earlier:

        // To enable key archival feature, this page must be customized with
        // KRA's transport certificate. The transport certificate can be
        // retrieved in the following ways:
        // (1) Access "List Certificates" menu option in end-entity page
        // (2) Access https://<host>:<agent_port>/kra/displayTransportCert
        // (3) Use certutil command in <instance-dir>/config directory
        //     (i.e. certutil -L -d . -n "kraTransportCert <instance-id>" -a)
        //
        // Once the transport certificate is obtained, the following
        // javascript should be modified so that the transport certificate
        // and appropriate key type are selected. For example,
        //
        //      var kraTransportCert = "MIICDjCCAXegAwIBAgICAfMwDQYJKoZIhvcNAQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bmljYXRpb25zIENvcnBvcmF0aW9uMREwDwYDVQQLEwhIYXJkY29yZTEnMCUGA1UEAxMeSGFyZGNvcmUgQ2VydGlmaWNhdGUgU2VydmVyIElJMB4XDTk4MTExOTIzNDIxOVoXDTk5MDUxODIzNDIxOVowLjELMAkGA1UEBhMCVVMxETAPBgNVBAoTCG5ldHNjYXBlMQwwCgYDVQQDEwNLUmEwXDANBgkqhkiG9w0BAQEFAANLADBIAkEArrbDiYUI5SCdlCKKa0bEBn1m83kX6bdhytRYNkd/HB95Bp85SRadmdJV+0O/yMxjYAtGCFrmcqEZ4sh2YSov6wIDAQABozYwNDARBglghkgBhvhCAQEEBAMCAEAwHwYDVR0jBBgwFoAUl7FtsrYCFlQMl9fjMm3LnN/u3oAwDQYJKoZIhvcNAQEEBQADgYEApvzcUsVIOstaoYSiWb4+aMVH6s1jiJlr5iVHnOKzfsYxPVdUw6uz04AT8N+1KIarMTKxHPzGAFSLicKLEv4HG4vh6llc86uzRzWpUqqVHg/eKN5A8Jyg56D4DkNr/XEJ7QdKesAp13dk5H5qvHelkSPLYYdMXNwNWPVZKgnWrWg=";
        //      var keyGenAlg = "rsa-ex";
        //      crmfObject = crypto.generateCRMFRequest(
        //              "CN=undefined",
        //              "regToken", "authenticator",
        //              keyTransportCert,
        //              "setCRMFRequest();",
        //              512, null, keyGenAlg);
        /////////////////////////////////////////////////////////////////
        var keyTransportCert = null;


        if (typeof(transportCert) != "undefined" && transportCert != "") {
          // from CS7.2, transport certificate will be 
          // inserted automatically
          keyTransportCert = transportCert;
        }
        // generate keys for nsm.
        if (typeof(crypto) != "undefined" && typeof(crypto.version) != "undefined") {
            var encKeyType = "rsa-ex";
            var signKeyType = "rsa-sign";
            var dualKeyType = "rsa-dual-use";
            var encKeyParams = null;
            var encKeySize = 1024; 
            var signKeyParams = null;
            var signKeySize = 1024; 
            var keyParams = null;
            // Give this default because the ECC crytpo codes requires and integer
            // for this value even if presenting ECC curve name parameter.
            var keySize = 1024;

            try {
                if (dual == 'true') {
                    
                    if (keyTypeOptions("encryption") == "EC")  {
                        encKeyType = "ec-ex";
                        encKeyParams = "curve=" + encKeyParam.value; 
                    } else {
                        encKeySize = parseInt(encKeyParam.value);
                    }

                    if (keyTypeOptions("signing") == "EC") {
                        signKeyType = "ec-sign";
                        signKeyParams = "curve=" + signKeyParam.value;
                    } else {
                        signKeySize = parseInt(signKeyParam.value);
                    }

                    crmfObject = crypto.generateCRMFRequest(
                        "CN=x", "regToken", "authenticator",
        	        keyTransportCert, "setCRMFRequest();",
                        encKeySize, encKeyParams, encKeyType,
                        signKeySize, signKeyParams, signKeyType);
                } else {
                    if (encryptionKeyOnly == 'true') {
                        if (keyTypeOptions("") == "EC") {
                            dualKeyType = "ec-ex";
                            keyParams = "curve=" + keyParam.value;
                        } else {
                            dualKeyType = "rsa-ex";
                            keySize = parseInt(keyParam.value);
                        }
                    } else if (signingKeyOnly == 'true') {
                        if (keyTypeOptions("") == "EC") {
                            dualKeyType = "ec-sign";
                            keyParams = "curve=" + keyParam.value;
                        } else {
                            dualKeyType = "rsa-sign";
                            keySize = parseInt(keyParam.value);
                        }
                        keyTransportCert = null;
                    } else {
                        if (keyTypeOptions("") == "EC") {
                            dualKeyType = "ec-dual-use";
                            keyParams = "curve=" + keyParam.value;
                        } else {
                            keySize = parseInt(keyParam.value);
                        }
                        keyTransportCert = null;
                    }
                    crmfObject = crypto.generateCRMFRequest(
                        "CN=x", "regToken", "authenticator",
        	        keyTransportCert, "setCRMFRequest();",
                        keySize, keyParams, dualKeyType);
                }
            } catch (e) {
                if (typeof(crmfObject) == "undefined" || crmfObject == null) {
                    alert("Error generating CRMF request.");
                }
            }
        }
        return false;
    }
}

function setCRMFRequest()
{
    with (document.forms[0]) {
          cert_request.value = crmfObject.request;
          submit();
    }
}

</SCRIPT>


<script language=javascript>
  var uri = 'profileSubmit';
  if (typeof(authName) != "undefined") {
    if (authIsSSLClientRequired == 'true') {
      uri = 'https://[PKI_MACHINE_NAME]:[PKI_EE_SECURE_CLIENT_AUTH_PORT_UI]/[PKI_SUBSYSTEM_TYPE]/eeca/[PKI_SUBSYSTEM_TYPE]/profileSubmitSSLClient';
    }
  }
  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>");
    }
    document.writeln('<form name="ReqForm" onSubmit="if (checkRequest()) {return true;} else {window.location.reload(); return false;}" method="post" action="' + uri + '">');
  } else if (typeof(crypto) != "undefined" && typeof(crypto.version) != "undefined") {
    document.writeln('<form name="ReqForm" onSubmit="return validate();" method="post" action="' + uri + '">');
  } else {
    document.writeln('<form name="ReqForm" method="post" action="' + uri + '">');
   }
</script>

<SCRIPT LANGUAGE=VBS>
<!--
'Get OS Version, works for Vista and below only
Function GetOSVersion
  dim agent
  dim result
  dim pos

  agent = Navigator.appVersion
  pos = InStr(agent,"NT 6.")

  If pos > 0 Then
    GetOSVersion = 6 ' Vista
    Exit Function
  End If

  pos = InStr(agent,"NT 5.")

  If pos > 0 Then
    GetOSVersion = 5  ' XP etc
    Exit Function
  End If

' Default
  GetOSVersion = 5
End Function

Function checkRequest
  Dim TheForm
  Dim szName
  Dim options
  Dim osVersion
  Dim result
  Dim keyLen
  Dim keyParameter
  Dim keyIndex
  Set TheForm = Document.ReqForm

  checkRequest = False

  keyIndex = TheForm.all.keyLength.options.selectedIndex
  If (IsNumeric(TheForm.all.keyLength.options(keyIndex).value)) Then
    keyLen = CInt (TheForm.all.keyLength.options(keyIndex).value)
    keyParameter = ""
  Else
    keyLen = 0
    keyParameter = TheForm.all.keyLength.options(keyIndex).value
  End If

  osVersion = GetOSVersion()

  If osVersion <> 6 Then 'Not Vista

  ' Contruct the X500 distinguished name
  szName = "CN=NAME"

  On Error Resume Next
  Enroll.HashAlgorithm = "MD5"
  Enroll.KeySpec = 1

   ' Pick the provider that is selected
   set options = TheForm.all.cryptprovider.options
   index = options.selectedIndex
   Enroll.providerType = options(index).value
   Enroll.providerName = options(index).text

   ' adding 2 to "GenKeyFlags" will  enable the 'High Security'
   ' (USER_PROTECTED) mode, which means IE will pop up a dialog
   ' asking what level of protection you would like to give
   ' the key - this varies from 'none' to 'confirm password
   ' every time the key is used'
   ' Enroll.GenKeyFlags = 1        ' key PKCS12-exportable
  Enroll.GenKeyFlags = (65536 * (CLng(keyLen))) + 1
  szCertReq = Enroll.createPKCS10(szName, "1.3.6.1.5.5.7.3.2")
  theError = Err.Number
  On Error Goto 0
  '
  ' If the user has cancelled things the we simply ignore whatever
  ' they were doing ... need to think what should be done here
  '
  If (szCertReq = Empty AND theError = 0) Then
    Exit Function
  End If

  If (szCertReq = Empty OR theError <> 0) Then
    '
    ' There was an error in the key pair generation. The error value
    ' is found in the variable 'theError' which we snarfed above before
    ' we did the 'On Error Goto 0' which cleared it again.
    '
    sz = "The error '" & Hex(theError) & "' occurred." & chr(13) & chr(10) & "Your credentials could not be generated."
    result = MsgBox(sz, 0, "Credentials Enrollment")
    Exit Function
  End If

  TheForm.cert_request.Value = szCertReq

  ' TheForm.Submit

  Else 'Vista
    Dim enrollment
    Dim privateKey
    Dim request
    Dim csr
    Dim objDN

    'certUsage is "1.3.6.1.5.5.7.3.2"

    On Error Resume Next
    'CreateObject("X509Enrollment.CX509EnrollmentWebClassFactory")

    If IsObject(g_objClassFactory) = False Then
      result = MsgBox("Can't create Factory Object "  & " Error: " & Err.number & " :" & Err.description,0,"")
      Exit Function
    End If

    Set enrollment = g_objClassFactory.CreateObject("X509Enrollment.CX509Enrollment")

    If IsObject(enrollment) = False Then
      result = MsgBox("Can't create enroll Object! "  & " Error: " & Err.number & " :" & Err.description,"")
      Exit Function
    End If

    Set privateKey = g_objClassFactory.CreateObject("X509Enrollment.CX509PrivateKey")

    If IsObject(privateKey) = False Then
      result = MsgBox("Can't create Key Object! " & " Error: " & Err.number & " :" & Err.description,0,"")
      Exit Function
    End If

    Set request = g_objClassFactory.CreateObject("X509Enrollment.CX509CertificateRequestPkcs10")

    If IsObject(request) = False Then
      result = MsgBox("Can't create Request Object. ! " & " Error: " & Err.number & " :" & Err.description,0,"")
      Exit Function
    End If

    Set algobj = g_objClassFactory.CreateObject( "X509Enrollment.CObjectId" )
    If IsObject(algobj) = False Then
      result = MsgBox("Can't create OID Object. ! " & " Error: " & Err.number & " :" & Err.description,0,"")
      Exit Function
    End If
    algobj.InitializeFromAlgorithmName XCN_CRYPT_ANY_GROUP_ID, XCN_CRYPT_OID_INFO_PUBKEY_ANY, AlgorithmFlagsNone, keyParameter
    privateKey.Algorithm = algobj


    privateKey.KeySpec= "1" 

  ' Pick the provider that is selected
    set options = TheForm.all.cryptprovider.options
    index = options.selectedIndex
    privateKey.ProviderType = index
    privateKey.ProviderName = options(index).text
    If keyLen > 0 Then
      privateKey.Length = keyLen
    End If

    szName = "0.9.2342.19200300.100.1.1=" & TheForm.uid.Value & ",E=" & TheForm.email.Value & ",CN=" & TheForm.cn.Value

    Set objDN = g_objClassFactory.CreateObject("X509Enrollment.CX500DistinguishedName")

    If IsObject(objDN) = False Then
      result = MsgBox("Can't create DN Object. ! " & " Error: " & Err.number & " :" & Err.description,0,"")
      Exit Function
    End If

    objDN.Encode szName,0

    request.InitializeFromPrivateKey 1,privateKey,""
    request.Subject = objDN

    enrollment.InitializeFromRequest(request)
    csr=enrollment.CreateRequest(1)

    If len(csr) = 0 Then
      result = MsgBox("Error Creating Request! "& " Error: " & Err.number & " :" & Err.description,0,"")
      Exit Function
    End If

    TheForm.cert_request.Value = csr 
 
  End If
  checkRequest = True
End Function

-->
</SCRIPT>

<script language=javascript>
if (errorCode == 0) {
document.writeln('<br>');
document.writeln('<b>');
document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">');
document.writeln('Certificate Profile - ' + profileName);
document.writeln('</FONT>');
document.writeln('</b>');
document.writeln('<p>');
document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">');
document.writeln(profileDesc);
document.writeln('</FONT>');
document.writeln('<p>');
if (typeof(authName) != "undefined") {
document.writeln('<table width=100%>');
document.writeln('<tr>');
document.writeln('<td>');
document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">');
document.writeln('<b>');
document.writeln('Authentication - ' + authName);
document.writeln('</b>');
document.writeln('</FONT>');
document.writeln('</td>');
document.writeln('</tr>');
document.writeln('<tr>');
document.writeln('<td>');
document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">');
document.writeln(authDesc);
document.writeln('</FONT>');
document.writeln('</td>');
document.writeln('</tr>');
document.writeln('</table>');
document.writeln('<p>');
document.writeln('<table width=100%>');
for (var i = 0; i < authListSet.length; i++) {
    document.writeln('<tr>');
    document.writeln('<td width=40%>');
    document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">');
    document.writeln('<li>');
    document.writeln(authListSet[i].authName);
    document.writeln('</FONT>');
    document.writeln('</td>');
    document.writeln('<td>');
    if (authListSet[i].authSyntax == 'string') {
      document.writeln('<input type=text name=' + authListSet[i].authId + '>');
    } else if (authListSet[i].authSyntax == 'password') {
      document.writeln('<input type=password name=' + authListSet[i].authId + '>');
    }
    document.writeln('</td>');
  document.writeln('</tr>');
}
document.writeln('</table>');
}
document.writeln('<p>');
document.writeln('<table width=100%>');
document.writeln('<tr>');
document.writeln('<td>');
document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">');
document.writeln('<b>');
document.writeln('Inputs');
document.writeln('</b>');
document.writeln('</FONT>');
document.writeln('</td>');
document.writeln('</tr>');
document.writeln('</table>');
document.writeln('<p>');
document.writeln('<table width=100%>');
for (var m = 0; m < inputPluginListSet.length; m++) {
  document.writeln('<tr>');
  document.writeln('<td spancol=2>');
  document.writeln('<b>');
  document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">');
  document.writeln(inputPluginListSet[m].inputPluginName);
  document.writeln('</FONT>');
  document.writeln('</b>');
  document.writeln('</td>');
  document.writeln('</tr>');
  for (var n = 0; n < inputListSet.length; n++) {
    if (inputPluginListSet[m].inputPluginId != inputListSet[n].inputPluginId) 
       continue;
    document.writeln('<tr>');
    document.writeln('<td width=40%>');
    document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">');
    document.writeln('<li>');
    document.writeln(inputListSet[n].inputName);
    document.writeln('</FONT>');
    document.writeln('</td>');
    document.writeln('<td>');
    if (inputListSet[n].inputSyntax == 'string') {
      document.writeln('<input type=text name=' + inputListSet[n].inputId + '>');
    } else if (inputListSet[n].inputSyntax == 'cert_request') {
      document.writeln('<textarea cols=60 rows=10 name=' + inputListSet[n].inputId + '></textarea>');
    } else if (inputListSet[n].inputSyntax == 'cert_request_type') {
      document.writeln('<select name=' + inputListSet[n].inputId + '><option value="pkcs10">PKCS#10</option><option value="crmf">CRMF</option></select>');
    } else if (inputListSet[n].inputSyntax == 'dual_keygen_request') {
      if (navigator.appName == "Microsoft Internet Explorer") { 
        document.writeln('<input type=hidden name=' + inputListSet[n].inputId + '>');
      } else if (typeof(crypto) != "undefined" && typeof(crypto.version) != "undefined") {
        document.write('<SELECT NAME="encKeyParam">'+keyLengthsCurvesOptions("encryption")+'</SELECT>');
        document.write('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">&nbsp;&nbsp;');
        document.write(keyTypeOptions("encryption")+'&nbsp;&nbsp;(Encryption),&nbsp;&nbsp;</FONT>');
        document.write('<SELECT NAME="signKeyParam">'+keyLengthsCurvesOptions("signing")+'</SELECT>');
        document.write('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">&nbsp;&nbsp;');
        document.write(keyTypeOptions("signing")+'&nbsp;&nbsp;(Signing)</FONT>');
        document.writeln('<input type=hidden name=cert_request value="">');
        dual = 'true';
      } else {
        document.writeln('Not Supported<input type=hidden name=cert_request value="">');
      }
    } else if ((inputListSet[n].inputSyntax == 'keygen_request') ||
               (inputListSet[n].inputSyntax == 'enc_keygen_request') ||
               (inputListSet[n].inputSyntax == 'sign_keygen_request')) {
      if (navigator.appName == "Microsoft Internet Explorer") { 
        document.writeln('<input type=hidden name=' + inputListSet[n].inputId + '>');
        document.writeln('<SELECT NAME="keyLength">'+keyLengthsCurvesOptions("")+'</SELECT>&nbsp;&nbsp;<SELECT NAME=\"cryptprovider\"></SELECT>');
      } else if (typeof(crypto) != "undefined" && typeof(crypto.version) != "undefined") {
        document.write('<SELECT NAME="keyParam">'+keyLengthsCurvesOptions("")+'</SELECT>');
        document.write('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">');
        document.write('&nbsp;&nbsp;&nbsp;'+keyTypeOptions("")+'&nbsp;&nbsp;');
        if (inputListSet[n].inputSyntax == 'keygen_request') {
          document.write('(Encryption and Signing)</FONT>');
        } else if (inputListSet[n].inputSyntax == 'enc_keygen_request') {
          document.write('(Encryption)</FONT>');
          encryptionKeyOnly = 'true';
        } else if (inputListSet[n].inputSyntax == 'sign_keygen_request') {
          document.write('(Signing)</FONT>');
          signingKeyOnly = 'true';
        }
        document.writeln('<input type=hidden name=cert_request value="">');
      } else {
        document.writeln('<KEYGEN name=' + inputListSet[n].inputId + '>');
      }
    } else if (inputListSet[n].inputSyntax == 'dual_keygen_request_type') {
      keygen_request = 'true';
      if (navigator.appName == "Microsoft Internet Explorer") {
        document.writeln('Not Supported<input type=hidden name=' + inputListSet[n].inputId + ' value=>');
      } else if (typeof(crypto) != "undefined" && typeof(crypto.version) != "undefined") {
        document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">crmf</FONT><input type=hidden name=' + inputListSet[n].inputId + ' value=crmf>');
      } else {
        document.writeln('Not Supported<input type=hidden name=' + inputListSet[n].inputId + ' value=>');
      }
    } else if ((inputListSet[n].inputSyntax == 'keygen_request_type') ||
               (inputListSet[n].inputSyntax == 'enc_keygen_request_type') ||
               (inputListSet[n].inputSyntax == 'sign_keygen_request_type')) {
      keygen_request = 'true';
      if (navigator.appName == "Microsoft Internet Explorer") {
        document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">pkcs10</FONT><input type=hidden name=' + inputListSet[n].inputId + ' value=pkcs10>');
      } else if (typeof(crypto) != "undefined" && typeof(crypto.version) != "undefined") {
        document.writeln('<FONT size="-1" face="PrimaSans BT, Verdana, sans-serif">crmf</FONT><input type=hidden name=' + inputListSet[n].inputId + ' value=crmf>');
      } else {
        document.writeln('keygen<input type=hidden name=' + inputListSet[n].inputId + ' value=keygen>');
      }
    }
    document.writeln('</td>');
    document.writeln('</tr>');
  }
}
document.writeln('</table>');
document.writeln('<p>');
document.writeln('<input type=hidden name=profileId value="' + 
  profileId + '">');
document.writeln('<input type=hidden name=renewal value="' +
  renewal + '">');
document.writeln('<input type=hidden name=xmlOutput value="' +
  xmlOutput + '">');
} else {
  document.write('Sorry, your request is not submitted. The error code is "' + errorReason + '".');
}
</script>
<p>
<p>
<script language=javascript>
if (errorCode == 0) {
  if (navigator.appName == "Microsoft Internet Explorer") {
    if (typeof(keygen_request) != "undefined") {
      document.writeln('<input type=submit value="Submit">');
    } else {
      document.writeln('<input type=submit value="Submit">');
    }
  } else if (typeof(crypto) != "undefined" && typeof(crypto.version) != "undefined") {
    document.writeln('<input type=submit value="Submit">');
  } else {
    document.writeln('<input type=submit value="Submit">');
  }
} else {
}
  
</script>
<SCRIPT LANGUAGE=VBS>
<!--
FindProviders

Function FindProviders
	Dim i, j
	Dim providers()
	i = 0
	j = 1
	Dim el
	Dim temp
	Dim first
	Dim firstE
	Dim firstS
	Dim TheForm
	Set TheForm = document.ReqForm
	On Error Resume Next
	first = 0

        Dim osVersion
        Dim result
        osVersion = GetOSVersion()

        If osVersion <> 6 Then 'Not Vista
	  Do While True
	  temp = ""
	  Enroll.providerType = j
	  temp = Enroll.enumProviders(i,0)
	  If Len(temp) = 0 Then
	  If j < 1 Then 
	    j = j + 1
	    i = 0 
	  Else
	    Exit Do
	  End If
	  Else
	  set el = document.createElement("OPTION")
	  el.text = temp
	  el.value = j 
          If temp = "Microsoft Base Cryptographic Provider v1.0" Then
            first = i
          End If
          If temp = "Microsoft Strong Cryptographic Provider" Then
            firstS = i
          End If
          If temp = "Microsoft Enhanced Cryptographic Provider v1.0" Then
            firstE = i
          End If
	  TheForm.cryptprovider.add(el)
	  If firstE > 0  Then
	    TheForm.cryptprovider.selectedIndex = firstE
	  ElseIf firstS > 0  Then
	    TheForm.cryptprovider.selectedIndex = firstS
	  ElseIf first > 0  Then
	    TheForm.cryptprovider.selectedIndex = first
	  Else
	    first = 1
	    TheForm.cryptprovider.selectedIndex = 0
	  End If
	  i = i + 1
	  End If
	  Loop
        Else 'Vista
            Dim csps 
            Set csps = g_objClassFactory.CreateObject("X509Enrollment.CCspInformations")
            If IsObject(csps) = False Then
               result = MsgBox("Can't create CSP List Object! " & " Error: " & Err.number & " :" & Err.description,0,"")
               Exit Function

            End If
            csps.AddAvailableCsps()
            'result = MsgBox(csps.Count,0,"Number of CSPS")

            Dim curName
            Dim csp
            Dim selected 
            Dim selectedS 
            Dim selectedE 
            Dim selectedEC 
            selected = -1
            selectedS = -1
            selectedE = -1
            selectedEC = -1
            For i = 0 to csps.Count-1
               
                curName = csps.ItemByIndex(i).Name
                If len(curName) > 0 Then
                  Set csp = document.createElement("OPTION")
                  csp.text = curName
                  csp.value = 1
                  TheForm.cryptprovider.add(csp)

                  If curName = "Microsoft Base Cryptographic Provider v1.0" Then
                    selected = i
                  End If
                  If curName = "Microsoft Strong Cryptographic Provider" Then
                    selectedS = i
                  End If
                  If curName = "Microsoft Enhanced Cryptographic Provider v1.0" Then
                    selectedE = i
                  End If
                  If curName = "Microsoft Software Key Storage Provider" Then
                    selectedEC = i
                  End If
                  'result = MsgBox(curName,0,"")
                End If 
            Next
            If selectedEC >= 0  Then
              TheForm.cryptprovider.selectedIndex = selectedEC
            ElseIf selectedE >= 0  Then
              TheForm.cryptprovider.selectedIndex = selectedE
            ElseIf selectedS >= 0  Then
              TheForm.cryptprovider.selectedIndex = selectedS
            ElseIf selected >= 0  Then
              TheForm.cryptprovider.selectedIndex = selected
            Else
              TheForm.cryptprovider.selectedIndex = 0
            End If
        End If
End Function

-->
</SCRIPT>
</form>
</html>