~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/pgcrypto.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!-- doc/src/sgml/pgcrypto.sgml -->
 
2
 
 
3
<sect1 id="pgcrypto">
 
4
 <title>pgcrypto</title>
 
5
 
 
6
 <indexterm zone="pgcrypto">
 
7
  <primary>pgcrypto</primary>
 
8
 </indexterm>
 
9
 
 
10
 <indexterm zone="pgcrypto">
 
11
  <primary>encryption</primary>
 
12
  <secondary>for specific columns</secondary>
 
13
 </indexterm>
 
14
 
 
15
 <para>
 
16
  The <filename>pgcrypto</> module provides cryptographic functions for
 
17
  <productname>PostgreSQL</>.
 
18
 </para>
 
19
 
 
20
 <sect2>
 
21
  <title>General Hashing Functions</title>
 
22
 
 
23
  <sect3>
 
24
   <title><function>digest()</function></title>
 
25
 
 
26
<synopsis>
 
27
digest(data text, type text) returns bytea
 
28
digest(data bytea, type text) returns bytea
 
29
</synopsis>
 
30
 
 
31
   <para>
 
32
    Computes a binary hash of the given <parameter>data</>.
 
33
    <parameter>type</> is the algorithm to use.
 
34
    Standard algorithms are <literal>md5</literal>, <literal>sha1</literal>,
 
35
    <literal>sha224</literal>, <literal>sha256</literal>,
 
36
    <literal>sha384</literal> and <literal>sha512</literal>.
 
37
    If <filename>pgcrypto</> was built with
 
38
    OpenSSL, more algorithms are available, as detailed in
 
39
    <xref linkend="pgcrypto-with-without-openssl">.
 
40
   </para>
 
41
 
 
42
   <para>
 
43
    If you want the digest as a hexadecimal string, use
 
44
    <function>encode()</> on the result.  For example:
 
45
<programlisting>
 
46
CREATE OR REPLACE FUNCTION sha1(bytea) returns text AS $$
 
47
    SELECT encode(digest($1, 'sha1'), 'hex')
 
48
$$ LANGUAGE SQL STRICT IMMUTABLE;
 
49
</programlisting>
 
50
   </para>
 
51
  </sect3>
 
52
 
 
53
  <sect3>
 
54
   <title><function>hmac()</function></title>
 
55
 
 
56
<synopsis>
 
57
hmac(data text, key text, type text) returns bytea
 
58
hmac(data bytea, key text, type text) returns bytea
 
59
</synopsis>
 
60
 
 
61
   <para>
 
62
    Calculates hashed MAC for <parameter>data</> with key <parameter>key</>.
 
63
    <parameter>type</> is the same as in <function>digest()</>.
 
64
   </para>
 
65
 
 
66
   <para>
 
67
    This is similar to <function>digest()</> but the hash can only be
 
68
    recalculated knowing the key.  This prevents the scenario of someone
 
69
    altering data and also changing the hash to match.
 
70
   </para>
 
71
 
 
72
   <para>
 
73
    If the key is larger than the hash block size it will first be hashed and
 
74
    the result will be used as key.
 
75
   </para>
 
76
  </sect3>
 
77
 </sect2>
 
78
 
 
79
 <sect2>
 
80
  <title>Password Hashing Functions</title>
 
81
 
 
82
  <para>
 
83
   The functions <function>crypt()</> and <function>gen_salt()</>
 
84
   are specifically designed for hashing passwords.
 
85
   <function>crypt()</> does the hashing and <function>gen_salt()</>
 
86
   prepares algorithm parameters for it.
 
87
  </para>
 
88
 
 
89
  <para>
 
90
   The algorithms in <function>crypt()</> differ from usual hashing algorithms
 
91
   like MD5 or SHA1 in the following respects:
 
92
  </para>
 
93
 
 
94
  <orderedlist>
 
95
   <listitem>
 
96
    <para>
 
97
     They are slow.  As the amount of data is so small, this is the only
 
98
     way to make brute-forcing passwords hard.
 
99
    </para>
 
100
   </listitem>
 
101
   <listitem>
 
102
    <para>
 
103
     They use a random value, called the <firstterm>salt</>, so that users
 
104
     having the same password will have different encrypted passwords.
 
105
     This is also an additional defense against reversing the algorithm.
 
106
    </para>
 
107
   </listitem>
 
108
   <listitem>
 
109
    <para>
 
110
     They include the algorithm type in the result, so passwords hashed with
 
111
     different algorithms can co-exist.
 
112
    </para>
 
113
   </listitem>
 
114
   <listitem>
 
115
    <para>
 
116
     Some of them are adaptive &mdash; that means when computers get
 
117
     faster, you can tune the algorithm to be slower, without
 
118
     introducing incompatibility with existing passwords.
 
119
    </para>
 
120
   </listitem>
 
121
  </orderedlist>
 
122
 
 
123
  <para>
 
124
   <xref linkend="pgcrypto-crypt-algorithms"> lists the algorithms
 
125
   supported by the <function>crypt()</function> function.
 
126
  </para>
 
127
 
 
128
  <table id="pgcrypto-crypt-algorithms">
 
129
   <title>Supported Algorithms for <function>crypt()</></title>
 
130
   <tgroup cols="5">
 
131
    <thead>
 
132
     <row>
 
133
      <entry>Algorithm</entry>
 
134
      <entry>Max Password Length</entry>
 
135
      <entry>Adaptive?</entry>
 
136
      <entry>Salt Bits</entry>
 
137
      <entry>Description</entry>
 
138
     </row>
 
139
    </thead>
 
140
    <tbody>
 
141
     <row>
 
142
      <entry><literal>bf</></entry>
 
143
      <entry>72</entry>
 
144
      <entry>yes</entry>
 
145
      <entry>128</entry>
 
146
      <entry>Blowfish-based, variant 2a</entry>
 
147
     </row>
 
148
     <row>
 
149
      <entry><literal>md5</></entry>
 
150
      <entry>unlimited</entry>
 
151
      <entry>no</entry>
 
152
      <entry>48</entry>
 
153
      <entry>MD5-based crypt</entry>
 
154
     </row>
 
155
     <row>
 
156
      <entry><literal>xdes</></entry>
 
157
      <entry>8</entry>
 
158
      <entry>yes</entry>
 
159
      <entry>24</entry>
 
160
      <entry>Extended DES</entry>
 
161
     </row>
 
