summaryrefslogtreecommitdiff
path: root/security/nss/lib/fortcrypt/secmodjar.html
blob: f093a5965d54bf02bcbc2166148437066b99c821 (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
<HTML>
<--
   - The contents of this file are subject to the Mozilla Public
   - License Version 1.1 (the "License"); you may not use this file
   - except in compliance with the License. You may obtain a copy of
   - the License at http://www.mozilla.org/MPL/
   - 
   - Software distributed under the License is distributed on an "AS
   - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
   - implied. See the License for the specific language governing
   - rights and limitations under the License.
   - 
   - The Original Code is the Netscape security libraries.
   - 
   - The Initial Developer of the Original Code is Netscape
   - Communications Corporation.  Portions created by Netscape are 
   - Copyright (C) 1994-2000 Netscape Communications Corporation.  All
   - Rights Reserved.
   - 
   - Contributor(s):
   - 
   - Alternatively, the contents of this file may be used under the
   - terms of the GNU General Public License Version 2 or later (the
   - "GPL"), in which case the provisions of the GPL are applicable 
   - instead of those above.  If you wish to allow use of your 
   - version of this file only under the terms of the GPL and not to
   - allow others to use your version of this file under the MPL,
   - indicate your decision by deleting the provisions above and
   - replace them with the notice and other provisions required by
   - the GPL.  If you do not delete the provisions above, a recipient
   - may use your version of this file under either the MPL or the
   - GPL.
-->
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Hoi-Sheung Wilson So">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.02 [en] (WinNT; I) [Netscape]">
   <TITLE>How to Package Your Security Module for use with SmartUpdate</TITLE>
</HEAD>
<BODY>
<FONT SIZE=+2>Using
JAR Installation Manager Technology to Install Your PKCS11 Security Module</FONT>

<P>Table of contents
<BR><A HREF="#intro">I. Introduction</A>
<BR><A HREF="#procedure">II. How to Create a Security Module JAR</A>
<BR><A HREF="#samplescript">III. Sample Installer Script</A>
<BR><A HREF="#reference">IV. Programmers' Reference</A>
<BR><A HREF="#copyright">VI. Copyright Notice</A>
<BR><A NAME="intro"></A><FONT SIZE=+1>I. Introduction</FONT>
<BR>This docuemnt describes how to prepare your security module so that
users can download it from the Internet, verify its integrity, and install
by only pointing and clicking mouses.&nbsp; The packaged module is a signed
JAR archive. This JAR archive contains a dynamically-linked library which
implements the Security Module and a pice of installer script (.js) that
registers and configures the newly installed module.&nbsp; SmartUpdate
allows users to download JAR archinve that has been signed digitally by
the software vendor.&nbsp; SmartUpdate then decompresses the JAR file,
verify the signature and validity of the files packaged into the archive.&nbsp;
If the signature is valid, SmartUpdate will run the installer script found
in the archive.&nbsp; The installer script will instruct SmartUpdate to
move the downloaded security module library to a specified location.&nbsp;
Next, the script will register the module with Navigator, and configure
it.

<P>This document does not describe how SmartUpdate works.&nbsp; For more
information about SmartUpdate, check out <A HREF="http://developer.netscape.com/library/documentation/communicator/jarman/index.htm">JAR
Installation Manager</A>.

<P><A NAME="procedure"></A><FONT SIZE=+1>II. How to Create a Security Module
JAR</FONT>
<OL>
<LI>
Obtain a copy of PKCS#11: Cryptographic Token Interface Standard Version
2.00, published by <A HREF="http://www.rsa.com">RSA Laboratories</A>, Redwood
City, California.</LI>

<LI>
Implement a PKCS#11 library according to PKCS#11 standards.</LI>

<LI>
Write a installer script that will register the module with Navigator.</LI>

<LI>
Use either JAR Packager or command line tool to package the library and
the script in a signed JAR archive.</LI>

<LI>
Publish the JAR file on the web, and notify users to install/upgrade their
library.</LI>
</OL>
<A NAME="samplescript"></A><FONT SIZE=+1>III. Sample Installer Script</FONT>

<P>Functions of the following installer script:
<BR>1. Start SmartUpdate and declares the version and the name of the module
to be installed.
<BR>2. Extract a library called DUMMY_DLL from the JAR archive and install
it under the Netscape Program folder.
<BR>3. Register the installed module by calling pkcs11.addmodule( ) method
with information about the capabilities of the module.
<BR>4. Check to see if pkcs11.addmodule( ) has been successful, and display
appropriate messages.

<P><TT>// Crypto Mechanism Flags</TT>
<BR><TT>PKCS11_MECH_RSA_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;0;</TT>
<BR><TT>PKCS11_MECH_DSA_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;1;</TT>
<BR><TT>PKCS11_MECH_RC2_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;2;</TT>
<BR><TT>PKCS11_MECH_RC4_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;3;</TT>
<BR><TT>PKCS11_MECH_DES_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;4;</TT>
<BR><TT>PKCS11_MECH_DH_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;5; //Diffie-Hellman</TT>
<BR><TT>PKCS11_MECH_SKIPJACK_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;
0x1&lt;&lt;6; //SKIPJACK algorithm as in Fortezza cards</TT>
<BR><TT>PKCS11_MECH_RC5_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;7;</TT>
<BR><TT>PKCS11_MECH_SHA1_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;8;</TT>
<BR><TT>PKCS11_MECH_MD5_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;9;</TT>
<BR><TT>PKCS11_MECH_MD2_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;10;</TT>
<BR><TT>PKCS11_MECH_RANDOM_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;27; //Random number generator</TT>
<BR><TT>PKCS11_PUB_READABLE_CERT_FLAG&nbsp; =&nbsp; 0x1&lt;&lt;28; //Stored
certs can be read off the token w/o logging in</TT>
<BR><TT>PKCS11_DISABLE_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;30; //tell Navigator to disable this slot by default</TT>

<P><TT>// Important:</TT>
<BR><TT>// 0x1&lt;&lt;11, 0x1&lt;&lt;12, ... , 0x1&lt;&lt;26, and 0x1&lt;&lt;31
are reserved</TT>
<BR><TT>// for internal use in Navigator.</TT>
<BR><TT>// Therefore, these bits should always be set to 0; otherwise,</TT>
<BR><TT>// Navigator might exhibit unpredictable behavior.</TT>

<P><TT>// These flags indicate which mechanisms should be turned on by</TT>
<BR><TT>pkcs11MechanismFlags = PKCS11_MECH_DSA_FLAG | PKCS11_MECH_SKIPJACK_FLAG
| PKCS11_MECH_RANDOM_FLAG;</TT>
<BR><TT>&nbsp;</TT>

<P><TT>// Ciphers that support SSL or S/MIME</TT>
<BR><TT>PKCS11_CIPHER_FORTEZZA_FLAG&nbsp;&nbsp;&nbsp; = 0x1&lt;&lt;0;</TT>

<P><TT>// Important:</TT>
<BR><TT>// 0x1&lt;&lt;11, 0x1&lt;&lt;12, ... , 0x1&lt;&lt;26, 0x1&lt;&lt;29,
and 0x1&lt;&lt;31 are reserved</TT>
<BR><TT>// for internal use in Navigator.</TT>
<BR><TT>// Therefore, these bits should ALWAYS be set to 0; otherwise,</TT>
<BR><TT>// Navigator might exhibit unpredictable behavior.</TT>

<P><TT>// These flags indicate which SSL ciphers are supported</TT>
<BR><TT>pkcs11CipherFlags = PKCS11_CIPHER_FORTEZZA_FLAG;</TT>
<BR><TT>&nbsp;</TT>

<P><TT>// Return values of pkcs11.addmodule() &amp; pkcs11.delmodule()</TT>
<BR><TT>// success codes</TT>
<BR><TT>JS_OK_ADD_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= 3 // Successfully added a module</TT>
<BR><TT>JS_OK_DEL_EXTERNAL_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= 2 // Successfully deleted ext. module</TT>
<BR><TT>JS_OK_DEL_INTERNAL_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= 1 // Successfully deleted int. module</TT>

<P><TT>// failure codes</TT>
<BR><TT>JS_ERR_OTHER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -1 // Other errors than the followings</TT>
<BR><TT>JS_ERR_USER_CANCEL_ACTION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -2 // User abort an action</TT>
<BR><TT>JS_ERR_INCORRECT_NUM_OF_ARGUMENTS= -3 // Calling a method w/ incorrect
# of arguments</TT>
<BR><TT>JS_ERR_DEL_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -4 // Error deleting a module</TT>
<BR><TT>JS_ERR_ADD_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -5 // Error adding a module</TT>
<BR><TT>JS_ERR_BAD_MODULE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -6 // The module name is invalid</TT>
<BR><TT>JS_ERR_BAD_DLL_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -7 // The DLL name is bad</TT>
<BR><TT>JS_ERR_BAD_MECHANISM_FLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -8 // The mechanism flags are invalid</TT>
<BR><TT>JS_ERR_BAD_CIPHER_ENABLE_FLAGS&nbsp;&nbsp; = -9 // The SSL, S/MIME
cipher flags are invalid</TT>
<BR>&nbsp;

<P><TT>if (confirm("This script will install and configure a security module,
do you want to continue?")) {</TT>
<BR><TT>&nbsp;// Step 1. Create a version object and a software update
object</TT>
<BR><TT>&nbsp;vi = new netscape.softupdate.VersionInfo(1, 6, 0, 0);</TT>
<BR><TT>&nbsp;su = new netscape.softupdate.SoftwareUpdate(this, "Fortezza
Card PKCS#11 Module");</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// "Fortezza ... Module" is the logical name of the bundle</TT>

<P><TT>&nbsp;// Step 2. Start the install process</TT>
<BR><TT>&nbsp;bAbort = false;</TT>
<BR><TT>&nbsp;err = su.StartInstall("litronic", vi, netscape.softupdate.SoftwareUpdate.FULL_INSTALL);</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// litronic is the component folder (logical)</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bAbort = bAbort || (err
!=0);</TT>

<P><TT>&nbsp;if (err == 0) {</TT>

<P><TT>&nbsp;&nbsp;&nbsp; // Step 3. Find out the physical location of
the Program dir</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; Folder = su.GetFolder("Program");</TT>

<P><TT>&nbsp;&nbsp;&nbsp; // Step 4. Install the files. Unpack them and
list where they go</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; err = su.AddSubcomponent("FortezzaCardDLL",
//component name (logical)</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
vi, // version info</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"DUMMY_DLL", // source file in JAR (physical)</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Folder, // target folder (physical)</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
"DUMMY_DLL", // target path &amp; filename (physical)</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
this.force); // forces update</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; bAbort = bAbort || (err !=0);</TT>
<BR><TT>&nbsp;}</TT>

<P><TT>&nbsp;// Step 5. Unless there was a problem, move files to final
location</TT>
<BR><TT>&nbsp;// and update the Client Version Registry</TT>
<BR><TT>&nbsp;if (bAbort) {</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; window.alert("Installation Aborted");</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; su.AbortInstall();</TT>
<BR><TT>&nbsp;} else {</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; err = su.FinalizeInstall();</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; window.alert("Files have been installed.\nContinue
to setup the newly isntalled module...");</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; // Add Module</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; compFolder = su.GetComponentFolder("litronic/FortezzaCardDLL")
+ "/DUMMY_DLL";</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; result = pkcs11.addmodule("Fortezza", compFolder,
pkcs11MechanismFlags, pkcs11CipherFlags);</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
( result &lt; 0) {</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
window.alert("New module setup failed.&nbsp; Error code: " + result);</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
else {</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
window.alert("New module setup completed.");</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</TT>
<BR><TT>&nbsp;}</TT>
<BR><TT>}</TT>

<P><A NAME="reference"></A><FONT SIZE=+1>IV. Appendix A: Programmers' Refernce</FONT>
<UL>
<LI>
<A HREF="#delmodule">pkcs11.addmodule( )</A></LI>

<LI>
<A HREF="#delmodule">pkcs11.delmodule( )</A></LI>
</UL>

<HR ALIGN=LEFT WIDTH="70%">
<BR><A NAME="addmodule"></A>Name
<BR><TT>addmodule</TT>
<BR>Adds a PKCS#11 security module to the security module database, and
notifies Communicator which cryptographic mechanisms should be turned on
by default, and which SSL or S/MIME ciphers are supported.&nbsp; For security
reasons, it will pop up a dialog box to ask the user to confirm this action.&nbsp;
It might pop up other dialog boxes if necessary.

<P>Method of
<BR><TT>pkcs11</TT>

<P>Syntax
<BR><TT>int pkcs11.addmodule( string ModuleName,</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
string LibraryFullPath,</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
int CryptoMechanismFlags,</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
int CipherFlags);</TT>
<BR>&nbsp;
<BR>Parameters
<TABLE BORDER WIDTH="90%" >
<TR>
<TD><TT>ModuleName</TT></TD>

<TD>Name of the module</TD>
</TR>

<TR>
<TD><TT>LibraryFullPath</TT></TD>

<TD>The filename of the library prepended with its full path</TD>
</TR>

<TR>
<TD><TT>CryptoMechanismFlags</TT></TD>

<TD>A bit vector indicating all cryptographic mechanisms should be turned
on by default&nbsp; (See below)</TD>
</TR>

<TR>
<TD><TT>CipherFlags</TT></TD>

<TD>A bit vector indicating all SSL or S/MIME cipher functions supported
by the module (Seel below)</TD>
</TR>
</TABLE>
Cryptographic Mechanism Flags
<BR><TT>PKCS11_MECH_RSA_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;0;</TT>
<BR><TT>PKCS11_MECH_DSA_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;1;</TT>
<BR><TT>PKCS11_MECH_RC2_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;2;</TT>
<BR><TT>PKCS11_MECH_RC4_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;3;</TT>
<BR><TT>PKCS11_MECH_DES_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;4;</TT>
<BR><TT>PKCS11_MECH_DH_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;5; //Diffie-Hellman</TT>
<BR><TT>PKCS11_MECH_SKIPJACK_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;
0x1&lt;&lt;6; //SKIPJACK algorithm as in Fortezza cards</TT>
<BR><TT>PKCS11_MECH_RC5_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;7;</TT>
<BR><TT>PKCS11_MECH_SHA1_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;8;</TT>
<BR><TT>PKCS11_MECH_MD5_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;9;</TT>
<BR><TT>PKCS11_MECH_MD2_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;10;</TT>
<BR><TT>PKCS11_MECH_RANDOM_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;27; //Random number generator</TT>
<BR><TT>PKCS11_PUB_READABLE_CERT_FLAG&nbsp; =&nbsp; 0x1&lt;&lt;28; //Stored
certs can be read off the token w/o logging in</TT>
<BR><TT>PKCS11_DISABLE_FLAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=&nbsp; 0x1&lt;&lt;30; //tell Navigator to disable this slot by default</TT>

<P>Supported SSL or S/MIME Ciphers
<BR><TT>PKCS11_CIPHER_FORTEZZA_FLAG&nbsp;&nbsp;&nbsp; = 0x1&lt;&lt;0;</TT>

<P>Important for CryptoMechanismFlags:
<BR><TT>0x1&lt;&lt;11</TT>, <TT>0x1&lt;&lt;12</TT>, ... , <TT>0x1&lt;&lt;26</TT>,
<TT>0x1&lt;&lt;29, </TT>and <TT>0x1&lt;&lt;31</TT> are reserved for internal
use in Navigator.
<BR>Therefore, these bits should always be set to 0; otherwise, Navigator
might exhibit unpredictable behavior.

<P>Important for CipherFlags:
<BR><TT>0x1&lt;&lt;1</TT>, <TT>0x1&lt;&lt;2</TT>, ... , <TT>0x1&lt;&lt;31</TT>
are reserved for internal use in Navigator.
<BR>Therefore, these bits should ALWAYS be set to 0; otherwise, Navigator
might exhibit unpredictable behavior.

<P>Example of CryptoMechanismFlags and CipherFlags:
<BR><TT>pkcs11MechanismFlags = PKCS11_MECH_DSA_FLAG | PKCS11_MECH_SKIPJACK_FLAG
| PKCS11_MECH_RANDOM_FLAG;</TT>
<BR><TT>pkcs11CipherFlags = PKCS11_CIPHER_FORTEZZA_FLAG;</TT>
<BR><TT>&nbsp;</TT>
<BR>Return Values:
<BR><TT>// Return values of pkcs11.addmod()</TT>
<BR><TT>// success codes</TT>
<BR><TT>JS_OK_ADD_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= 3 // Successfully added a module</TT>

<P><TT>// failure codes</TT>
<BR><TT>JS_ERR_OTHER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -1 // Other errors than the followings</TT>
<BR><TT>JS_ERR_USER_CANCEL_ACTION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -2 // User abort an action</TT>
<BR><TT>JS_ERR_INCORRECT_NUM_OF_ARGUMENTS= -3 // Calling a method w/ incorrect
# of arguments</TT>
<BR><TT>JS_ERR_ADD_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -5 // Error adding a module</TT>
<BR><TT>JS_ERR_BAD_MODULE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -6 // The module name is invalid</TT>
<BR><TT>JS_ERR_BAD_DLL_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -7 // The DLL name is bad</TT>
<BR><TT>JS_ERR_BAD_MECHANISM_FLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -8 // The mechanism flags are invalid</TT>
<BR><TT>JS_ERR_BAD_CIPHER_ENABLE_FLAGS&nbsp;&nbsp; = -9 // The SSL, S/MIME
cipher flags are invalid</TT>
<BR>&nbsp;
<HR ALIGN=LEFT WIDTH="70%">
<BR><A NAME="delmodule"></A>Name
<BR><TT>delmodule</TT>
<BR>Deletes a PKCS#11 security module from the module database, but does
not physically remove the file.&nbsp; For security reasons, it will pop
up a dialog box to ask the user to confirm this action.&nbsp; It might
pop up other dialog boxes if necessary.

<P>Method of
<BR><TT>pkcs11</TT>

<P>Syntax
<BR><TT>int pkcs11.delmodule( string ModuleName);</TT>
<BR>&nbsp;
<BR>Parameters
<TABLE BORDER WIDTH="90%" >
<TR>
<TD><TT>ModuleName</TT></TD>

<TD>Name of the module</TD>
</TR>
</TABLE>
<TT>&nbsp;</TT>
<BR>Return Values:
<BR><TT>// Return values of pkcs11.addmod() &amp; pkcs11.delmod()</TT>
<BR><TT>// success codes</TT>
<BR><TT>JS_OK_DEL_EXTERNAL_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= 2 // Successfully deleted ext. module</TT>
<BR><TT>JS_OK_DEL_INTERNAL_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= 1 // Successfully deleted int. module</TT>

<P><TT>// failure codes</TT>
<BR><TT>JS_ERR_OTHER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -1 // Other errors than the followings</TT>
<BR><TT>JS_ERR_USER_CANCEL_ACTION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -2 // User abort an action</TT>
<BR><TT>JS_ERR_INCORRECT_NUM_OF_ARGUMENTS= -3 // Calling a method w/ incorrect
# of arguments</TT>
<BR><TT>JS_ERR_DEL_MODULE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -4 // Error deleting a module</TT>
<BR><TT>JS_ERR_BAD_MODULE_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
= -6 // The module name is invalid</TT>

<P><A NAME="copyright"></A><FONT SIZE=+1>VI. Copyright Notice</FONT>
<BR>&nbsp;

<P><FONT SIZE=+4>XXX Don't know what to put here!!!</FONT>

<P>Last modified 9/26/97
</BODY>
</HTML>