pk11jar.html (10477B)
1 <html> 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/. --> 5 <head> 6 <title>PKCS #11 JAR Format</title> 7 </head> 8 <body bgcolor=white text=black link=blue vlink=purple alink=red> 9 <center><h1>PKCS #11 JAR Format</h1></center> 10 11 <p>PKCS #11 modules can be packaged into JAR files that support automatic 12 installation onto the filesystem and into the security module database. 13 The JAR file should contain: 14 <ul> 15 <li>All files that will be installed onto the target machine. This will 16 include at least the PKCS #11 module library file (.DLL or .so), and 17 may also include any other file that should be installed (such as 18 documentation). 19 <li>A script to perform the installation. 20 </ul> 21 The script can be in one of two forms. If the JAR file is to be 22 run by Communicator (or any program that interprets Javascript), the 23 instructions will be in the form of a SmartUpdate script. 24 <a href="http://devedge/library/documentation/security/jmpkcs/">Documentation 25 </a> on creating this script can be found on DevEdge. 26 27 <p>If the 28 JAR file is to be run by a server, modutil, or any other program that 29 doesn't interpret Javascript, a special information file must be included 30 in the format described in this document. 31 32 <h2>Declaring the Script in the Manifest File</h2> 33 The script can have any name, but it must be declared in the manifest file 34 of the JAR archive. The metainfo tag for this is 35 <code>Pkcs11_install_script</code>. Meta-information is put in the manifest 36 file by putting it in a file which is passed to 37 <a href="http://developer.netscape.com/software/index_frame.html?content=signedobj/jarpack.html#signtool1.3">Signtool</a>. For example, 38 suppose the PKCS #11 installer script is in the file <code>pk11install</code>. 39 In Signtool's metainfo file, you would have a line like this: 40 <blockquote><pre> 41 + Pkcs11_install_script: pk11install 42 </pre></blockquote> 43 44 <h2>Sample Script File</h2> 45 <blockquote><pre> 46 ForwardCompatible { IRIX:6.2:mips Solaris:5.5.1:sparc } 47 Platforms { 48 WINNT::x86 { 49 ModuleName { "Fortezza Module" } 50 ModuleFile { win32/fort32.dll } 51 DefaultMechanismFlags{0x0001} 52 DefaultCipherFlags{0x0001} 53 Files { 54 win32/setup.exe { 55 Executable 56 RelativePath { %temp%/setup.exe } 57 } 58 win32/setup.hlp { 59 RelativePath { %temp%/setup.hlp } 60 } 61 win32/setup.cab { 62 RelativePath { %temp%/setup.cab } 63 } 64 } 65 } 66 Solaris:5.5.1:sparc { 67 ModuleName { "Fortezza UNIX Module" } 68 ModuleFile { unix/fort.so } 69 DefaultMechanismFlags{0x0001} 70 CipherEnableFlags{0x0001} 71 Files { 72 unix/fort.so { 73 RelativePath{%root%/lib/fort.so} 74 AbsolutePath{/usr/local/netscape/lib/fort.so} 75 FilePermissions{555} 76 } 77 xplat/instr.html { 78 RelativePath{%root%/docs/inst.html} 79 AbsolutePath{/usr/local/netscape/docs/inst.html} 80 FilePermissions{555} 81 } 82 } 83 } 84 IRIX:6.2:mips { 85 EquivalentPlatform { Solaris:5.5.1:sparc } 86 } 87 } 88 </pre></blockquote> 89 90 <hr> 91 92 <h2>Script File Grammar</h2> 93 <blockquote><pre> 94 --> <i>valuelist</i> 95 96 <i>valuelist</i> --> <i>value</i> <i>valuelist</i> 97 <i> </i> <i><null></i> 98 99 <i>value</i> --> <i>key_value_pair</i> 100 <i> </i> <i>string</i> 101 102 <i>key_value_pair</i> --> <i>key</i> { <i>valuelist</i> } 103 104 <i>key</i> --> <i>string</i> 105 106 <i>string</i> --> <i>simple_string</i> 107 <i> </i> "<i>complex_string</i>" 108 109 <i>simple_string</i> --> [^ \t\n\""{""}"]+ <font size=-1><i>(no whitespace, quotes, or braces)</i></font> 110 111 <i>complex_string</i> --> ([^\"\\\r\n]|(\\\")|(\\\\))+ <font size=-1><i>(quotes and backslashes must be escaped with a backslash, no newlines or carriage returns are allowed in the string)</i></font> 112 </pre></blockquote> 113 Outside of complex strings, all whitespace (space, tab, newline) is considered 114 equal and is used only to delimit tokens. 115 116 <hr> 117 118 <h2>Keys</h2> 119 Keys are case-insensitive. 120 <h3>Global Keys</h3> 121 <dl> 122 <dt><code>ForwardCompatible</code> 123 <dd>Gives a list of platforms that are forward compatible. If the current 124 platform cannot be found in the list of supported platforms, then the 125 ForwardCompatible list will be checked for any platforms that have the same 126 OS and architecture and an earlier version. If one is found, its 127 attributes will be used for the current platform. 128 <dt><code>Platforms</code> (<i>required</i>) 129 <dd>Gives a list of platforms. Each entry in the list is itself a key-value 130 pair: 131 the key is the name of the platform, and the valuelist contains various 132 attributes of the platform. The ModuleName, ModuleFile, and Files attributes 133 must be specified, unless an EquivalentPlatform attribute is specified. 134 The platform string is in the following 135 format: <u><i>system name</i></u>:<u><i>os release</i></u>:<u><i>architecture</i></u>. The installer 136 will obtain these values from NSPR. <u><i>os release</i></u> is an empty 137 string on non-UNIX operating systems. The following system names and platforms 138 are currently defined by NSPR:<code> 139 <ul> 140 <li>AIX (rs6000) 141 <li>BSDI (x86) 142 <li>FREEBSD (x86) 143 <li>HPUX (hppa1.1) 144 <li>IRIX (mips) 145 <li>LINUX (ppc, alpha, x86) 146 <li>MacOS (PowerPC) </code>(<i>Note: NSPR actually defines the OS as 147 "</i><code>Mac OS</code><i>". The 148 space makes the name unsuitable for being embedded in identifiers. Until 149 NSPR changes, you will have to add some special code to deal with this case. 150 </i>)<code> 151 <li>NCR (x86) 152 <li>NEC (mips) 153 <li>OS2 (x86) 154 <li>OSF (alpha) 155 <li>SOLARIS (sparc) 156 <li>SONY (mips) 157 <li>SUNOS (sparc) 158 <li>WIN95 (x86) 159 <li>WINNT (x86) 160 </ul> 161 </code> 162 Examples of valid platform strings: <code>IRIX:6.2:mips, Solaris:5.5.1:sparc, 163 Linux:2.0.32:x86, WIN95::x86</code>. 164 </dl> 165 166 <h3>Per-Platform Keys</h3> 167 These keys only have meaning within the value list of an entry in 168 the <code>Platforms</code> list. 169 <dl> 170 <dt><code>ModuleName</code> (<i>required</i>) 171 <dd>Gives the common name for the module. This name will be used to 172 reference the module from Communicator, modutil, servers, or any other 173 program that uses the Netscape security module database. 174 <dt><code>ModuleFile</code> (<i>required</i>) 175 <dd>Names the PKCS #11 module file (DLL or .so) for this platform. The name 176 is given as the relative path of the file within the JAR archive. 177 <dt><code>Files</code> (<i>required</i>) 178 <dd>Lists the files that should be installed for this module. Each entry 179 in the file list is a key-value pair: the key is the path of the file in 180 the JAR archive, and 181 the valuelist contains attributes of the file. At least RelativePath and 182 AbsoluteDir must be specified in this valuelist. 183 <dt><code>DefaultMechanismFlags</code> 184 <dd>This key-value pair specifies 185 of which mechanisms this module will be a default provider. It is a bitstring 186 specified in hexadecimal (0x) format. It is constructed as a bitwise OR 187 of the following constants. If the <code>DefaultMechanismFlags</code> 188 entry is omitted, the value will default to 0x0. 189 <blockquote><pre> 190 RSA: 0x0000 0001 191 DSA: 0x0000 0002 192 RC2: 0x0000 0004 193 RC4: 0x0000 0008 194 DES: 0x0000 0010 195 DH: 0x0000 0020 196 FORTEZZA: 0x0000 0040 197 RC5: 0x0000 0080 198 SHA1: 0x0000 0100 199 MD5: 0x0000 0200 200 MD2: 0x0000 0400 201 RANDOM: 0x0800 0000 202 FRIENDLY: 0x1000 0000 203 OWN_PW_DEFAULTS: 0x2000 0000 204 DISABLE: 0x4000 0000 205 </pre></blockquote> 206 <dt><code>CipherEnableFlags</code> 207 <dd>This key-value pair specifies 208 which SSL ciphers will be enabled. It is a bitstring specified in 209 hexadecimal (0x) format. It is constructed as a bitwise OR of the following 210 constants. If the <code>CipherEnableFlags</code> entry is omitted, the 211 value will default to 0x0. 212 <blockquote><pre> 213 FORTEZZA: 0x0000 0001 214 </pre></blockquote> 215 <dt><code>EquivalentPlatform</code> 216 <dd>Specifies that the attributes of the named platform should also be used 217 for the current platform. Saves typing when there is more than one platform 218 that uses the same settings. 219 </dl> 220 221 <h3>Per-File Keys</h3> 222 These keys only have meaning within the valuelist of an entry in a 223 <code>Files</code> list. At least one of <code>RelativePath</code> and 224 <code>AbsolutePath</code> must be specified. If both are specified, the 225 relative path will be tried first and the absolute path used only if no 226 relative root directory is provided by the installer program. 227 <dl> 228 <dt><code>RelativePath</code> 229 <dd>Specifies the destination directory of the file, relative to some directory 230 decided at install-time. Two variables can be used in the relative 231 path, "%root%" and "%temp%". "%root%" will be replaced at run-time with 232 the directory relative to which files should be installed; for 233 example, it may be the server's root directory or Communicator's root 234 directory. "%temp%" is a directory that will be created at the beginning 235 of the installation and destroyed at the end of the installation. Its purpose 236 is to hold executable files (such as setup programs), or files that are 237 used by these programs. For example, a Windows installation might consist 238 of a <code>setup.exe</code> installation program, a help file, and a .cab file 239 containing compressed information. All these files could be installed into the 240 temporary directory. Files destined for the temporary directory are guaranteed 241 to be in place before any executable file is run, and will not be deleted 242 until all executable files have finished. 243 <dt><code>AbsoluteDir</code> 244 <dd>Specifies the destination directory of the file as an absolute path. 245 This will only be used if the installer is unable to determine a 246 relative directory. 247 <dt><code>Executable</code> 248 <dd>This string specifies that the file is to be executed during the 249 course of the 250 installation. Typically this would be used for a setup program provided 251 by a module vendor, such as a self-extracting <code>setup.exe</code>. 252 More than one file can be specified as executable, in which case they will 253 be run in the order they are specified in the script file. 254 <dt><code>FilePermissions</code> 255 <dd>This string is interpreted as a string of octal digits, according to the 256 standard UNIX format. It is a bitwise OR of the following constants: 257 <blockquote><pre> 258 user read: 400 259 user write: 200 260 user execute: 100 261 group read: 040 262 group write: 020 263 group execute: 010 264 other read: 004 265 other write: 002 266 other execute: 001 267 </pre></blockquote> 268 Some platforms may not understand these permissions. They will only be 269 applied insofar as makes sense for the current platform. If this attribute 270 is omitted, a default of 777 is assumed. 271 272 </body> 273 </html>