162
     <row>
 
163
      <entry><literal>des</></entry>
 
164
      <entry>8</entry>
 
165
      <entry>no</entry>
 
166
      <entry>12</entry>
 
167
      <entry>Original UNIX crypt</entry>
 
168
     </row>
 
169
    </tbody>
 
170
   </tgroup>
 
171
  </table>
 
172
 
 
173
  <sect3>
 
174
   <title><function>crypt()</></title>
 
175
 
 
176
<synopsis>
 
177
crypt(password text, salt text) returns text
 
178
</synopsis>
 
179
 
 
180
   <para>
 
181
    Calculates a crypt(3)-style hash of <parameter>password</>.
 
182
    When storing a new password, you need to use
 
183
    <function>gen_salt()</> to generate a new <parameter>salt</> value.
 
184
    To check a password, pass the stored hash value as <parameter>salt</>,
 
185
    and test whether the result matches the stored value.
 
186
   </para>
 
187
   <para>
 
188
    Example of setting a new password:
 
189
<programlisting>
 
190
UPDATE ... SET pswhash = crypt('new password', gen_salt('md5'));
 
191
</programlisting>
 
192
   </para>
 
193
   <para>
 
194
    Example of authentication:
 
195
<programlisting>
 
196
SELECT pswhash = crypt('entered password', pswhash) FROM ... ;
 
197
</programlisting>
 
198
    This returns <literal>true</> if the entered password is correct.
 
199
   </para>
 
200
  </sect3>
 
201
 
 
202
  <sect3>
 
203
   <title><function>gen_salt()</></title>
 
204
 
 
205
<synopsis>
 
206
gen_salt(type text [, iter_count integer ]) returns text
 
207
</synopsis>
 
208
 
 
209
   <para>
 
210
    Generates a new random salt string for use in <function>crypt()</>.
 
211
    The salt string also tells <function>crypt()</> which algorithm to use.
 
212
   </para>
 
213
 
 
214
   <para>
 
215
    The <parameter>type</> parameter specifies the hashing algorithm.
 
216
    The accepted types are: <literal>des</literal>, <literal>xdes</literal>,
 
217
    <literal>md5</literal> and <literal>bf</literal>.
 
218
   </para>
 
219
 
 
220
   <para>
 
221
    The <parameter>iter_count</> parameter lets the user specify the iteration
 
222
    count, for algorithms that have one.
 
223
    The higher the count, the more time it takes to hash
 
224
    the password and therefore the more time to break it.  Although with
 
225
    too high a count the time to calculate a hash may be several years
 
226
    &mdash; which is somewhat impractical.  If the <parameter>iter_count</>
 
227
    parameter is omitted, the default iteration count is used.
 
228
    Allowed values for <parameter>iter_count</> depend on the algorithm and
 
229
    are shown in <xref linkend="pgcrypto-icfc-table">.
 
230
   </para>
 
231
 
 
232
   <table id="pgcrypto-icfc-table">
 
233
    <title>Iteration Counts for <function>crypt()</></title>
 
234
    <tgroup cols="4">
 
235
     <thead>
 
236
      <row>
 
237
       <entry>Algorithm</entry>
 
238
       <entry>Default</entry>
 
239
       <entry>Min</entry>
 
240
       <entry>Max</entry>
 
241
      </row>
 
242
     </thead>
 
243
     <tbody>
 
244
      <row>
 
245
       <entry><literal>xdes</></entry>
 
246
       <entry>725</entry>
 
247
       <entry>1</entry>
 
248
       <entry>16777215</entry>
 
249
      </row>
 
250
      <row>
 
251
       <entry><literal>bf</></entry>
 
252
       <entry>6</entry>
 
253
       <entry>4</entry>
 
254
       <entry>31</entry>
 
255
      </row>
 
256
     </tbody>
 
257
    </tgroup>
 
258
   </table>
 
259
 
 
260
   <para>
 
261
    For <literal>xdes</literal> there is an additional limitation that the
 
262
    iteration count must be an odd number.
 
263
   </para>
 
264
 
 
265
   <para>
 
266
    To pick an appropriate iteration count, consider that
 
267
    the original DES crypt was designed to have the speed of 4 hashes per
 
268
    second on the hardware of that time.
 
269
    Slower than 4 hashes per second would probably dampen usability.
 
270
    Faster than 100 hashes per second is probably too fast.
 
271
   </para>
 
272
 
 
273
   <para>
 
274
    <xref linkend="pgcrypto-hash-speed-table"> gives an overview of the relative slowness
 
275
    of different hashing algorithms.
 
276
    The table shows how much time it would take to try all
 
277
    combinations of characters in an 8-character password, assuming
 
278
    that the password contains either only lower case letters, or
 
279
    upper- and lower-case letters and numbers.
 
280
    In the <literal>crypt-bf</literal> entries, the number after a slash is
 
281
    the <parameter>iter_count</parameter> parameter of
 
282
    <function>gen_salt</function>.
 
283
   </para>
 
284
 
 
285
   <table id="pgcrypto-hash-speed-table">
 
286
    <title>Hash Algorithm Speeds</title>
 
287
    <tgroup cols="4">
 
288
     <thead>
 
289
      <row>
 
290
       <entry>Algorithm</entry>
 
291
       <entry>Hashes/sec</entry>
 
292
       <entry>For <literal>[a-z]</></entry>
 
293
       <entry>For <literal>[A-Za-z0-9]</></entry>
 
294
      </row>
 
295
     </thead>
 
296
     <tbody>
 
297
      <row>
 
298
       <entry><literal>crypt-bf/8</></entry>
 
299
       <entry>28</entry>
 
300
       <entry>246 years</entry>
 
301
       <entry>251322 years</entry>
 
302
      </row>
 
303
      <row>
 
304
       <entry><literal>crypt-bf/7</></entry>
 
305
       <entry>57</entry>
 
306
       <entry>121 years</entry>
 
307
       <entry>123457 years</entry>
 
308
      </row>
 
309
      <row>
 
310
       <entry><literal>crypt-bf/6</></entry>
 
311
       <entry>112</entry>
 
312
       <entry>62 years</entry>
 
313
       <entry>62831 years</entry>
 
314
      </row>
 
315
      <row>
 
316
       <entry><literal>crypt-bf/5</></entry>
 
317
       <entry>211</entry>
 
318
       <entry>33 years</entry>
 
