progs/key.c: Don't print secret parts of keys at verbosity 3.
[catacomb] / progs / key.1
CommitLineData
d03ab969 1.\" -*-nroff-*-
052b36d0 2.ie t \{\
8404fd75 3. if \n(.g \{\
4. fam P
5. \}
052b36d0 6. ds ss \s8\u
7. ds se \d\s0
1476eebc 8. ds us \s8\d
9. ds ue \u\s0
8404fd75 10. ds *b \(*b
052b36d0 11.\}
12.el \{\
13. ds ss ^
14. ds se
1476eebc 15. ds us _
8404fd75 16. ds ue
17. ds *b \fIbeta\fP
052b36d0 18.\}
c65df279 19.de VS
20.sp 1
21.RS
22.nf
23.ft B
24..
25.de VE
26.ft R
27.fi
28.RE
29.sp 1
30..
d07dfe80 31.TH key 1 "5 June 1999" "Straylight/Edgeware" "Catacomb cryptographic library"
d03ab969 32.SH NAME
33key \- simple key management system
34.SH SYNOPSIS
35.B key
36.RB [ \-k
37.IR keyring ]
38.I command
39.PP
40where
41.I command
42is one of:
43.PP
c65df279 44.B help
45.RI [ command ...]
46.br
47.B show
48.RI [ item ...]
49.br
d03ab969 50.B add
4e67e30b 51.RB [ \-lqrLKS ]
052b36d0 52.RB [ \-a
53.IR alg ]
54.RB [ \-b | \-B
d03ab969 55.IR bits ]
052b36d0 56.RB [ \-p
57.IR param ]
d07dfe80 58.RB [ \-R
052b36d0 59.IR tag ]
60.br
61\h'8n'
c65df279 62.RB [ \-A
63.IR seed-alg ]
64.RB [ \-s
65.IR seed ]
66.RB [ \-n
67.IR bits ]
68.br
69\h'8n'
d03ab969 70.RB [ \-e
71.IR expire ]
052b36d0 72.RB [ \-t
73.IR tag ]
d03ab969 74.RB [ \-c
75.IR comment ]
eb31b00e 76.RB [ \-C
77.IR curve ]
78.br
79\h'8n'
d03ab969 80.I type
81.IR attr ...
82.br
83.B expire
052b36d0 84.IR tag ...
d03ab969 85.br
86.B delete
052b36d0 87.IR tag ...
88.br
89.B tag
90.I tag
91.RI [ new-tag ]
92.br
93.B comment
94.I tag
95.RI [ comment ]
d03ab969 96.br
97.B setattr
052b36d0 98.I tag
d03ab969 99.IR attr ...
100.br
e9be047b 101.B getattr
102.I tag
103.I attr
104.br
052b36d0 105.B lock
106.I qtag
107.br
108.B unlock
109.I qtag
110.br
d03ab969 111.B list
052b36d0 112.RB [ \-uqv ]
113.RB [ \-f
114.IR filter ]
115.RI [ tag ...]
116.br
117.B fingerprint
118.RB [ \-f
119.IR filter ]
16810bbd
MW
120.RB [ \-p
121.IR style ]
b817bfc6 122.RB [ \-a
123.IR hash ]
052b36d0 124.RI [ tag ...]
d03ab969 125.br
58507325 126.B verify
127.RB [ \-f
128.IR filter ]
16810bbd
MW
129.RB [ \-p
130.IR style ]
58507325 131.RB [ \-a
132.IR hash ]
133.I tag
134.I fingerprint
135.br
d03ab969 136.B tidy
137.br
138.B extract
052b36d0 139.RB [ \-f
140.IR filter ]
d03ab969 141.I file
052b36d0 142.RI [ tag ...]
d03ab969 143.br
144.B merge
145.I file
146.SH DESCRIPTION
147The
148.B key
149command performs useful operations on Catacomb keyring files. It
150provides a number of subcommands, by which the various operations may be
151carried out.
152.SS "Global options"
153Before the command name,
154.I "global options"
155may be given. The following global options are supported:
156.TP
c65df279 157.BR "\-h, \-\-help " [ \fIcommand ...]
d03ab969 158Writes a brief summary of
159.BR key 's
160various options to standard output, and
c65df279 161returns a successful exit status. With command names, gives help on
162those commands.
d03ab969 163.TP
164.B "\-v, \-\-version"
165Writes the program's version number to standard output, and returns a
166successful exit status.
167.TP
168.B "\-u, \-\-usage"
169Writes a very terse command line summary to standard output, and returns
170a successful exit status.
171.TP
c9e31e42 172.BI "\-k, \-\-keyring " file
d03ab969 173Names the keyring file which
174.B key
175is to process. The default keyring, used if this option doesn't specify
176one, is the file named
177.B keyring
178in the current directory. The keyring must be stored in a regular file:
179pipes, sockets, devices etc. are not allowed.
180The
181.B key
182program attempts to lock the keyring before accessing it, using
183.BR fcntl (2)
184locking. It will however time out after a short while (10 seconds) and
185report a failure.
186.SS Concepts
187In addition to the actual key data itself, a Catacomb key has a number
188of other pieces of information attached to it:
189.TP
052b36d0 190.B "keyid"
191Every key has a 32-bit identifying number, written in hexadecimal.
192Keyids are not actually related to the key contents: they're generated
193randomly. Applications use keyids to refer to specific keys; users are
194probably better off with tags and types. A
d03ab969 195.I deleted
196key cannot be looked up by keyid.
197.TP
052b36d0 198.B "tag"
199A key's tag is a unique string which can be used by users and
200applications to identify the key. Tag strings may not contain spaces,
201colons or dots. A
202.I deleted
203key cannot be looked up by tag. Whenever a tag name is wanted, a hex
204keyid or key type string can be given instead.
205.TP
206.B "type"
d03ab969 207A key's type string describes what the key may be used for. The type
208string is arbitrary, except that it may not contain whitespace
052b36d0 209characters, dots or colons. Applications use key types to obtain an
210arbitrary but suitable key for some purpose. An
d03ab969 211.I expired
052b36d0 212key cannot be looked up by type, but may be looked up by keyid or tag.
213.TP
214.B "key encoding"
215There are a number of different ways in which keys can be represented,
216according to the uses to which the key will be put. Most symmetric
217algorithms use
218.I binary
219keys. Keys used with number-theoretic systems (like most common
220public-key systems) use
221.I "multiprecision integer"
8404fd75 222keys. Elliptic curve systems use
223.I "curve point"
224keys, which are either a pair of integers representing field elements,
225or a `point at infinity'. Algorithms which require several key
226constituents (again, like most public-key systems) use
052b36d0 227.I structured
8404fd75 228keys, which consist of a collection of named parts. It's possible to
229store an
230.I "ASCII string"
231as a key, though this is usually done as a component of a structured
232key. Finally, keys (including structured keys) can be encrypted.
052b36d0 233.TP
234.B "filter"
235Keys and key components may be selected by a filter expression, a
236sequence of flag names separated by commas. Flags are:
237.BR binary ,
238.BR integer ,
8404fd75 239.BR struct ,
240.BR ec ,
241.BR string ,
052b36d0 242or
243.B encrypt
244(describing the key encoding);
245.BR symmetric ,
246.BR private ,
8404fd75 247.BR public ,
052b36d0 248or
249.B shared
250(describing the category of key);
251.B burn
252and its negation
253.B \-burn
254(whether the key should be erased from memory after use); and
255.B secret
256and its negation
257.B \-secret
258(whether the key is safe to divulge).
259.TP
260.B "qualified tag"
261A key component may be identified by the key's tag (or keyid, or type).
262Subcomponents of structured keys are identified by following the tag by
263a dot and the name of the subcomponent.
d03ab969 264.TP
265.B "expiry time"
266Most keys expire after a certain amount of time. Once a key has
267expired, it will no longer be chosen as a result of a lookup by key
268type. However, it is not deleted until its deletion time is also
269reached.
270.TP
271.B "deletion time"
272A key's deletion time is the latest expiry time of any of the objects
273which require that key. For example, a key used for authenticating
274cryptographic cookies should have its deletion time set to the longest
052b36d0 275expiry time of any of the cookies it can authenticate. Once a key's
276deletion time is passed, it can no longer be referred to by
d03ab969 277applications, and will be removed from the keyring next time it's
278written to disk.
279.TP
052b36d0 280.B "comment"
d03ab969 281A key may be given a comment when it's created. The comment is for the
282benefit of users, and isn't interpreted by applications at all.
283(Hopefully.)
284.TP
052b36d0 285.B "attributes"
ef3b232f
MW
286A key has zero or more name/value pairs. The names and values are
287arbitrary strings, except that they may not contain null bytes. Some
d03ab969 288attributes may have meaning for particular applications or key types;
289others may be assigned global meanings in future.
290.SH "COMMAND REFERENCE"
c65df279 291.SS help
292The
293.B help
294command behaves exactly as the
295.B \-\-help
296option. With no arguments, it shows an overview of
297.BR key 's
298options; with arguments, it describes the named subcommands.
299.SS show
300The
301.B show
302command prints various lists of tokens understood by
303.BR key .
304With no arguments, it prints all of the lists; with arguments, it prints
305just the named lists, in order. The recognized lists can be enumerated
306using the
307.VS
308key show list
309.VE
310command. The lists are as follows.
311.TP
312.B list
313The lists which can be enumerated by the
314.B show
315command.
316.TP
317.B hash
318The hash functions which can be used with the
319.B fingerprint
58507325 320and
321.B verify
322commands.
c65df279 323.TP
324.B ec
325The built-in elliptic curves which can be used with the
326.B add \-a ec
327command.
328.TP
329.B dh
ef3b232f 330The built-in Diffie\(enHellman groups which can be used with the
c65df279 331.B add \-a dh
332command.
333.TP
334.B keygen
335The key-generation algorithms which are acceptable to the
336.B \-a
337option of the
338.B add
339command.
340.TP
341.B seed
342The pseudorandom generators which are acceptable to the
343.B \-s
344option of the
345.B add
346command.
16810bbd
MW
347.TP
348.B fpres
349Fingerprint presentation styles, as used by the
350.B fingerprint
351and
352.B verify
353commands.
d03ab969 354.SS add
355The
356.B add
357command creates a new key and adds it to the keyring. The command
358accepts the following options:
359.TP
052b36d0 360.BI "\-a, \-\-algorithm " alg
361Selects a key generation algorithm. The default algorithm is
362.BR binary ;
c65df279 363the different algorithms are described below. The command
364.B key show keygen
365lists the recognized key-generation algorithms.
052b36d0 366.TP
c9e31e42 367.BI "\-b, \-\-bits " bits
d03ab969 368The length of the key to generate, in bits. The default, if this option
052b36d0 369is not supplied, depends on the key-generation algorithm.
370.TP
371.BI "\-B, \-\-qbits " bits
372The length of the subsidiary key or parameter, in bits. Not all
373key-generation algorithms have a subsidiary key size.
374.TP
375.BI "\-p, \-\-parameters " tag
7532e25e
MW
376Selects a key containing parameter values to copy.
377A new key also inherits attributes from its parameter key.
d03ab969 378.TP
c65df279 379.BI "\-A, \-\-seedalg " seed-alg
380Use the deterministic random number generator algorithm
381.I seed-alg
382to generate the key. Use
383.I before
384the
385.B \-s
386or
387.B \-n
388options; without one of these,
389.B \-A
390has no effect. The default algorithm is
391.BR rmd160-mgf .
392The command
393.B key show seed
394shows a list of recognized seeding algorithms. The seeding algorithm
395used to generate a key is recorded as the key's
396.B seedalg
397attribute.
398.TP
399.BI "\-s, \-\-seed " seed
400Generate the key deterministically using the given
401.IR seed ,
402which should be a Base64-encoded binary string. This is mainly useful
403for parameters keys (types
404.BR dsa-param
405and
406.BR dh-param ),
407to demonstrate that a set of parameters has been generated in an honest
408fashion. The
409.B dsarand
410generation algorithm can be used to generate
411.B dsa-param
412keys as required by FIPS186. The requested seed is recorded,
413Base64-encoded, as the new key's
414.B seed
415attribute.
416.TP
417.BI "\-n, \-\-newseed " bits
418Generate a new seed, with the given length in
419.IR bits .
420The generated seed is recorded, Base64-encoded, as the new key's
421.B seed
422attribute.
423.TP
c9e31e42 424.BI "\-e, \-\-expire " expire
d03ab969 425The expiry date for the generated key. This may be the string
426.RB ` forever '
427if the key should never expire automatically, or any date acceptable to
428the
429.BR getdate (3)
430library function. Briefly,
431.B getdate
432understands absolute dates such as
433.RB ` 1999-08-02 '
434or
435.RB ` "August 2nd, 1999" ',
436and (perhaps more usefully) relative dates such as
437.RB ` "+2 weeks" '.
438The default is to allow a 2 week expiry, which isn't useful.
439.TP
c9e31e42 440.BI "\-c, \-\-comment " comment
d03ab969 441Sets a comment for the key. The default is not to attach a comment.
052b36d0 442.TP
eb31b00e 443.BI "\-C, \-\-curve " curve-spec
444Use the elliptic curve described by
445.I curve-spec
446when generating elliptic curve parameters.
447.TP
052b36d0 448.BI "\-t, \-\-tag " tag
449Selects a tag string for the key. The default is not to set a tag. It
450is an error to select a tag which already exists.
451.TP
d07dfe80 452.BI "\-r, \-\-retag"
453If a
454.B \-t
455option is given, remove this tag from any key which already has it.
456.TP
457.BI "\-R, \-\-rand-id " tag
052b36d0 458Selects the key to use for the random number generator. Catacomb's
459random number generator can be
460.IR keyed ,
461so that, even if the inputs to the generator are compromised, knowledge
462of the key is also necessary to be able to predict the output. By
463default, the latest-expiring key with type
464.B catacomb-rand
465is used, if present; if not, no key is used.
466.TP
467.BI "\-l, \-\-lock"
468Requests that the secret parts of the newly-generated key be encrypted
469using a passphrase.
470.TP
471.BI "\-q, \-\-quiet"
472Suppresses the progress indication which is usually generated while
473time-consuming key generation tasks are being performed.
1476eebc 474.TP
8de0fc89
MW
475.BI "\-E, \-\-public-exponent"
476Set the public exponent for RSA keys.
477The default is 65537,
478because this seems to be the overwhelmingly popular choice
479among practitioners
480and because it was the exponent used before this option was introduced.
481The value 3 is fine unless you use a completely terrible padding scheme.
482.TP
4e67e30b 483.BI "\-L, \-\-lim-lee"
ef3b232f
MW
484When generating Diffie\(enHellman parameters, generate a Lim\(enLee
485prime rather than a random (or safe) prime. See the details on
486Diffie\(enHellman key generation below.
1476eebc 487.TP
4e67e30b 488.BI "\-K, \-\-kcdsa"
ef3b232f
MW
489When generating Diffie\(enHellman parameters, generate a KCDSA-style
490Lim\(enLee prime rather than a random (or safe) prime. See the details
491on Diffie\(enHellman key generation below.
4e67e30b
MW
492.TP
493.BI "\-S, \-\-subgroup"
ef3b232f
MW
494When generating Diffie\(enHellman parameters with a Lim\(enLee prime,
495choose a generator of a prime-order subgroup rather than a subgroup of
496order
497.RI ( p "\ \-\ 1)/2."
d03ab969 498.PP
499The key's type is given by the required
500.I type
501argument. Following the type are zero or more attributes, which are
502attached to the key in the same way as for the
503.B setattr
504command.
505.PP
052b36d0 506The key-generation algorithms supported are as follows:
507.TP
508.B "binary"
509Generates a plain binary key of the requested length. If the requested
510key length is not a multiple of eight, the high-order bits of the first
511octet of the key are zeroed. The default key length is 128 bits.
512.TP
513.B "des"
514Generates a DES key, with parity bits. The key length must be 56, 112
515or 168; the default is 56. The low-order bit of each octet is ignored by
516the DES algorithm; it is used to give each octet odd parity.
517.TP
518.B "rsa"
519Generates a public/private key pair for use with the RSA algorithm.
520.IP
521The key components are
522.I p
523and
524.IR q ,
525a pair of prime numbers;
526.IR n ,
527the product of
528.I p
529and
530.IR q ;
531.IR e ,
532the public exponent;
533.IR d ,
534the private exponent, chosen such that
ef3b232f 535.IR ed \~\(==\~1
052b36d0 536(mod
ef3b232f 537.RI lcm( p "\~\-\~1, " q \~\-\~1));
052b36d0 538and some other values useful for optimizing private-key operations:
ef3b232f
MW
539.IR q "\*(ss\-1\*(se mod " p ,
540.IR d "\~mod " p \~\-\~1,
052b36d0 541and
ef3b232f 542.IR d "\~mod " q \~\-\~1.
052b36d0 543The values
544.I n
545and
546.I e
547constitute the public key; the rest must be kept secret. The key size
548requested by the
549.B \-b
550option determines the size of the modulus
551.IR n ;
552the default is 1024 bits.
553.IP
554The key generation algorithm chooses
555.I p
556and
557.I q
558to be
559.I strong
560primes: both
ef3b232f 561.IR p \~\-\~1
052b36d0 562and
ef3b232f
MW
563.IR p \~+\~1
564have large prime factors \(en call them
052b36d0 565.I r
566and
567.I s
ef3b232f
MW
568respectively \(en and
569.IR r \~\-\~1
052b36d0 570also has a large prime factor;
571.I q
572has similar properties.
573.IP
574The modulus
575.I n
576cannot be sensibly used as a shared parameter, since knowledge of
577corrssponding public and private exponents is sufficient to be able to
578factor the modulus and recover other users' private keys.
579.TP
eb31b00e 580.B "dh-param"
ef3b232f 581Generates parameters for use with the Diffie\(enHellman key exchange
052b36d0 582protocol, and many related systems, such as ElGamal encryption and
1476eebc 583signatures, and even DSA. (The separate DSA algorithm uses the
584generator described in FIPS186-1.)
585.IP
ef3b232f 586The Diffie\(enHellman parameters are a prime modulus
1476eebc 587.I p
052b36d0 588and a generator
589.I g
1476eebc 590of a subgroup of
591.BR Z / \c
592.IB p Z
593of order
594.IR q .
595The
052b36d0 596.B \-b
1476eebc 597option controls the size of the modulus
052b36d0 598.IR p ;
1476eebc 599the default size is 1024 bits.
600.IP
45c0fd36 601If no
052b36d0 602.I q
1476eebc 603size is selected using the
052b36d0 604.B \-B
ef3b232f 605option and the Lim\(enLee prime options are disabled, then
1476eebc 606.I p
607is chosen to be a `safe' prime (i.e.,
ef3b232f 608.IR p "\~= 2" q \~+\~1,
1476eebc 609with
610.I q
8404fd75 611prime). Finding safe primes takes a very long time. In this case, the
612value of
1476eebc 613.I g
614is fixed as 4.
615.IP
616If a size is chosen for
617.I q
ef3b232f 618and Lim\(enLee primes are not selected then the prime
1476eebc 619.I q
620is generated and
621.I p
622is chosen so that
ef3b232f 623.IR p \~\-\~1
1476eebc 624is a multiple of
625.IR q .
626.IP
627If the
628.B \-L
ef3b232f
MW
629option was given, Lim\(enLee primes are selected: the parameters are
630chosen such that
631.IR p "\~= 2\~" q \*(us0\*(ue
632.IR q \*(us1\*(ue
633.IR q \*(us2\*(ue\~...\~+\~1,
1476eebc 634where the
ef3b232f 635.IR q \*(us i \*(ue
1476eebc 636are primes at least as large as the setting given by the
637.B \-B
638option (or 256 bits, if no setting was given).
052b36d0 639.IP
1476eebc 640If the
45c0fd36 641.B \-K
ef3b232f 642option was given, KCDSA-style Lim\(enLee primes are selected: the
4e67e30b 643parameters are chosen such that
ef3b232f 644.IR p "\~= 2" qv \~+\~1,
4e67e30b 645where
45c0fd36 646.IR p,
4e67e30b
MW
647.I q
648and
649.I v
650are primes.
651.IP
652If the
1476eebc 653.B \-S
4e67e30b
MW
654or
655.B \-K
656options were given, the generator
1476eebc 657.I g
658is chosen to generate the subgroup of order
659.IR q \*(us0\*(ue;
660otherwise,
661.I g
662will generate the group of order
ef3b232f
MW
663.RI ( p "\~\-\~1)/2\~= " q "\*(us0\*(ue " q \*(us1\*(ue
664.IR q \*(us2\*(ue\~...
8404fd75 665.IP
666Finally, the
667.B \-C
668option can be given, in which case the parameters are taken directly
669from the provided group specification, which may either be the the name
670of one of the built-in groups (say
58507325 671.B "key show dh"
8404fd75 672for a list) or a triple
ef3b232f 673.RI ( p ,\~ q ,\~ g ).
8404fd75 674separated by commas. No random generation is done in this case: the
675given parameters are simply stored.
052b36d0 676.TP
677.B "dh"
ef3b232f 678Generates a public/private key pair for use with offline Diffie\(enHellman,
052b36d0 679ElGamal, DSA or similar discrete-logarithm-based systems. It selects a
680private key
ef3b232f 681.IR x \~<\~ q ,
052b36d0 682and computes the public key
ef3b232f 683.IR y "\~= " g \*(ss x "\*(se mod\~" p .
052b36d0 684.TP
685.B "dsa-param"
686Generates parameters for the DSA algorithm. DSA parameters are also
ef3b232f 687suitable for use with Diffie\(enHellman and ElGamal system.
052b36d0 688.IP
ef3b232f 689The main difference between DSA and Diffie\(enHellman parameter generation
052b36d0 690is thatthe DSA parameter generation
691algorithm creates a
692.I seed
693from which the parameters are derived, and, assuming that the SHA-1 hash
694function is strong, it's not feasible to construct a seed from which
695deliberately weak parameters are derived. The algorithm used is the one
696described in the DSA standard, FIPS\ 186, extended only to allow
697sequential search for a prime
698.I q
699and to allow arbitrary parameter sizes. The seed is stored,
700Base64-encoded, as the value of the attribute
701.BR seed .
702.IP
703The default lengths for
704.I p
705and
706.I q
707are 768 and 160 bits respectively, since the DSA standard specifies that
708.I q
709be 160 bits, and the choice of 768 bits for
710.I p
711gives commensurate security.
712.TP
713.B "dsa"
ef3b232f 714Generates a public/private key pair for DSA. As for Diffie\(enHellman
052b36d0 715keys, it selects a
716private key
ef3b232f 717.IR x \~<\~ q ,
052b36d0 718and computes the public key
ef3b232f 719.IR y "\~= " g \*(ss x "\*(se mod\~" p .
052b36d0 720.TP
721.B "bbs"
722Generates a public/private key pair for the Blum-Blum-Shub random-number
723generator, and the Blum-Goldwasser semantically-secure public-key
724encryption system.
725.IP
726The key components are prime numbers
727.I p
728and
729.IR q ,
ef3b232f 730both congruent to 3 (mod\~4), and their product
052b36d0 731.IR n .
732The public key is simply the modulus
733.IR n ;
734the factors
735.I p
736and
737.I q
738are the private key.
739.IP
740The key-generation algorithm ensures that the two primes
741.I p
742and
743.I q
744are
745.I strong
746(see the discussion of strong primes above, in the section on RSA keys),
747and that
ef3b232f 748.RI ( p \~\-\~1)/2
052b36d0 749and
ef3b232f 750.RI ( q \~\-\~1)/2
052b36d0 751are relatively prime, giving a maximum possible period length.
752.IP
753The key size requested by the
754.B \-b
755option determines the length of the modulus
756.IR n ;
757the default length is 1024 bits.
eb31b00e 758.TP
759.B "ec-param"
760Store an elliptic curve specification. If no explicit
761.I curve-spec
762is given (the
763.RB ` \-C '
764option) then a curve is chosen whose order is about the size given by the
765.RB ` \-b '
766option (default is 256 bits).
767.IP
768A
769.I curve-spec
770can be given explicitly (in which case
771.RB ` \-b '
772is ignored). It can either be the name of a built-in curve (say
58507325 773.B "key show ec"
eb31b00e 774for a list of curve names) or a full specification. The curve is
775checked for correctness and security according to the SEC1
776specification: failed checks cause a warning to be issued to standard
777error (though the program continues anyway). The check can be
778suppressed using the
779.RB ` \-q '
780option.
781.IP
782A curve specification consists of the following elements optionally
783separated by whitespace: a
784.IR "field type" ,
785which is one of
786.BR "prime" ,
787.BR "niceprime" ,
8404fd75 788.BR "binpoly" ,
789.or
790.BR "binnorm" ;
eb31b00e 791an optional
792.RB ` : ';
793the field modulus
794.IR p ;
8404fd75 795if the field type is
796.B binnorm
797then an optional
798.RB ` , '
799and the representation of the normal element \*(*b; an optional
20095408 800.RB ` ; ';
eb31b00e 801a
802.IR "curve type" ,
803which is one of
804.BR "prime" ,
805.BR "primeproj" ,
806.BR "bin" ,
807and
808.BR "binproj"
809(the `proj' types currently have much better performance);
810an optional
811.RB ` : ';
812the two field-element parameters
813.I a
814and
45c0fd36 815.IR b
eb31b00e 816which define the elliptic curve
817.IR E ,
818separated by an optional
819.RB ` , ';
820an optional
20095408 821.RB ` ; ';
45c0fd36 822the
eb31b00e 823.IR x -
824and
825.IR y -coordinates
826of the generator point
827.IR G ,
828separated by an optional
829.RB ` , ';
830an optional
831.RB ` : ';
832the order
833.I r
45c0fd36 834of the group generated by
eb31b00e 835.IR G ;
836an optional
837.RB ` * ';
45c0fd36 838and the
eb31b00e 839.I cofactor
840.I h
841=
842.RI # E / r .
843.TP
844.B "ec"
845Generate a private scalar and a corresponding public point on an
846elliptic curve. See
847.B ec-param
848above for how to specify elliptic curve parameter sets. The scalar
849.I x
850is chosen unformly between 0 and the curve order
851.IR r ;
852the public point is then
853.I x
854\(mu
855.IR G .
7532e25e 856.TP
fc2d44af
MW
857.B x25519
858Generate a private scalar and a corresponding public point on the
859(Montgomery-form) Curve25519 elliptic curve.
860The scalar is simply a random 256-bit string;
861the public key is the
862.IR x -coordinate
863of the corresponding point.
864.TP
643eb1bb
MW
865.B x448
866Generate a private scalar and a corresponding public point on the
867(Montgomery-form) Ed448-Goldilocks elliptic curve.
868The scalar is simply a random 256-bit string;
869the public key is the
870.IR x -coordinate
871of the corresponding point.
872.TP
d56fd9d1
MW
873.B ed25519
874Generate a private key and a corresponding public point on the
875(twisted Edwards-form) Curve25519 elliptic curve.
876The private key is simply a random 256-bit string,
877from which a scalar and secret prefix are derived;
878the public key is the compressed form of the corresponding point.
879.TP
c578d5d8
MW
880.B ed448
881Generate a private key and a corresponding public point on the
882(Edwards-form) Ed448-Goldilocks elliptic curve.
883The private key is simply a random 456-bit string,
884from which a scalar and secret prefix are derived;
885the public key is the compressed form of the corresponding point.
886.TP
7532e25e
MW
887.B empty
888Generate an empty key, with trivial contents.
889This is useful as a `parameters' key,
890carrying attributes to be applied to other keys
891if they don't require more detailed parameters.
052b36d0 892.SS "expire"
d03ab969 893Forces keys to immediately expire. An expired key is not chosen when a
894program requests a key by its type. The keys to expire are listed by
895their
052b36d0 896.IR tag s.
897.SS "delete"
d03ab969 898Deletes keys immediately. The keys to delete are listed by their
052b36d0 899.IR tag s.
d03ab969 900Be careful when deleting keys. It might be a better idea
901to expire keys rather than deleting them.
052b36d0 902.SS "tag"
903Sets, deletes or changes the tag attached to a key. The first tag or
904keyid names the key to be modified; the second, if present specifies the
905new tag to be set. If no second argument is given, the existing tag, if
d07dfe80 906any, is removed and no new tag is set. It is an error to set a tag
907which already exists on another key, unless you give the
908.B \-r
2face0de
MW
909option.
910.PP
911The following options are recognized.
912.TP
913.B "\-r, \-\-retag"
914Untag the existing key with the desired new tag, if any.
052b36d0 915.SS "setattr"
d03ab969 916Attaches attributes to a key. The key to which the attributes should be
917attached is given by its
052b36d0 918.IR tag .
d03ab969 919Each attribute has the form
920.IB name = value\fR.
921An attribute can be deleted by assigning it an empty value. Although
922the keyring file format is capable of representing an attribute with an
923empty value as distinct from a nonexistant attribute, this interface
924does not allow empty attributes to be set.
e9be047b 925.SS "getattr"
926Fetches a single attribute of a key. The key whose attribute is to be
927read is given by its
928.IR tag .
929The attribute's value is written to standard output followed by a
930newline. If the key or attribute is absent, a message is written to
931standard error and the program exits nonzero.
052b36d0 932.SS "comment"
933Sets, deletes or changes the comment attached to a key. The first
934argument is a key tag or keyid which names the key to be modified; the
935second, if present, is the new comment. If no second argument is given,
936the existing comment, if any, is removed, and no new comment is set.
937.SS "lock"
938Locks a key or key component using a passphrase. If the key is already
939locked, the existing passphrase is requested, and a new passphrase is
940set.
941.SS "unlock"
942Unlocks a passphrase-locked key or key component. If the key is not
943locked, an error is reported.
944.SS "list"
d03ab969 945Lists the keys in the keyring. A couple of options are supported:
946.TP
947.B "\-v, \-\-verbose"
948Increases the amount of information displayed for each key. Repeat for
949a greater effect.
950.TP
951.B "\-q, \-\-quiet"
952Decreases the amount of information displayed for each key. Each use
953cancels a
954.RB ` \-v '
955option.
c9e31e42 956.TP
957.B "\-u, \-\-utc"
958Display key expiry times as UTC rather than using the local time zone.
052b36d0 959.TP
960.BI "\-f, \-\-filter " filter
961Specifies a filter. Only keys and key components which match the filter
962are listed.
d03ab969 963.PP
964By default, a single line of output is generated for each, showing
965keyids, types, expiry and deletion dates, and comments. Additional
966.RB ` \-v '
967options show more information, such as the exact time of day for expiry
052b36d0 968and deletion, key attributes, and a dump of the actual key data. If the
d5d89214
MW
969verbosity level is sufficiently high, secret parts of keys are printed,
970and passphrases are requested to decrypt locked keys. Make sure nobody
971is looking over your shoulder when you do this!
052b36d0 972.SS "fingerprint"
973Reports a fingerprint (secure hash) on components of requested keys.
58507325 974The following options are supported:
052b36d0 975.TP
976.BI "\-f, \-\-filter " filter
977Specifies a filter. Only keys and key components which match the filter
978are fingerprinted. The default is to only fingerprint nonsecret
979components.
b817bfc6 980.TP
16810bbd
MW
981.BI "\-p, \-\-presentation " style
982Write fingerprints in the given
983.IR style .
984See below for a list of presentation styles.
985.TP
b817bfc6 986.BI "\-a, \-\-algorithm " hash
987Names the hashing algorithm. Run
58507325 988.B key show hash
b817bfc6 989for a list of hashing algorithms. The default is
990.BR rmd160 .
052b36d0 991.PP
992The keys to be fingerprinted are named by their tags or keyids given as
993command line arguments. If no key tags are given, all keys which match
b817bfc6 994the filter are fingerprinted. See
995.BR keyring (5)
996for a description of how key fingerprints are computed.
16810bbd
MW
997.PP
998The fingerprint may be shown in the following styles.
999.TP
1000.B hex
1001Lowercase hexadecimal, with groups of eight digits separated by hyphens
1002(`\-'). This is the default presentation style. (On input, colons are
1003also permitted as separators.)
1004.TP
1005.B base32
1006Lowercase Base32 encoding, without `=' padding, with groups of six
1007digits separated by colons (`:'). (On input, padding characters are
1008ignored.)
58507325 1009.SS "verify"
1010Check a key's fingerprint against a reference copy. The following
1011options are supported:
1012.TP
1013.BI "\-f, \-\-filter " filter
1014Specifies a filter. Only key components which match the filter are
1015hashed. The default is to only fingerprint nonsecret components. An
1016error is reported if no part of the key matches.
1017.TP
16810bbd
MW
1018.BI "\-p, \-\-presentation " style
1019Expect the
1020.I fingerprint
1021to be in the given presentation
1022.IR style .
1023These match the styles produced by the
1024.B fingerprint
1025command described above.
1026.TP
58507325 1027.BI "\-a, \-\-algorithm " hash
1028Names the hashing algorithm. Run
1029.B key show hash
1030for a list of hashing algorithms. The default is
1031.BR rmd160 .
1032.PP
16810bbd
MW
1033The fingerprint should be provided in the form printed by the
1034.B fingerprint
1035command, using the same presentation
1036.IR style .
1037A little flexibility is permitted: separators may be placed anywhere (or
1038not at all) and are ignored; whitespace is permitted and ignored; and
1039case is ignored in presentation styles which don't make use of both
1040upper- and lower-case characters.
052b36d0 1041.SS "tidy"
d03ab969 1042Simply reads the keyring from file and writes it back again. This has
1043the effect of removing any deleted keys from the file.
052b36d0 1044.SS "extract"
1045Writes a selection of keys to a file. An option is supported:
1046.TP
1047.BI "\-f, \-\-filter " filter
1048Specifies a filter. Only keys and key components which match the filter
1049are written.
1050.PP
1051Keys extracted are written to the file named by the first argument,
d03ab969 1052which may be
1053.RB ` \- '
1054to designate standard output. The keys to extract are listed by their
052b36d0 1055tags; if no tags are given, all keys which match the filter are
1056extracted. The output is a valid keyring file.
1057.SS "merge"
d03ab969 1058Merges the keys from the named
1059.IR file ,
1060which may be
1061.RB ` \- '
1062to designate standard input, with the keyring. Keys already in the
1063keyring are not overwritten: you must explicitly remove them first if
1064you want them to be replaced during the merge.
d03ab969 1065.SH "SEE ALSO"
1066.BR keyring (5).
1067.SH AUTHOR
f387fcb1 1068Mark Wooding, <mdw@distorted.org.uk>