Commit 195ddf6f5a6b9cec458fcecaffc42be2188243d5
1 parent
3d2d75cf
Manual: convert more lists to tables
Showing
1 changed file
with
117 additions
and
54 deletions
manual/encryption.rst
| @@ -114,44 +114,69 @@ Algorithm parameters ``V`` and ``R`` | @@ -114,44 +114,69 @@ Algorithm parameters ``V`` and ``R`` | ||
| 114 | encrypting the file, handling keys, etc. It may have any of the | 114 | encrypting the file, handling keys, etc. It may have any of the |
| 115 | following values: | 115 | following values: |
| 116 | 116 | ||
| 117 | - - 1: The original algorithm, which encrypted files using 40-bit keys. | ||
| 118 | - | ||
| 119 | - - 2: An extension of the original algorithm allowing longer keys. | ||
| 120 | - Introduced in PDF 1.4. | ||
| 121 | - | ||
| 122 | - - 3: An unpublished algorithm that permits file encryption key | ||
| 123 | - lengths ranging from 40 to 128 bits. Introduced in PDF 1.4. qpdf | ||
| 124 | - is believed to be able to read files with ``V`` = 3 but does not | ||
| 125 | - write such files. | ||
| 126 | - | ||
| 127 | - - 4: An extension of the algorithm that allows it to be | ||
| 128 | - parameterized by additional rules for handling strings and | ||
| 129 | - streams. Introduced in PDF 1.5. | ||
| 130 | - | ||
| 131 | - - 5: An algorithm that allows specification of separate security | ||
| 132 | - handlers for strings and streams as well as embedded files, and | ||
| 133 | - which supports 256-bit keys. Introduced in PDF 1.7 extension level | ||
| 134 | - 3 and later extended in extension level 8. This is the encryption | ||
| 135 | - system in the PDF 2.0 specification, ISO-32000. | 117 | + .. list-table:: Encryption Algorithms: ``V`` |
| 118 | + :widths: 10 80 | ||
| 119 | + :header-rows: 1 | ||
| 120 | + | ||
| 121 | + - - V | ||
| 122 | + - Meaning | ||
| 123 | + | ||
| 124 | + - - 1 | ||
| 125 | + - The original algorithm, which encrypted files using 40-bit keys. | ||
| 126 | + | ||
| 127 | + - - 2 | ||
| 128 | + - An extension of the original algorithm allowing longer keys. | ||
| 129 | + Introduced in PDF 1.4. | ||
| 130 | + | ||
| 131 | + - - 3 | ||
| 132 | + - An unpublished algorithm that permits file encryption key | ||
| 133 | + lengths ranging from 40 to 128 bits. Introduced in PDF 1.4. | ||
| 134 | + qpdf is believed to be able to read files with ``V`` = 3 but | ||
| 135 | + does not write such files. | ||
| 136 | + | ||
| 137 | + - - 4 | ||
| 138 | + - An extension of the algorithm that allows it to be | ||
| 139 | + parameterized by additional rules for handling strings and | ||
| 140 | + streams. Introduced in PDF 1.5. | ||
| 141 | + | ||
| 142 | + - - 5 | ||
| 143 | + - An algorithm that allows specification of separate security | ||
| 144 | + handlers for strings and streams as well as embedded files, | ||
| 145 | + and which supports 256-bit keys. Introduced in PDF 1.7 | ||
| 146 | + extension level 3 and later extended in extension level 8. | ||
| 147 | + This is the encryption system in the PDF 2.0 specification, | ||
| 148 | + ISO-32000. | ||
| 136 | 149 | ||
| 137 | ``R`` is a code specifying the revision of the standard handler. It | 150 | ``R`` is a code specifying the revision of the standard handler. It |
| 138 | is tightly coupled with the value of ``V``. ``R`` may have any of | 151 | is tightly coupled with the value of ``V``. ``R`` may have any of |
| 139 | the following values: | 152 | the following values: |
| 140 | 153 | ||
| 141 | - - 2: ``V`` must be 1 | 154 | + .. list-table:: Relationship between ``R`` and ``V`` |
| 155 | + :widths: 10 80 | ||
| 156 | + :header-rows: 1 | ||
| 142 | 157 | ||
| 143 | - - 3: ``V`` must be 2 or 3 | 158 | + - - R |
| 159 | + - Expected V | ||
| 144 | 160 | ||
| 145 | - - 4: ``V`` must be 4 | 161 | + - - 2 |
| 162 | + - ``V`` must be 1 | ||
| 146 | 163 | ||
| 147 | - - 5: ``V`` must be 5; this extension was never fully specified and | ||
| 148 | - existed for a short time in some versions of Acrobat. | ||
| 149 | - :command:`qpdf` is able to read and write this format, but it | ||
| 150 | - should not be used for any purpose other than testing | ||
| 151 | - compatibility with the format. | 164 | + - - 3 |
| 165 | + - ``V`` must be 2 or 3 | ||
| 152 | 166 | ||
| 153 | - - 6: ``V`` must be 5. This is the only value that is not deprecated | ||
| 154 | - in the PDF 2.0 specification, ISO-32000. | 167 | + - - 4 |
| 168 | + - ``V`` must be 4 | ||
| 169 | + | ||
| 170 | + - - 5 | ||
| 171 | + - ``V`` must be 5; this extension was never fully specified and | ||
| 172 | + existed for a short time in some versions of Acrobat. | ||
| 173 | + :command:`qpdf` is able to read and write this format, but it | ||
| 174 | + should not be used for any purpose other than testing | ||
| 175 | + compatibility with the format. | ||
| 176 | + | ||
| 177 | + - - 6 | ||
| 178 | + - ``V`` must be 5. This is the only value that is not | ||
| 179 | + deprecated in the PDF 2.0 specification, ISO-32000. | ||
| 155 | 180 | ||
| 156 | Encryption Dictionary | 181 | Encryption Dictionary |
| 157 | Encrypted PDF files have an encryption dictionary. There are several | 182 | Encrypted PDF files have an encryption dictionary. There are several |
| @@ -203,12 +228,12 @@ However, the values of bits other than those in the table are ignored, | @@ -203,12 +228,12 @@ However, the values of bits other than those in the table are ignored, | ||
| 203 | so having incorrect values probably doesn't break anything in most | 228 | so having incorrect values probably doesn't break anything in most |
| 204 | cases. A value of 1 indicates that the permission is granted. | 229 | cases. A value of 1 indicates that the permission is granted. |
| 205 | 230 | ||
| 206 | -.. list-table:: P Parameter | 231 | +.. list-table:: ``P`` Bit Values |
| 207 | :widths: 10 80 | 232 | :widths: 10 80 |
| 208 | :header-rows: 1 | 233 | :header-rows: 1 |
| 209 | 234 | ||
| 210 | - - - bit | ||
| 211 | - - meaning | 235 | + - - Bit |
| 236 | + - Meaning | ||
| 212 | 237 | ||
| 213 | - - 3 | 238 | - - 3 |
| 214 | - for ``R`` = 2 printing; for ``R`` >= 3, printing at low | 239 | - for ``R`` = 2 printing; for ``R`` >= 3, printing at low |
| @@ -254,45 +279,83 @@ to ``P`` based on the various settings of different security options. | @@ -254,45 +279,83 @@ to ``P`` based on the various settings of different security options. | ||
| 254 | 279 | ||
| 255 | - Start with all bits set except bits 1 and 2, which are cleared | 280 | - Start with all bits set except bits 1 and 2, which are cleared |
| 256 | 281 | ||
| 257 | -- For ``R`` = 2: | 282 | +- Clear bits and described in the table below: |
| 283 | + | ||
| 284 | + .. list-table:: Command-line Arguments and ``P`` Bit Values | ||
| 285 | + :widths: 20 25 45 | ||
| 286 | + :header-rows: 1 | ||
| 287 | + | ||
| 288 | + - - R | ||
| 289 | + - Argument | ||
| 290 | + - Bits Cleared | ||
| 258 | 291 | ||
| 259 | - - ``--print=n``: clear bit 3 | 292 | + - - R = 2 |
| 293 | + - ``--print=n`` | ||
| 294 | + - 3 | ||
| 260 | 295 | ||
| 261 | - - ``--modify=n``: clear bit 4 | 296 | + - - R = 2 |
| 297 | + - ``--modify=n`` | ||
| 298 | + - 4 | ||
| 262 | 299 | ||
| 263 | - - ``--extract=n``: clear bit 5 | 300 | + - - R = 2 |
| 301 | + - ``--extract=n`` | ||
| 302 | + - 5 | ||
| 264 | 303 | ||
| 265 | - - ``--annotate=n``: clear bit 6 | 304 | + - - R = 2 |
| 305 | + - ``--annotate=n`` | ||
| 306 | + - 6 | ||
| 266 | 307 | ||
| 267 | -- For ``R >= 3``: | 308 | + - - R = 3 |
| 309 | + - ``--accessibility=n`` | ||
| 310 | + - 10 | ||
| 268 | 311 | ||
| 269 | - - ``--accessibility=n``: for ``R`` = 3, clear bit 10; otherwise, | ||
| 270 | - ignore so bit 10 is always clear if ``R`` >= 4. qpdf allows | ||
| 271 | - creating files with bit 10 clear so that it can be used to create | ||
| 272 | - test files to ensure that a conforming reader ignores the value of | ||
| 273 | - the bit. You should never intentionally clear accessibility. | 312 | + - - R >= 4 |
| 313 | + - ``--accessibility=n`` | ||
| 314 | + - ignored | ||
| 274 | 315 | ||
| 275 | - - ``--extract=n``: clear bit 5 | 316 | + - - R >= 3 |
| 317 | + - ``--extract=n`` | ||
| 318 | + - 5 | ||
| 276 | 319 | ||
| 277 | - - ``--print=none``: clear bits 3 and 12 | 320 | + - - R >= 3 |
| 321 | + - ``--print=none`` | ||
| 322 | + - 3, 12 | ||
| 278 | 323 | ||
| 279 | - - ``--print=low``: clear bit 12 | 324 | + - - R >= 3 |
| 325 | + - ``--print=low`` | ||
| 326 | + - 12 | ||
| 280 | 327 | ||
| 281 | - - ``--modify=none``: clear bits 4, 6, 9, and 11 | 328 | + - - R >= 3 |
| 329 | + - ``--modify=none`` | ||
| 330 | + - 4, 6, 9, 11 | ||
| 282 | 331 | ||
| 283 | - - ``--modify=assembly``: clear bits 4, 6, and 9 | 332 | + - - R >= 3 |
| 333 | + - ``--modify=assembly`` | ||
| 334 | + - 4, 6, 9 | ||
| 284 | 335 | ||
| 285 | - - ``--modify=form``: clear bits 4 and 6 | 336 | + - - R >= 3 |
| 337 | + - ``--modify=form`` | ||
| 338 | + - 4, 6 | ||
| 286 | 339 | ||
| 287 | - - ``--modify=annotate``: clear bit 4 | 340 | + - - R >= 3 |
| 341 | + - ``--modify=annotate`` | ||
| 342 | + - 4 | ||
| 288 | 343 | ||
| 289 | - - ``--assemble=n``: clear bit 11 | 344 | + - - R >= 3 |
| 345 | + - ``--assemble=n`` | ||
| 346 | + - 11 | ||
| 290 | 347 | ||
| 291 | - - ``--annotate=n``: clear bit 6 | 348 | + - - R >= 3 |
| 349 | + - ``--annotate=n`` | ||
| 350 | + - 6 | ||
| 292 | 351 | ||
| 293 | - - ``--form=n``: clear bit 9 | 352 | + - - R >= 3 |
| 353 | + - ``--form=n`` | ||
| 354 | + - 9 | ||
| 294 | 355 | ||
| 295 | - - ``--modify-other=n``: clear bit 4 | 356 | + - - R >= 3 |
| 357 | + - ``--modify-other=n`` | ||
| 358 | + - 4 | ||
| 296 | 359 | ||
| 297 | Options to :command:`qpdf`, both at the CLI and library level, allow | 360 | Options to :command:`qpdf`, both at the CLI and library level, allow |
| 298 | more granular clearing of permission bits than do most tools, | 361 | more granular clearing of permission bits than do most tools, |