319
       <entry>33351 years</entry>
 
320
      </row>
 
321
      <row>
 
322
       <entry><literal>crypt-md5</></entry>
 
323
       <entry>2681</entry>
 
324
       <entry>2.6 years</entry>
 
325
       <entry>2625 years</entry>
 
326
      </row>
 
327
      <row>
 
328
       <entry><literal>crypt-des</></entry>
 
329
       <entry>362837</entry>
 
330
       <entry>7 days</entry>
 
331
       <entry>19 years</entry>
 
332
      </row>
 
333
      <row>
 
334
       <entry><literal>sha1</></entry>
 
335
       <entry>590223</entry>
 
336
       <entry>4 days</entry>
 
337
       <entry>12 years</entry>
 
338
      </row>
 
339
      <row>
 
340
       <entry><literal>md5</></entry>
 
341
       <entry>2345086</entry>
 
342
       <entry>1 day</entry>
 
343
       <entry>3 years</entry>
 
344
      </row>
 
345
     </tbody>
 
346
    </tgroup>
 
347
   </table>
 
348
 
 
349
   <para>
 
350
    Notes:
 
351
   </para>
 
352
 
 
353
   <itemizedlist>
 
354
    <listitem>
 
355
     <para>
 
356
     The machine used is a 1.5GHz Pentium 4.
 
357
     </para>
 
358
    </listitem>
 
359
    <listitem>
 
360
     <para>
 
361
      <literal>crypt-des</> and <literal>crypt-md5</> algorithm numbers are
 
362
      taken from John the Ripper v1.6.38 <literal>-test</> output.
 
363
     </para>
 
364
    </listitem>
 
365
    <listitem>
 
366
     <para>
 
367
      <literal>md5</> numbers are from mdcrack 1.2.
 
368
     </para>
 
369
    </listitem>
 
370
    <listitem>
 
371
     <para>
 
372
      <literal>sha1</> numbers are from lcrack-20031130-beta.
 
373
     </para>
 
374
    </listitem>
 
375
    <listitem>
 
376
     <para>
 
377
      <literal>crypt-bf</literal> numbers are taken using a simple program that
 
378
      loops over 1000 8-character passwords.  That way I can show the speed
 
379
      with different numbers of iterations.  For reference: <literal>john
 
380
      -test</literal> shows 213 loops/sec for <literal>crypt-bf/5</>.
 
381
      (The very small
 
382
      difference in results is in accordance with the fact that the
 
383
      <literal>crypt-bf</literal> implementation in <filename>pgcrypto</>
 
384
      is the same one used in John the Ripper.)
 
385
     </para>
 
386
    </listitem>
 
387
   </itemizedlist>
 
388
 
 
389
   <para>
 
390
    Note that <quote>try all combinations</quote> is not a realistic exercise.
 
391
    Usually password cracking is done with the help of dictionaries, which
 
392
    contain both regular words and various mutations of them.  So, even
 
393
    somewhat word-like passwords could be cracked much faster than the above
 
394
    numbers suggest, while a 6-character non-word-like password may escape
 
395
    cracking.  Or not.
 
396
   </para>
 
397
  </sect3>
 
398
 </sect2>
 
399
 
 
400
 <sect2>
 
401
  <title>PGP Encryption Functions</title>
 
402
 
 
403
  <para>
 
404
   The functions here implement the encryption part of the OpenPGP (RFC 4880)
 
405
   standard.  Supported are both symmetric-key and public-key encryption.
 
406
  </para>
 
407
 
 
408
  <para>
 
409
   An encrypted PGP message consists of 2 parts, or <firstterm>packets</>:
 
410
  </para>
 
411
  <itemizedlist>
 
412
   <listitem>
 
413
    <para>
 
414
     Packet containing a session key &mdash; either symmetric-key or public-key
 
415
     encrypted.
 
416
    </para>
 
417
   </listitem>
 
418
   <listitem>
 
419
    <para>
 
420
     Packet containing data encrypted with the session key.
 
421
    </para>
 
422
   </listitem>
 
423
  </itemizedlist>
 
424
 
 
425
  <para>
 
426
   When encrypting with a symmetric key (i.e., a password):
 
427
  </para>
 
428
  <orderedlist>
 
429
   <listitem>
 
430
    <para>
 
431
     The given password is hashed using a String2Key (S2K) algorithm.  This is
 
432
     rather similar to <function>crypt()</> algorithms &mdash; purposefully
 
433
     slow and with random salt &mdash; but it produces a full-length binary
 
434
     key.
 
435
    </para>
 
436
   </listitem>
 
437
   <listitem>
 
438
    <para>
 
439
     If a separate session key is requested, a new random key will be
 
440
     generated.  Otherwise the S2K key will be used directly as the session
 
441
     key.
 
442
    </para>
 
443
   </listitem>
 
444
   <listitem>
 
445
    <para>
 
446
     If the S2K key is to be used directly, then only S2K settings will be put
 
447
     into the session key packet.  Otherwise the session key will be encrypted
 
448
     with the S2K key and put into the session key packet.
 
449
    </para>
 
450
   </listitem>
 
451
  </orderedlist>
 
452
 
 
453
  <para>
 
454
   When encrypting with a public key:
 
455
  </para>
 
456
  <orderedlist>
 
457
   <listitem>
 
458
    <para>
 
459
     A new random session key is generated.
 
460
    </para>
 
461
   </listitem>
 
462
   <listitem>
 
463
    <para>
 
464
     It is encrypted using the public key and put into the session key packet.
 
465
    </para>
 
466
   </listitem>
 
467
  </orderedlist>
 
468
 
 
469
  <para>
 
470
   In either case the data to be encrypted is processed as follows:
 
471
  </para>
 
472
  <orderedlist>
 
473
   <listitem>
 
474
    <para>
 
475
     Optional data-manipulation: compression, conversion to UTF-8,
 
476
     and/or conversion of line-endings.
 
477
    </para>
 
478
   </listitem>
 
479
   <listitem>
 
480
    <para>
 
481
     The data is prefixed with a block of random bytes.  This is equivalent
 
482
     to using a random IV.
 
483
    </para>
 
484
   </listitem>
 
485
   <listitem>
 
486
    <para>
 
487
     An SHA1 hash of the random prefix and data is appended.
 
488
    </para>
 
489
   </listitem>
 
490
   <listitem>
 
491
    <para>
 
492
     All this is encrypted with the session key and placed in the data packet.
 
