2
<TITLE>Generic PKCS #11 Installer</TITLE>
4
- The contents of this file are subject to the Mozilla Public
5
- License Version 1.1 (the "License"); you may not use this file
6
- except in compliance with the License. You may obtain a copy of
7
- the License at http://www.mozilla.org/MPL/
9
- Software distributed under the License is distributed on an "AS
10
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
- implied. See the License for the specific language governing
12
- rights and limitations under the License.
14
- The Original Code is the Netscape security libraries.
16
- The Initial Developer of the Original Code is Netscape
17
- Communications Corporation. Portions created by Netscape are
18
- Copyright (C) 1994-2000 Netscape Communications Corporation. All
23
- Alternatively, the contents of this file may be used under the
24
- terms of the GNU General Public License Version 2 or later (the
25
- "GPL"), in which case the provisions of the GPL are applicable
26
- instead of those above. If you wish to allow use of your
27
- version of this file only under the terms of the GPL and not to
28
- allow others to use your version of this file under the MPL,
29
- indicate your decision by deleting the provisions above and
30
- replace them with the notice and other provisions required by
31
- the GPL. If you do not delete the provisions above, a recipient
32
- may use your version of this file under either the MPL or the
37
// Crypto Mechanism Flags
38
PKCS11_MECH_RSA_FLAG = 0x1<<0;
39
PKCS11_MECH_DSA_FLAG = 0x1<<1;
40
PKCS11_MECH_RC2_FLAG = 0x1<<2;
41
PKCS11_MECH_RC4_FLAG = 0x1<<3;
42
PKCS11_MECH_DES_FLAG = 0x1<<4;
43
PKCS11_MECH_DH_FLAG = 0x1<<5; //Diffie-Hellman
44
PKCS11_MECH_SKIPJACK_FLAG = 0x1<<6; //SKIPJACK algorithm as in Fortezza cards
45
PKCS11_MECH_RC5_FLAG = 0x1<<7;
46
PKCS11_MECH_SHA1_FLAG = 0x1<<8;
47
PKCS11_MECH_MD5_FLAG = 0x1<<9;
48
PKCS11_MECH_MD2_FLAG = 0x1<<10;
49
PKCS11_MECH_RANDOM_FLAG = 0x1<<27; //Random number generator
50
PKCS11_PUB_READABLE_CERT_FLAG = 0x1<<28; //Stored certs can be read off the token w/o logging in
51
PKCS11_DISABLE_FLAG = 0x1<<30; //tell Navigator to disable this slot by default
54
// 0x1<<11, 0x1<<12, ... , 0x1<<26, 0x1<<29, and 0x1<<31 are reserved
55
// for internal use in Navigator.
56
// Therefore, these bits should always be set to 0; otherwise,
57
// Navigator might exhibit unpredictable behavior.
59
// These flags indicate which mechanisms should be turned on by
60
pkcs11MechanismFlags = 0;
63
// Ciphers that support SSL or S/MIME
64
PKCS11_CIPHER_FORTEZZA_FLAG = 0x1<<0;
67
// 0x1<<1, 0x1<<2, ... , 0x1<<31 are reserved
68
// for internal use in Navigator.
69
// Therefore, these bits should ALWAYS be set to 0; otherwise,
70
// Navigator might exhibit unpredictable behavior.
72
// These flags indicate which SSL ciphers are supported
73
pkcs11CipherFlags = PKCS11_CIPHER_FORTEZZA_FLAG;
76
// Return values of pkcs11.addmodule() & pkcs11.delmodule()
78
JS_OK_ADD_MODULE = 3 // Successfully added a module
79
JS_OK_DEL_EXTERNAL_MODULE = 2 // Successfully deleted ext. module
80
JS_OK_DEL_INTERNAL_MODULE = 1 // Successfully deleted int. module
83
JS_ERR_OTHER = -1 // Other errors than the followings
84
JS_ERR_USER_CANCEL_ACTION = -2 // User abort an action
85
JS_ERR_INCORRECT_NUM_OF_ARGUMENTS= -3 // Calling a method w/ incorrect # of arguments
86
JS_ERR_DEL_MODULE = -4 // Error deleting a module
87
JS_ERR_ADD_MODULE = -5 // Error adding a module
88
JS_ERR_BAD_MODULE_NAME = -6 // The module name is invalid
89
JS_ERR_BAD_DLL_NAME = -7 // The DLL name is bad
90
JS_ERR_BAD_MECHANISM_FLAGS = -8 // The mechanism flags are invalid
91
JS_ERR_BAD_CIPHER_ENABLE_FLAGS = -9 // The SSL, S/MIME cipher flags are invalid
94
var has_new_window = 0;
96
function HandleCipher(checkBox) {
97
if (checkBox.checked) {
98
pkcs11MechanismFlags |= checkBox.value;
100
pkcs11MechanismFlags &= ~checkBox.value;
104
function HandleSSL(checkBox) {
105
if (checkBox.checked) {
106
pkcs11CipherFlags |= checkBox.value;
108
pkcs11CipherFlags &= ~checkBox.value;
112
function colonize(string) {
116
if (len == 0) return string;
119
for (i=0; i < len; i++) {
120
if (string.charAt(i) == "/") {
122
new_string = ":" + string.substring(1,len);
123
} else if (i == end) {
124
new_string = string.substring(0,i)+':';
126
new_string = string.substring(0,i)+':'+
127
string.substring(i+1,len);
133
if (string.charAt(0) == ":") string = string.substring(1,len);
137
function DoInstall(name,module) {
138
if ((navigator.platform == "MacPPC")
139
|| (navigator.platform == "Mac68K")) {
140
module = colonize(module);
142
result = pkcs11.addmodule(name, module,
143
pkcs11MechanismFlags, pkcs11CipherFlags);
145
window.alert("New module setup failed. Error code: " + result);
147
if (has_new_window) new_window.close();
150
default_name = "Netscape FORTEZZA Module"
152
default_module = "D:/dogbert/ns/dist/WIN32_D.OBJ/bin/fort32.dll"
153
document.writeln("<FORM name=instform target=_self> <H2>FORTEZZA PKCS #11 Installer version 1.5</H2>");
154
document.writeln(" Module name: <Input Type=Text Name=modName value=\""+default_name+"\" size=50 required><br>");
155
document.writeln(" Module Library: <Input Type=FILE required Name=module><br>");
156
document.writeln("<i>Note: If you use the browse button, be sure to change the filter to show all the files (*), not just the HTML files (*.html).</i><p>");
157
document.writeln("<hr>");
158
document.write("<Input type=submit Name=Install Value=Install onclick=DoInstall(");
159
document.writeln( "document.instform.modName.value,document.instform.module.value) >");
160
document.writeln("</FORM>");