1
<HTML> <!-- -*- Mode: Java; tab-width: 8 -*- -->
2
<!-- This Source Code Form is subject to the terms of the Mozilla Public
3
- License, v. 2.0. If a copy of the MPL was not distributed with this
4
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
6
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
<SCRIPT LANGUAGE="JavaScript1.2">
9
script_url = 'http://interzone.mcom.com/cgi-bin/certomatic/bin/certcgi.cgi'
12
make_page_intro('Version 1 extensions', "#FFFFFF") +
13
'<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext1">' +
14
'Version 1 X.509 certs do not support extensions' +
20
your_certificate_index_label = 'Your Certificate';
21
netscape_extensions_index_label = 'Netscape X.509 Extensions';
22
standard_extensions_index_label = 'Standard X.509 Extensions';
23
certifying_authorities_index_label = 'Certifying Authorities';
24
add_sub_alt_name_index_label = 'Add Subject Alternative Name';
27
'0, your_certificate_index_label,' +
28
'0, netscape_extensions_index_label,' +
29
'0, standard_extensions_index_label,' +
30
'0, certifying_authorities_index_label';
39
ext_page_array = new Array(max_pages);
41
index_label = 'Options';
44
make_page_intro('Your Key', "#FFFFFF") +
45
'<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="main" SRC="main.html">' +
49
function setSubAltNameType(form)
52
if (SubAltNameRadio[0].checked) {
55
if (SubAltNameRadio[3].checked || SubAltNameRadio[5].checked) {
56
SubAltNameDataType.checked = true;
59
if (SubAltNameRadio[1].checked || SubAltNameRadio[2].checked ||
60
SubAltNameRadio[4].checked || SubAltNameRadio[6].checked ||
61
SubAltNameRadio[7].checked || SubAltNameRadio[8].checked) {
62
SubAltNameDataType.checked = false;
69
function setIssuerAltNameType(form)
72
if (IssuerAltNameRadio[0].checked) {
75
if (IssuerAltNameRadio[3].checked || IssuerAltNameRadio[5].checked) {
76
IssuerAltNameDataType.checked = true;
79
if (IssuerAltNameRadio[1].checked || IssuerAltNameRadio[2].checked ||
80
IssuerAltNameRadio[4].checked || IssuerAltNameRadio[6].checked ||
81
IssuerAltNameRadio[7].checked || IssuerAltNameRadio[8].checked) {
82
IssuerAltNameDataType.checked = false;
90
function setNameConstraintNameType(form)
93
if (NameConstraintRadio[0].checked) {
96
if (NameConstraintRadio[3].checked || NameConstraintRadio[5].checked) {
97
NameConstraintNameDataType.checked = true;
100
if (NameConstraintRadio[1].checked || NameConstraintRadio[2].checked ||
101
NameConstraintRadio[4].checked || NameConstraintRadio[6].checked ||
102
NameConstraintRadio[7].checked || NameConstraintRadio[8].checked) {
103
NameConstraintNameDataType.checked = false;
111
function addSubAltName(form)
114
var len = SubAltNameSelect.length;
117
while(!(i == (SubAltNameRadio.length - 1)) &
118
!(SubAltNameRadio[i].checked == true)) {
122
value = SubAltNameText.value + " - " + (i + 1);
124
value = SubAltNameText.value + " - " +
125
SubAltNameOtherNameOID.value + " - ";
126
if (SubAltNameDataType.checked) {
132
if (SubAltNameOtherNameOID.value == "") {
133
alert("Other names must include an OID");
138
if ((SubAltNameText.value == "") | (SubAltNameRadio[i].checked != true)) {
139
alert("Alternative Names must include values for name and name type.");
141
SubAltNameSelect.options[len] = new Option(value, value);
147
function deleteSubAltName(form)
150
while (SubAltNameSelect.selectedIndex >= 0) {
151
SubAltNameSelect[SubAltNameSelect.selectedIndex] = null;
156
function addIssuerAltName(form)
160
var len = IssuerAltNameSelect.length;
164
while(!(i == (IssuerAltNameRadio.length -1)) &
165
!(IssuerAltNameRadio[i].checked == true)) {
169
value = IssuerAltNameText.value + " - " + (i + 1);
171
value = IssuerAltNameText.value + " - " +
172
IssuerAltNameOtherNameOID.value + " - ";
173
if (IssuerAltNameDataType.checked) {
179
if (IssuerAltNameOtherNameOID.value == "") {
180
alert("Other names must include an OID");
184
if ((IssuerAltNameText.value == "") |
185
(IssuerAltNameRadio[i].checked != true)) {
186
alert("Alternative Names must include values for name and name type.")
188
IssuerAltNameSelect.options[len] = new Option(value, value);
194
function deleteIssuerAltName(form)
197
while (IssuerAltNameSelect.selectedIndex >= 0) {
198
IssuerAltNameSelect[IssuerAltNameSelect.selectedIndex] = null;
205
function addNameConstraint(form)
208
var len = NameConstraintSelect.length;
211
var min = NameConstraintMin.value;
212
var max = NameConstraintMax.value;
214
while(!(i == (NameConstraintRadio.length - 1) ) &
215
!(NameConstraintRadio[i].checked == true)) {
218
value = NameConstraintText.value + " - ";
220
value += NameConstraintOtherNameOID.value + " - ";
221
if (NameConstraintNameDataType.checked) {
226
if (NameConstraintOtherNameOID.value == "") {
227
alert("Other names must include an OID");
231
value += (i + 1) + " - ";
232
if (NameConstraintTypeRadio[0].checked == true) {
237
value += min + " - " + max;
238
if ((min == "") | (NameConstraintText.value == "") |
239
(NameConstraintRadio[i].checked != true)) {
240
alert("Name Constraints must include values for minimum, name, and name type.")
242
NameConstraintSelect.options[len] = new Option(value, value);
248
function deleteNameConstraint(form)
251
while (NameConstraintSelect.selectedIndex >= 0) {
252
NameConstraintSelect[NameConstraintSelect.selectedIndex] = null;
260
save_cur_page(cur_page);
262
var ver1 = (ver == 1);
263
var ver3 = (ver == 3);
265
var serial = ext_page_array[0][10][0];
266
var serial_number = ext_page_array[0][12][0];
267
var manValidity = ext_page_array[0][19][0];
268
var notBefore = ext_page_array[0][20][0];
269
var notAfter = ext_page_array[0][21][0];
270
var subject = ext_page_array[0][22][0];
273
alert("The DN field must contain some data");
276
if (!serial & serial_number == "") {
277
alert("No serial number specified");
280
if (ext_page_array[0][15][0]) {
281
var keygen = "<keygen name=\"key\" challenge=\"foo\">";
283
switch (ext_page_array[0][17][0]) {
285
var keygen = "<keygen keytype=\"dsa\" pqg=\"MIGdAkEAjfKklEkidqo9JXWbsGhpy+rA2Dr7jQz3y7gyTw14guXQdi/FtyEOr8Lprawyq3qsSWk9+/g3JMLsBzbuMcgCkQIVAMdzIYxzfsjumTtPLe0w9I7azpFfAkEAYm0CeDnqChNBMWOlW0y1ACmdVSKVbO/LO/8Q85nOLC5xy53l+iS6v1jlt5UhklycxC6fb0ZLCIzFcq9T5teIAg==\" name=\"key\" challenge=\"foo\">";
288
var keygen = "<keygen keytype=\"dsa\" pqg=\"MIHaAmDCboVgX0+6pEeMlbwsasWDVBcJNHPKMzkq9kbCRK2U3k+tE15n+Dc2g3ZjDYr1um51e2iLC34/BwAAAAAAAAAAAAAAAAAAAAAAAAABbBhnlFN5Djmt0Mk8cdEBY5H8iPMCFMhUnFtbpjn3EyfH2DjVg3ALh7FtAmA2zWzhpeCwvOTjYnQorlXiv0WcnSiWmaC79CRYkFt5i+UEfRxwP1eNGJBVB1T+CPW6JGd4WhgsqtSf53pn5DEtv++O7lNfXyOhWhb3KaWHYIx8fuAXtioIWkWmpfEIVZA=\" name=\"key\" challenge=\"foo\">";
291
var keygen = "<keygen keytype=\"dsa\" pqg=\"MIIBHAKBgId8SiiWrcdua5zbsBhPkKfFcnHBG7T/bQla7c6OixGjjmSSuq2fJLvMKa579CaxHxLZzZZXIHmAk9poRgWl2GUUkCJ68XSum8OQzDPXPsofcEdeANjw3mIAAAAAAAAAAAAAAAAAAAAAAAAIE+MkW5hguLIQqWvEVi9dMpbNu6OZAhTIA+y3TgyiwA0D8pt686ofaL1IOQKBgAiZQC6UCXztr2iXxJrAC+51gN5oX/R9Thilln9RGegsWnHrdxUOpcm5vAWp1LU8TOXtujE8kqkm3UxIRhUWQORe9IxLANAXmZJqkw9FEVHkxj6Cy9detwT2MyBzSwS6avsf7aLisgHmI/IHSeapJsQ3NQa3rikb6zRiqIV+TVa6\" name=\"key\" challenge=\"foo\">";
295
array_string = build_array_string();
296
hiddens = "<input type=\"hidden\" name=\"subject\" value=\'" + subject + "\'> \n" +
297
"<input type=\"hidden\" name=\"serial-auto\" value=\"" + serial + "\"> \n" +
298
"<input type=\"hidden\" name=\"serial_value\" value=\"" + serial_number + "\"> \n" +
299
"<input type=\"hidden\" name=\"ver-1\" value=\"" + ver1 + "\"> \n" +
300
"<input type=\"hidden\" name=\"ver-3\" value=\"" + ver3 + "\"> \n" +
301
"<input type=\"hidden\" name=\"notBefore\" value=\"" + notBefore + "\"> \n" +
302
"<input type=\"hidden\" name=\"notAfter\" value=\"" + notAfter + "\"> \n" +
303
"<input type=\"hidden\" name=\"manValidity\" value=\"" + manValidity + "\"> \n" +
306
var good_submit_page =
308
'<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#FF0000" BGCOLOR="#FFFFFF">' +
309
'<form method="post" action="' + script_url + '">' +
310
'Select size for your key:' + keygen + '</p>' +
311
'<input type="submit"></p>' +
317
window.frames['right'].document.write(good_submit_page);
318
window.frames['right'].document.close();
319
cur_page = max_pages + 1;
320
make_left_frame(window);
326
function build_array_string()
329
var array_string = '';
332
if ((ext_page_array[3][4][0] > 0) && ext_page_array[3][3][0]) {
333
pages = 4 + parseInt(ext_page_array[3][4][0]);
337
for (pg = 1; pg < pages; pg++) {
338
if ((pg > 1 || (ver == 3)) && (ext_page_array[pg].length > 1)) {
340
for (i = 0; i < ext_page_array[pg].length; i++) {
341
if (ext_page_array[pg][i][3].indexOf("radio") == -1) {
342
if (ext_page_array[pg][i][3].indexOf("multiple") == -1) {
343
array_string += '<input type=\"hidden\" name=\"' +
344
ext_page_array[pg][i][1] + '\" value=\'' +
345
ext_page_array[pg][i][0] + '\'> \n';
347
for (k = 0; k < ext_page_array[pg][i][0].length; k++) {
348
array_string += '<input type=\"hidden\" name=\"' +
349
ext_page_array[pg][i][1] + k + '\" value=\'' +
350
ext_page_array[pg][i][0][k] + '\'> \n';
354
array_string += '<input type=\"hidden\" name=\"' +
355
ext_page_array[pg][i][1] + '-' +
356
ext_page_array[pg][i][2] + '\" value=\'' +
357
ext_page_array[pg][i][0] + '\'> \n';
361
for (i = 0; i < ext_page_array[pg].length; i++) {
362
if (ext_page_array[pg][i][3].indexOf("radio") == -1) {
363
if (ext_page_array[pg][i][3].indexOf("multiple") == -1) {
364
array_string += '<input type=\"hidden\" name=\"' +
365
'CA#' + (pg - 3) + '-' +
366
ext_page_array[pg][i][1] + '\" value=\'' +
367
ext_page_array[pg][i][0] +'\'> \n';
369
for (k = 0; k < ext_page_array[pg][i][0].length; k++) {
370
array_string += '<input type=\"hidden\" name=\"' +
371
'CA#' + (pg - 3) + '-' +
372
ext_page_array[pg][i][1] + k + '\" value=\'' +
373
ext_page_array[pg][i][0][k] + '\'> \n';
377
array_string += '<input type=\"hidden\" name=\"' +
378
'CA#' + (pg - 3) + '-' +
379
ext_page_array[pg][i][1] + '-' +
380
ext_page_array[pg][i][2] + '\" value=\'' +
381
ext_page_array[pg][i][0] + '\'> \n';
392
function init_ext_page_array()
394
for (i = 0; i < max_pages; i++) {
395
ext_page_array[i] = '';
399
function ca_num_change(n,ca_form)
403
if (caChoiceradio[2].checked) {
405
update_left_frame(n);
407
update_left_frame(0);
413
function choice_change(ca_form)
416
if (caChoiceradio[2].checked) {
417
ca_num_change(manCAs.value,ca_form);
419
update_left_frame(0);
424
function update_left_frame(n)
427
for (var i = 0; i < n; i++) {
429
add_string = add_string + ',1, \'CA #' + j + '\'';
431
top.add_index_list = add_string;
433
make_left_frame(window);
437
// redraws the extensions page for version 1 certificates
440
if (cur_page == 2 || cur_page == 3) {
441
switch_right_frame(window, cur_page, cur_page);
447
// redraws the extensions page for version 3 certificates
451
switch_right_frame(window, 0, 2);
452
} else if (cur_page == 3) {
453
switch_right_frame(window, 0, 3);
457
function reset_subject(marker, value, form)
458
// Updates the subject field from a subordinate field
461
var field_sep = '", ';
462
var begin_index = subject.value.indexOf(marker);
463
if (begin_index != 0 && subject.value[begin_index - 1] != ' ') {
464
begin_index = subject.value.indexOf(marker, begin_index +1);
466
var end_index = subject.value.indexOf(field_sep, begin_index);
467
if (begin_index > -1) { // is it a delete/change?
468
if (end_index == -1) { // is it the last one (includes only one)?
469
if (value.length > 0) { // do I have to change it?
470
if (begin_index == 0) { // is is the only one?
471
subject.value = marker + '"' + value + '"';
472
} else { // it is the last of many
473
subject.value = subject.value.substring(0,begin_index) +
474
marker + '"' + value + '"';
476
} else { // must be a delete
477
if (begin_index == 0) { // is it the only one?
480
subject.value = subject.value.substring(0,(begin_index - 2));
482
} else { // it is the first of many or a middle one
483
if (value.length >0) { // do I have to change it?
485
subject.value.substring(0,(begin_index + marker.length + 1)) +
486
value + subject.value.substring(end_index,subject.length);
487
} else { // it is a delete
488
subject.value = subject.value.substring(0,begin_index) +
489
subject.value.substring((end_index + 3),subject.length);
492
} else { // It is either an insert or a do nothing
493
if (value.length > 0) { // is it an insert?
494
if (subject.value.length == 0) { // is subject currently empty?
495
subject.value = marker + '"' + value + '"';
497
subject.value = subject.value + ', ' + marker + '"' + value + '"';
506
function reset_subjectFields(form)
507
// updates all the subordinate fields from the subject field of a form
508
// **** move the strings to global variables, to make maintentance easier ****
511
update_subject_Field(form, 'CN=\"', form.name);
512
update_subject_Field(form, 'MAIL=\"', form.email);
513
update_subject_Field(form, 'O=\"', form.org);
514
update_subject_Field(form, 'C=\"', form.country);
515
update_subject_Field(form, ' L=\"', form.loc);
516
update_subject_Field(form, 'ST=\"', form.state);
517
update_subject_Field(form, 'E=\"', form.email);
518
update_subject_Field(form, 'OU=\"', form.org_unit);
519
update_subject_Field(form, 'UID=\"', form.uid);
522
function update_subject_Field(form, marker, update_field)
523
//updates a single subordinate field from the subject field of a form
524
// *** need to deal with the two types of e-mail addresses **************
527
var field_sep = '", ';
528
var begin_index = subject.value.indexOf(marker) + marker.length;
529
var end_index = subject.value.indexOf(field_sep, begin_index);
530
if (end_index == -1) {
531
end_index = subject.value.indexOf('"',begin_index);
533
if (begin_index != (-1 + marker.length) ) {
534
update_field.value = subject.value.substring(begin_index, end_index);
536
update_field.value = '';
542
function switch_mail(form)
543
// **** Do I want to delete the other type of e-mail address ? ************
545
if (form.email_type[0].checked) {
552
reset_subject(del, '', form);
553
reset_subject(ins, form.email.value, form);
556
function make_page_intro(title, bgcolor)
558
var style = '<STYLE TYPE="text/css">BODY{' +
559
'font-family: Geneva,MS Sans Serif,Arial,Lucida,Helvetica,sans-serif;' +
563
'font-family: Geneva,MS Sans Serif,Arial,Lucida,Helvetica,sans-serif;' +
564
'font-size: 10pt;}' +
567
if (bgcolor == null) { bgcolor = "#C0C0C0"; }
568
return '<HTML><HEAD>' +
569
'<TITLE>' + title + '</TITLE>' +
571
'<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#FF0000" ' +
572
'BGCOLOR="' + bgcolor + '">';
576
function make_left_frame(window)
578
with (window.frames['index']) {
579
eval ('index_string = make_left_frame_page(cur_page, '
580
+ index_list + add_index_list + ' )');
581
fool1 = make_page_intro(index_label, "#FFFFFF") +
582
index_string + '</BODY></HTML>';
583
document.write(fool1);
589
function save_cur_page(page_number)
592
var pg = page_number - 1;
593
if (window.frames['right'].document.forms.length != 0) {
594
with (window.frames['right'].document) {
595
if ((page_number != 2 && page_number != 3 && page_number <= max_pages) ||
597
ext_page_array[pg] = new Array(forms[0].elements.length);
598
for (i = 0; i < forms[0].elements.length; i++) {
599
ext_page_array[pg][i] = new Array(4);
600
switch (forms[0].elements[i].type) {
603
ext_page_array[pg][i][0] = forms[0].elements[i].checked;
606
ext_page_array[pg][i][0] = forms[0].elements[i].selectedIndex;
608
case 'select-multiple':
609
len = forms[0].elements[i].options.length;
610
ext_page_array[pg][i][0] = new Array(len);
611
for(k = 0; k < len; k++) {
612
ext_page_array[pg][i][0][k] = forms[0].elements[i].options[k].value;
616
ext_page_array[pg][i][0] = forms[0].elements[i].value;
618
ext_page_array[pg][i][1] = forms[0].elements[i].name;
619
ext_page_array[pg][i][2] = forms[0].elements[i].value;
620
ext_page_array[pg][i][3] = forms[0].elements[i].type;
627
function reload_form(page_number)
629
var j = page_number - 1;
630
with (window.frames['right'].document) {
631
if (((page_number < 2 || page_number > 3) || ver == 3)
632
&& page_number != 0 && (ext_page_array[j].length > 1)) {
633
for (i = 0; i < ext_page_array[j].length; i++) {
634
switch (forms[0].elements[i].type) {
635
case 'radio': case 'checkbox':
636
forms[0].elements[i].checked = ext_page_array[j][i][0];
639
forms[0].elements[i].selectedIndex = ext_page_array[j][i][0];
641
case 'select-multiple':
642
for (k = 0; k < ext_page_array[j][i][0].length; k++) {
643
forms[0].elements[i].options[k] =
644
new Option(ext_page_array[j][i][0][k],
645
ext_page_array[j][i][0][k]);
649
forms[0].elements[i].value = ext_page_array[j][i][0];
656
function switch_right_frame(top_window, old_pane, new_pane)
659
make_page_intro(standard_extensions_index_label, "#FFFFFF") +
660
'<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext" ' +
661
'SRC="stnd_ext_form.html">' +
662
'</IFRAME></body></html>';
665
make_page_intro(netscape_extensions_index_label, "#FFFFFF") +
666
'<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext" ' +
667
'SRC="nscp_ext_form.html">' +
668
'</IFRAME></body></html>';
671
make_page_intro(certifying_authorities_index_label, "#FFFFFF") +
672
'<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext" ' +
674
'</IFRAME></body</html>';
676
var ext_page_ca_exp =
677
make_page_intro('Certifying Authority Details', "#FFFFFF") +
678
'<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext" ' +
679
'SRC="ca_form.html">' +
680
'</IFRAME></body></html>';
683
if (old_pane > 0 && cur_page <= max_pages) {
684
save_cur_page(old_pane);
687
make_left_frame(top_window);
688
if (new_pane == 2 || new_pane == 3) {
690
frames['right'].document.write(ext_page_ver1);
691
frames['right'].document.close();
692
} else if (new_pane == 2) {
693
frames['right'].document.write(ext_page_nscp);
694
frames['right'].document.close();
695
reload_form(new_pane);
697
frames['right'].document.write(ext_page_stnd);
698
frames['right'].document.close();
699
reload_form(new_pane);
701
} else if (new_pane == 4) {
702
frames['right'].document.write(ext_page_ca);
703
frames['right'].document.close();
704
reload_form(new_pane);
705
} else if (new_pane == 1) {
706
frames['right'].document.write(main_page);
707
frames['right'].document.close();
708
reload_form(new_pane);
710
frames['right'].document.write(ext_page_ca_exp);
711
frames['right'].document.close();
712
reload_form(new_pane);
716
function make_left_frame_page(selected)
718
var n_strings = ( make_left_frame_page.arguments.length - 1 ) / 2;
719
var table_background;
725
ret_string += '<TABLE CELLSPACING=4>';
726
for ( var i = 1; i <= n_strings; i++ ) {
727
if ( i == selected ) {
728
table_background = 'BGCOLOR=#BBCCBB';
730
table_background = '';
733
indent = make_left_frame_page.arguments[(i*2) - 1];
734
label = make_left_frame_page.arguments[(i*2)];
737
ret_string += ('<TR><TD COLSPAN=2 ' + table_background + '>');
739
ret_string += ('<TR><TD> </TD><TD ' + table_background + '>');
742
command = "'parent.switch_right_frame(parent," + selected + "," + i + ")'";
743
ret_string += ('<A HREF="javascript:void setTimeout(' + command + ',0)">');
744
if ( indent == 0 ) { ret_string += "<B>"; }
746
if ( indent == 0 ) { ret_string += "</B>"; }
747
ret_string += '</A></TD></TR>';
749
if (selected == (max_pages + 1)) {
750
table_background = 'BGCOLOR=#BBCCBB';
752
table_background = '';
755
'<TR><TD COLSPAN=2 ' + table_background +
756
'><b><A HREF="javascript:void setTimeout(\'top.submit_it()\', 0)">Finish</A></b>' +
758
'<input type="submit"></form>' +
764
function make_page(window)
765
// Draws the initial page setup
768
init_ext_page_array()
770
with (window.frames['right']) {
771
location="main.html";
772
// document.write(main_page);
776
make_left_frame(window);
782
<title>Cert-O-Matic</title>
783
<FRAMESET cols="150,*" BORDER=3 ONLOAD="make_page(window)">
784
<FRAME SRC="about:blank" ID="index" NAME="index"
785
MARGINWIDTH=15 MARGINHEIGHT=10 BORDER=3>
786
<FRAME SRC="about:blank" ID="right" NAME="right"
787
MARGINWIDTH=15 MARGINHEIGHT=10 BORDER=3>