493
    </para>
 
494
   </listitem>
 
495
  </orderedlist>
 
496
 
 
497
  <sect3>
 
498
   <title><function>pgp_sym_encrypt()</function></title>
 
499
 
 
500
<synopsis>
 
501
pgp_sym_encrypt(data text, psw text [, options text ]) returns bytea
 
502
pgp_sym_encrypt_bytea(data bytea, psw text [, options text ]) returns bytea
 
503
</synopsis>
 
504
   <para>
 
505
    Encrypt <parameter>data</> with a symmetric PGP key <parameter>psw</>.
 
506
    The <parameter>options</> parameter can contain option settings,
 
507
    as described below.
 
508
   </para>
 
509
  </sect3>
 
510
 
 
511
  <sect3>
 
512
   <title><function>pgp_sym_decrypt()</function></title>
 
513
 
 
514
<synopsis>
 
515
pgp_sym_decrypt(msg bytea, psw text [, options text ]) returns text
 
516
pgp_sym_decrypt_bytea(msg bytea, psw text [, options text ]) returns bytea
 
517
</synopsis>
 
518
   <para>
 
519
    Decrypt a symmetric-key-encrypted PGP message.
 
520
   </para>
 
521
   <para>
 
522
    Decrypting <type>bytea</> data with <function>pgp_sym_decrypt</> is disallowed.
 
523
    This is to avoid outputting invalid character data.  Decrypting
 
524
    originally textual data with <function>pgp_sym_decrypt_bytea</> is fine.
 
525
   </para>
 
526
   <para>
 
527
    The <parameter>options</> parameter can contain option settings,
 
528
    as described below.
 
529
   </para>
 
530
  </sect3>
 
531
 
 
532
  <sect3>
 
533
   <title><function>pgp_pub_encrypt()</function></title>
 
534
 
 
535
<synopsis>
 
536
pgp_pub_encrypt(data text, key bytea [, options text ]) returns bytea
 
537
pgp_pub_encrypt_bytea(data bytea, key bytea [, options text ]) returns bytea
 
538
</synopsis>
 
539
   <para>
 
540
    Encrypt <parameter>data</> with a public PGP key <parameter>key</>.
 
541
    Giving this function a secret key will produce a error.
 
542
   </para>
 
543
   <para>
 
544
    The <parameter>options</> parameter can contain option settings,
 
545
    as described below.
 
546
   </para>
 
547
  </sect3>
 
548
 
 
549
  <sect3>
 
550
   <title><function>pgp_pub_decrypt()</function></title>
 
551
 
 
552
<synopsis>
 
553
pgp_pub_decrypt(msg bytea, key bytea [, psw text [, options text ]]) returns text
 
554
pgp_pub_decrypt_bytea(msg bytea, key bytea [, psw text [, options text ]]) returns bytea
 
555
</synopsis>
 
556
   <para>
 
557
    Decrypt a public-key-encrypted message.  <parameter>key</> must be the
 
558
    secret key corresponding to the public key that was used to encrypt.
 
559
    If the secret key is password-protected, you must give the password in
 
560
    <parameter>psw</>.  If there is no password, but you want to specify
 
561
    options, you need to give an empty password.
 
562
   </para>
 
563
   <para>
 
564
    Decrypting <type>bytea</> data with <function>pgp_pub_decrypt</> is disallowed.
 
565
    This is to avoid outputting invalid character data.  Decrypting
 
566
    originally textual data with <function>pgp_pub_decrypt_bytea</> is fine.
 
567
   </para>
 
568
   <para>
 
569
    The <parameter>options</> parameter can contain option settings,
 
570
    as described below.
 
571
   </para>
 
572
  </sect3>
 
573
 
 
574
  <sect3>
 
575
   <title><function>pgp_key_id()</function></title>
 
576
 
 
577
<synopsis>
 
578
pgp_key_id(bytea) returns text
 
579
</synopsis>
 
580
   <para>
 
581
    <function>pgp_key_id</> extracts the key ID of a PGP public or secret key.
 
582
    Or it gives the key ID that was used for encrypting the data, if given
 
583
    an encrypted message.
 
584
   </para>
 
585
   <para>
 
586
    It can return 2 special key IDs:
 
587
   </para>
 
588
   <itemizedlist>
 
589
    <listitem>
 
590
     <para>
 
591
      <literal>SYMKEY</>
 
592
     </para>
 
593
     <para>
 
594
      The message is encrypted with a symmetric key.
 
595
     </para>
 
596
    </listitem>
 
597
    <listitem>
 
598
     <para>
 
599
      <literal>ANYKEY</>
 
600
     </para>
 
601
     <para>
 
602
      The message is public-key encrypted, but the key ID has been removed.
 
603
      That means you will need to try all your secret keys on it to see
 
604
      which one decrypts it.  <filename>pgcrypto</> itself does not produce
 
605
      such messages.
 
606
     </para>
 
607
    </listitem>
 
608
   </itemizedlist>
 
609
   <para>
 
610
    Note that different keys may have the same ID.   This is rare but a normal
 
611
    event. The client application should then try to decrypt with each one,
 
612
    to see which fits &mdash; like handling <literal>ANYKEY</>.
 
613
   </para>
 
614
  </sect3>
 
615
 
 
616
  <sect3>
 
617
   <title><function>armor()</function>, <function>dearmor()</function></title>
 
618
 
 
619
<synopsis>
 
620
armor(data bytea) returns text
 
621
dearmor(data text) returns bytea
 
622
</synopsis>
 
623
   <para>
 
624
    These functions wrap/unwrap binary data into PGP ASCII-armor format,
 
625
    which is basically Base64 with CRC and additional formatting.
 
626
   </para>
 
627
  </sect3>
 
628
 
 
629
  <sect3>
 
630
   <title>Options for PGP Functions</title>
 
631
 
 
632
   <para>
 
633
    Options are named to be similar to GnuPG.  An option's value should be
 
634
    given after an equal sign; separate options from each other with commas.
 
635
    For example:
 
636
<programlisting>
 
637
pgp_sym_encrypt(data, psw, 'compress-algo=1, cipher-algo=aes256')
 
638
</programlisting>
 
639
   </para>
 
640
 
 
641
   <para>
 
642
    All of the options except <literal>convert-crlf</literal> apply only to
 
643
    encrypt functions.  Decrypt functions get the parameters from the PGP
 
