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