644
    data.
 
645
   </para>
 
646
 
 
647
   <para>
 
648
    The most interesting options are probably
 
649
    <literal>compress-algo</literal> and <literal>unicode-mode</literal>.
 
650
    The rest should have reasonable defaults.
 
651
   </para>
 
652
 
 
653
  <sect4>
 
654
   <title>cipher-algo</title>
 
655
 
 
656
   <para>
 
657
    Which cipher algorithm to use.
 
658
   </para>
 
659
<literallayout>
 
660
Values: bf, aes128, aes192, aes256 (OpenSSL-only: <literal>3des</literal>, <literal>cast5</literal>)
 
661
Default: aes128
 
662
Applies to: pgp_sym_encrypt, pgp_pub_encrypt
 
663
</literallayout>
 
664
  </sect4>
 
665
 
 
666
  <sect4>
 
667
   <title>compress-algo</title>
 
668
 
 
669
   <para>
 
670
    Which compression algorithm to use.  Only available if
 
671
    <productname>PostgreSQL</productname> was built with zlib.
 
672
   </para>
 
673
<literallayout>
 
674
Values:
 
675
  0 - no compression
 
676
  1 - ZIP compression
 
677
  2 - ZLIB compression (= ZIP plus meta-data and block CRCs)
 
678
Default: 0
 
679
Applies to: pgp_sym_encrypt, pgp_pub_encrypt
 
680
</literallayout>
 
681
  </sect4>
 
682
 
 
683
  <sect4>
 
684
   <title>compress-level</title>
 
685
 
 
686
   <para>
 
687
    How much to compress.  Higher levels compress smaller but are slower.
 
688
    0 disables compression.
 
689
   </para>
 
690
<literallayout>
 
691
Values: 0, 1-9
 
692
Default: 6
 
693
Applies to: pgp_sym_encrypt, pgp_pub_encrypt
 
694
</literallayout>
 
695
  </sect4>
 
696
 
 
697
  <sect4>
 
698
   <title>convert-crlf</title>
 
699
 
 
700
   <para>
 
701
    Whether to convert <literal>\n</literal> into <literal>\r\n</literal> when
 
702
    encrypting and <literal>\r\n</literal> to <literal>\n</literal> when
 
703
    decrypting.  RFC 4880 specifies that text data should be stored using
 
704
    <literal>\r\n</literal> line-feeds.  Use this to get fully RFC-compliant
 
705
    behavior.
 
706
   </para>
 
707
<literallayout>
 
708
Values: 0, 1
 
709
Default: 0
 
710
Applies to: pgp_sym_encrypt, pgp_pub_encrypt, pgp_sym_decrypt, pgp_pub_decrypt
 
711
</literallayout>
 
712
  </sect4>
 
713
 
 
714
  <sect4>
 
715
   <title>disable-mdc</title>
 
716
 
 
717
   <para>
 
718
    Do not protect data with SHA-1.  The only good reason to use this
 
719
    option is to achieve compatibility with ancient PGP products, predating
 
720
    the addition of SHA-1 protected packets to RFC 4880.
 
721
    Recent gnupg.org and pgp.com software supports it fine.
 
722
   </para>
 
723
<literallayout>
 
724
Values: 0, 1
 
725
Default: 0
 
726
Applies to: pgp_sym_encrypt, pgp_pub_encrypt
 
727
</literallayout>
 
728
  </sect4>
 
729
 
 
730
  <sect4>
 
731
   <title>enable-session-key</title>
 
732
 
 
733
   <para>
 
734
    Use separate session key.  Public-key encryption always uses a separate
 
735
    session key; this is for symmetric-key encryption, which by default
 
736
    uses the S2K key directly.
 
737
   </para>
 
738
<literallayout>
 
739
Values: 0, 1
 
740
Default: 0
 
741
Applies to: pgp_sym_encrypt
 
742
</literallayout>
 
743
  </sect4>
 
744
 
 
745
  <sect4>
 
746
   <title>s2k-mode</title>
 
747
 
 
748
   <para>
 
749
    Which S2K algorithm to use.
 
750
   </para>
 
751
<literallayout>
 
752
Values:
 
753
  0 - Without salt.  Dangerous!
 
754
  1 - With salt but with fixed iteration count.
 
755
  3 - Variable iteration count.
 
756
Default: 3
 
757
Applies to: pgp_sym_encrypt
 
758
</literallayout>
 
759
  </sect4>
 
760
 
 
761
  <sect4>
 
762
   <title>s2k-digest-algo</title>
 
763
 
 
764
   <para>
 
765
    Which digest algorithm to use in S2K calculation.
 
766
   </para>
 
767
<literallayout>
 
768
Values: md5, sha1
 
769
Default: sha1
 
770
Applies to: pgp_sym_encrypt
 
771
</literallayout>
 
772
  </sect4>
 
773
 
 
774
  <sect4>
 
775
   <title>s2k-cipher-algo</title>
 
776
 
 
777
   <para>
 
778
    Which cipher to use for encrypting separate session key.
 
779
   </para>
 
780
<literallayout>
 
781
Values: bf, aes, aes128, aes192, aes256
 
782
Default: use cipher-algo
 
783
Applies to: pgp_sym_encrypt
 
784
</literallayout>
 
785
  </sect4>
 
786
 
 
787
  <sect4>
 
788
   <title>unicode-mode</title>
 
789
 
 
790
   <para>
 
791
    Whether to convert textual data from database internal encoding to
 
792
    UTF-8 and back.  If your database already is UTF-8, no conversion will
 
793
    be done, but the message will be tagged as UTF-8.  Without this option
 
794
    it will not be.
 
795
   </para>
 
796
<literallayout>
 
797
Values: 0, 1
 
798
Default: 0
 
799
Applies to: pgp_sym_encrypt, pgp_pub_encrypt
 
800
</literallayout>
 
801
  </sect4>
 
802
  </sect3>
 
803
 
 
804
 <sect3>
 
805
  <title>Generating PGP Keys with GnuPG</title>
 
806
 
 
807
  <para>
 
808
   To generate a new key:
 
809
<programlisting>
 
810
gpg --gen-key
 
811
</programlisting>
 
812
  </para>
 
813
  <para>
 
814
   The preferred key type is <quote>DSA and Elgamal</>.
 
815
  </para>
 
816
  <para>
 
817
   For RSA encryption you must create either DSA or RSA sign-only key
 
818
   as master and then add an RSA encryption subkey with
 
819
   <literal>gpg --edit-key</literal>.
 
820
  </para>
 
821
  <para>
 
822
   To list keys:
 
823
<programlisting>
 
824
gpg --list-secret-keys
 
825
</programlisting>
 
826
  </para>
 
827
  <para>
 
828
   To export a public key in ASCII-armor format:
 
829
<programlisting>
 
830
gpg -a --export KEYID > public.key
 
831
</programlisting>
 
832
  </para>
 
833
  <para>
 
834
   To export a secret key in ASCII-armor format:
 
835
<programlisting>
 
836
gpg -a --export-secret-keys KEYID > secret.key
 
837
</programlisting>
 
838
  </para>
 
839
  <para>
 
840
   You need to use <function>dearmor()</> on these keys before giving them to
 
841
   the PGP functions.  Or if you can handle binary data, you can drop
 
842
   <literal>-a</literal> from the command.
 
843
  </para>
 
844
  <para>
 
845
   For more details see <literal>man gpg</literal>,
 
846
   <ulink url="http://www.gnupg.org/gph/en/manual.html">The GNU
 
847
   Privacy Handbook</ulink> and other documentation on
 
848
   <ulink url="http://www.gnupg.org"></ulink>.
 
849
  </para>
 
850
 </sect3>
 
851
 
 
852
 <sect3>
 
853
  <title>Limitations of PGP Code</title>
 
854
 
 
855
  <itemizedlist>
 
856
   <listitem>
 
857
    <para>
 
858
    No support for signing.  That also means that it is not checked
 
859
    whether the encryption subkey belongs to the master key.
 
860
    </para>
 
861
   </listitem>
 
862
   <listitem>
 
863
    <para>
 
864
    No support for encryption key as master key.  As such practice
 
865
    is generally discouraged, this should not be a problem.
 
866
    </para>
 
867
   </listitem>
 
868
   <listitem>
 
869
    <para>
 
870
    No support for several subkeys.  This may seem like a problem, as this
 
871
    is common practice.  On the other hand, you should not use your regular
 
872
    GPG/PGP keys with <filename>pgcrypto</>, but create new ones,
 
873
    as the usage scenario is rather different.
 
874
    </para>
 
875
   </listitem>
 
876
  </itemizedlist>
 
877
  </sect3>
 
878
 </sect2>
 
879
 
 
880
 <sect2>
 
881
  <title>Raw Encryption Functions</title>
 
882
 
 
883
  <para>
 
884
   These functions only run a cipher over data; they don't have any advanced
 
885
   features of PGP encryption.  Therefore they have some major problems:
 
886
  </para>
 
887
  <orderedlist>
 
888
   <listitem>
 
889
    <para>
 
890
    They use user key directly as cipher key.
 
891
    </para>
 
892
   </listitem>
 
893
   <listitem>
 
894
    <para>
 
895
    They don't provide any integrity checking, to see
 
896
    if the encrypted data was modified.
 
897
    </para>
 
898
   </listitem>
 
899
   <listitem>
 
900
    <para>
 
901
    They expect that users manage all encryption parameters
 
902
    themselves, even IV.
 
903
    </para>
 
904
   </listitem>
 
905
   <listitem>
 
906
    <para>
 
907
    They don't handle text.
 
908
    </para>
 
909
   </listitem>
 
910
  </orderedlist>
 
911
  <para>
 
912
   So, with the introduction of PGP encryption, usage of raw
 
913
   encryption functions is discouraged.
 
914
  </para>
 
915
 
 
916
<synopsis>
 
917
encrypt(data bytea, key bytea, type text) returns bytea
 
918
decrypt(data bytea, key bytea, type text) returns bytea
 
919
 
 
920
encrypt_iv(data bytea, key bytea, iv bytea, type text) returns bytea
 
921
decrypt_iv(data bytea, key bytea, iv bytea, type text) returns bytea
 
922
</synopsis>
 
923
 
 
924
  <para>
 
925
   Encrypt/decrypt data using the cipher method specified by
 
926
   <parameter>type</parameter>.  The syntax of the
 
927
   <parameter>type</parameter> string is:
 
928
 
 
929
<synopsis>
 
930
<replaceable>algorithm</> <optional> <literal>-</> <replaceable>mode</> </optional> <optional> <literal>/pad:</> <replaceable>padding</> </optional>
 
931
</synopsis>
 
932
   where <replaceable>algorithm</> is one of:
 
933
 
 
934
  <itemizedlist>
 
935
   <listitem><para><literal>bf</literal> &mdash; Blowfish</para></listitem>
 
936
   <listitem><para><literal>aes</literal> &mdash; AES (Rijndael-128)</para></listitem>
 
937
  </itemizedlist>
 
938
   and <replaceable>mode</> is one of:
 
939
  <itemizedlist>
 
940
   <listitem>
 
941
    <para>
 
942
    <literal>cbc</literal> &mdash; next block depends on previous (default)
 
943
    </para>
 
944
   </listitem>
 
945
   <listitem>
 
946
    <para>
 
947
    <literal>ecb</literal> &mdash; each block is encrypted separately (for
 
948
    testing only)
 
949
    </para>
 
950
   </listitem>
 
951
  </itemizedlist>
 
952
   and <replaceable>padding</> is one of:
 
953
  <itemizedlist>
 
954
   <listitem>
 
955
    <para>
 
956
    <literal>pkcs</literal> &mdash; data may be any length (default)
 
957
    </para>
 
958
   </listitem>
 
959
   <listitem>
 
960
    <para>
 
961
    <literal>none</literal> &mdash; data must be multiple of cipher block size
 
962
    </para>
 
963
   </listitem>
 
964
  </itemizedlist>
 
965
  </para>
 
966
  <para>
 
967
   So, for example, these are equivalent:
 
968
<programlisting>
 
969
encrypt(data, 'fooz', 'bf')
 
970
encrypt(data, 'fooz', 'bf-cbc/pad:pkcs')
 
971
</programlisting>
 
972
  </para>
 
973
  <para>
 
974
   In <function>encrypt_iv</> and <function>decrypt_iv</>, the
 
975
   <parameter>iv</> parameter is the initial value for the CBC mode;
 
976
   it is ignored for ECB.
 
977
   It is clipped or padded with zeroes if not exactly block size.
 
978
   It defaults to all zeroes in the functions without this parameter.
 
979
  </para>
 
980
 </sect2>
 
981
 
 
982
 <sect2>
 
983
  <title>Random-Data Functions</title>
 
984
 
 
985
<synopsis>
 
986
gen_random_bytes(count integer) returns bytea
 
987
</synopsis>
 
988
  <para>
 
989
   Returns <parameter>count</> cryptographically strong random bytes.
 
990
   At most 1024 bytes can be extracted at a time.  This is to avoid
 
991
   draining the randomness generator pool.
 
992
  </para>
 
993
 </sect2>
 
994
 
 
995
 <sect2>
 
996
  <title>Notes</title>
 
997
 
 
998
  <sect3>
 
999
   <title>Configuration</title>
 
1000
 
 
1001
   <para>
 
1002
    <filename>pgcrypto</> configures itself according to the findings of the
 
1003
    main PostgreSQL <literal>configure</literal> script.  The options that
 
1004
    affect it are <literal>--with-zlib</literal> and
 
1005
    <literal>--with-openssl</literal>.
 
1006
   </para>
 
1007
 
 
1008
   <para>
 
1009
    When compiled with zlib, PGP encryption functions are able to
 
1010
    compress data before encrypting.
 
1011
   </para>
 
1012
 
 
1013
   <para>
 
1014
    When compiled with OpenSSL, there will be more algorithms available.
 
1015
    Also public-key encryption functions will be faster as OpenSSL
 
1016
    has more optimized BIGNUM functions.
 
1017
   </para>
 
1018
 
 
1019
   <table id="pgcrypto-with-without-openssl">
 
1020
    <title>Summary of Functionality with and without OpenSSL</title>
 
1021
    <tgroup cols="3">
 
1022
     <thead>
 
1023
      <row>
 
1024
       <entry>Functionality</entry>
 
1025
       <entry>Built-in</entry>
 
1026
       <entry>With OpenSSL</entry>
 
1027
      </row>
 
1028
     </thead>
 
1029
     <tbody>
 
1030
      <row>
 
1031
       <entry>MD5</entry>
 
1032
       <entry>yes</entry>
 
1033
       <entry>yes</entry>
 
1034
      </row>
 
1035
      <row>
 
1036
       <entry>SHA1</entry>
 
1037
       <entry>yes</entry>
 
1038
       <entry>yes</entry>
 
1039
      </row>
 
1040
      <row>
 
1041
       <entry>SHA224/256/384/512</entry>
 
1042
       <entry>yes</entry>
 
1043
       <entry>yes (Note 1)</entry>
 
1044
      </row>
 
1045
      <row>
 
1046
       <entry>Other digest algorithms</entry>
 
1047
       <entry>no</entry>
 
1048
       <entry>yes (Note 2)</entry>
 
1049
      </row>
 
1050
      <row>
 
1051
       <entry>Blowfish</entry>
 
1052
       <entry>yes</entry>
 
1053
       <entry>yes</entry>
 
1054
      </row>
 
1055
      <row>
 
1056
       <entry>AES</entry>
 
1057
       <entry>yes</entry>
 
1058
       <entry>yes (Note 3)</entry>
 
1059
      </row>
 
1060
      <row>
 
1061
       <entry>DES/3DES/CAST5</entry>
 
1062
       <entry>no</entry>
 
1063
       <entry>yes</entry>
 
1064
      </row>
 
1065
      <row>
 
1066
       <entry>Raw encryption</entry>
 
1067
       <entry>yes</entry>
 
1068
       <entry>yes</entry>
 
1069
      </row>
 
1070
      <row>
 
1071
       <entry>PGP Symmetric encryption</entry>
 
1072
       <entry>yes</entry>
 
1073
       <entry>yes</entry>
 
1074
      </row>
 
1075
      <row>
 
1076
       <entry>PGP Public-Key encryption</entry>
 
1077
       <entry>yes</entry>
 
1078
       <entry>yes</entry>
 
1079
      </row>
 
1080
     </tbody>
 
1081
    </tgroup>
 
1082
   </table>
 
1083
 
 
1084
   <para>
 
1085
    Notes:
 
1086
   </para>
 
1087
 
 
1088
   <orderedlist>
 
1089
    <listitem>
 
1090
     <para>
 
1091
      SHA2 algorithms were added to OpenSSL in version 0.9.8.  For
 
1092
      older versions, <filename>pgcrypto</> will use built-in code.
 
1093
     </para>
 
1094
    </listitem>
 
1095
    <listitem>
 
1096
     <para>
 
1097
      Any digest algorithm OpenSSL supports is automatically picked up.
 
1098
      This is not possible with ciphers, which need to be supported
 
1099
      explicitly.
 
1100
     </para>
 
1101
    </listitem>
 
1102
    <listitem>
 
1103
     <para>
 
1104
      AES is included in OpenSSL since version 0.9.7.  For
 
1105
      older versions, <filename>pgcrypto</> will use built-in code.
 
1106
     </para>
 
1107
    </listitem>
 
1108
   </orderedlist>
 
1109
  </sect3>
 
1110
 
 
1111
  <sect3>
 
1112
   <title>NULL Handling</title>
 
1113
 
 
1114
   <para>
 
1115
    As is standard in SQL, all functions return NULL, if any of the arguments
 
1116
    are NULL.  This may create security risks on careless usage.
 
1117
   </para>
 
1118
  </sect3>
 
1119
 
 
1120
  <sect3>
 
1121
   <title>Security Limitations</title>
 
1122
 
 
1123
   <para>
 
1124
    All <filename>pgcrypto</> functions run inside the database server.
 
1125
    That means that all
 
1126
    the data and passwords move between <filename>pgcrypto</> and client
 
1127
    applications in clear text.  Thus you must:
 
1128
   </para>
 
1129
 
 
1130
   <orderedlist>
 
1131
    <listitem>
 
1132
     <para>Connect locally or use SSL connections.</para>
 
1133
    </listitem>
 
1134
    <listitem>
 
1135
     <para>Trust both system and database administrator.</para>
 
1136
    </listitem>
 
1137
   </orderedlist>
 
1138
 
 
1139
   <para>
 
1140
    If you cannot, then better do crypto inside client application.
 
1141
   </para>
 
1142
  </sect3>
 
1143
 
 
1144
  <sect3>
 
1145
   <title>Useful Reading</title>
 
1146
 
 
1147
   <itemizedlist>
 
1148
    <listitem>
 
1149
     <para><ulink url="http://www.gnupg.org/gph/en/manual.html"></ulink></para>
 
1150
     <para>The GNU Privacy Handbook.</para>
 
1151
    </listitem>
 
1152
    <listitem>
 
1153
     <para><ulink url="http://www.openwall.com/crypt/"></ulink></para>
 
1154
     <para>Describes the crypt-blowfish algorithm.</para>
 
1155
    </listitem>
 
1156
    <listitem>
 
1157
     <para>
 
1158
      <ulink url="http://www.stack.nl/~galactus/remailers/passphrase-faq.html"></ulink>
 
1159
     </para>
 
1160
     <para>How to choose a good password.</para>
 
1161
    </listitem>
 
1162
    <listitem>
 
1163
     <para><ulink url="http://world.std.com/~reinhold/diceware.html"></ulink></para>
 
1164
     <para>Interesting idea for picking passwords.</para>
 
1165
    </listitem>
 
1166
    <listitem>
 
1167
     <para>
 
1168
      <ulink url="http://www.interhack.net/people/cmcurtin/snake-oil-faq.html"></ulink>
 
1169
     </para>
 
1170
     <para>Describes good and bad cryptography.</para>
 
1171
    </listitem>
 
1172
   </itemizedlist>
 
1173
  </sect3>
 
1174
 
 
1175
  <sect3>
 
1176
   <title>Technical References</title>
 
1177
 
 
1178
   <itemizedlist>
 
1179
    <listitem>
 
1180
     <para><ulink url="http://www.ietf.org/rfc/rfc4880.txt"></ulink></para>
 
1181
     <para>OpenPGP message format.</para>
 
1182
    </listitem>
 
1183
    <listitem>
 
1184
     <para><ulink url="http://www.ietf.org/rfc/rfc1321.txt"></ulink></para>
 
1185
     <para>The MD5 Message-Digest Algorithm.</para>
 
1186
    </listitem>
 
1187
    <listitem>
 
1188
     <para><ulink url="http://www.ietf.org/rfc/rfc2104.txt"></ulink></para>
 
1189
     <para>HMAC: Keyed-Hashing for Message Authentication.</para>
 
1190
    </listitem>
 
1191
    <listitem>
 
1192
     <para>
 
1193
      <ulink url="http://www.usenix.org/events/usenix99/provos.html"></ulink>
 
1194
     </para>
 
1195
     <para>Comparison of crypt-des, crypt-md5 and bcrypt algorithms.</para>
 
1196
    </listitem>
 
1197
    <listitem>
 
1198
     <para><ulink url="http://csrc.nist.gov/cryptval/des.htm"></ulink></para>
 
1199
     <para>Standards for DES, 3DES and AES.</para>
 
1200
    </listitem>
 
1201
    <listitem>
 
1202
     <para>
 
1203
      <ulink url="http://en.wikipedia.org/wiki/Fortuna_(PRNG)"></ulink>
 
1204
     </para>
 
1205
     <para>Description of Fortuna CSPRNG.</para>
 
1206
    </listitem>
 
1207
    <listitem>
 
1208
     <para><ulink url="http://jlcooke.ca/random/"></ulink></para>
 
1209
     <para>Jean-Luc Cooke Fortuna-based <filename>/dev/random</> driver for Linux.</para>
 
1210
    </listitem>
 
1211
    <listitem>
 
1212
     <para><ulink url="http://research.cyber.ee/~lipmaa/crypto/"></ulink></para>
 
1213
     <para>Collection of cryptology pointers.</para>
 
1214
    </listitem>
 
1215
   </itemizedlist>
 
1216
  </sect3>
 
1217
 </sect2>
 
1218
 
 
1219
 <sect2>
 
1220
  <title>Author</title>
 
1221
 
 
1222
  <para>
 
1223
   Marko Kreen <email>markokr@gmail.com</email>
 
1224
  </para>
 
1225
 
 
1226
  <para>
 
1227
   <filename>pgcrypto</filename> uses code from the following sources:
 
1228
  </para>
 
1229
 
 
1230
  <informaltable>
 
1231
   <tgroup cols="3">
 
1232
    <thead>
 
1233
     <row>
 
1234
      <entry>Algorithm</entry>
 
1235
      <entry>Author</entry>
 
1236
      <entry>Source origin</entry>
 
1237
     </row>
 
1238
    </thead>
 
1239
    <tbody>
 
1240
     <row>
 
1241
      <entry>DES crypt</entry>
 
1242
      <entry>David Burren and others</entry>
 
1243
      <entry>FreeBSD libcrypt</entry>
 
1244
     </row>
 
1245
     <row>
 
1246
      <entry>MD5 crypt</entry>
 
1247
      <entry>Poul-Henning Kamp</entry>
 
1248
      <entry>FreeBSD libcrypt</entry>
 
1249
     </row>
 
1250
     <row>
 
1251
      <entry>Blowfish crypt</entry>
 
1252
      <entry>Solar Designer</entry>
 
1253
      <entry>www.openwall.com</entry>
 
1254
     </row>
 
1255
     <row>
 
1256
      <entry>Blowfish cipher</entry>
 
1257
      <entry>Simon Tatham</entry>
 
1258
      <entry>PuTTY</entry>
 
1259
     </row>
 
1260
     <row>
 
1261
      <entry>Rijndael cipher</entry>
 
1262
      <entry>Brian Gladman</entry>
 
1263
      <entry>OpenBSD sys/crypto</entry>
 
1264
     </row>
 
1265
     <row>
 
1266
      <entry>MD5 and SHA1</entry>
 
1267
      <entry>WIDE Project</entry>
 
1268
      <entry>KAME kame/sys/crypto</entry>
 
1269
     </row>
 
1270
     <row>
 
1271
      <entry>SHA256/384/512 </entry>
 
1272
      <entry>Aaron D. Gifford</entry>
 
1273
      <entry>OpenBSD sys/crypto</entry>
 
1274
     </row>
 
1275
     <row>
 
1276
      <entry>BIGNUM math</entry>
 
1277
      <entry>Michael J. Fromberger</entry>
 
1278
      <entry>dartmouth.edu/~sting/sw/imath</entry>
 
1279
     </row>
 
1280
    </tbody>
 
1281
   </tgroup>
 
1282
  </informaltable>
 
1283
 </sect2>
 
1284
 
 
1285
</sect1>