31 .TH key 1 "5 June 1999" "Straylight/Edgeware" "Catacomb cryptographic library"
33 key \- simple key management system
149 command performs useful operations on Catacomb keyring files. It
150 provides a number of subcommands, by which the various operations may be
153 Before the command name,
155 may be given. The following global options are supported:
157 .BR "\-h, \-\-help " [ \fIcommand ...]
158 Writes a brief summary of
160 various options to standard output, and
161 returns a successful exit status. With command names, gives help on
164 .B "\-v, \-\-version"
165 Writes the program's version number to standard output, and returns a
166 successful exit status.
169 Writes a very terse command line summary to standard output, and returns
170 a successful exit status.
172 .BI "\-k, \-\-keyring " file
173 Names the keyring file which
175 is to process. The default keyring, used if this option doesn't specify
176 one, is the file named
178 in the current directory. The keyring must be stored in a regular file:
179 pipes, sockets, devices etc. are not allowed.
182 program attempts to lock the keyring before accessing it, using
184 locking. It will however time out after a short while (10 seconds) and
187 In addition to the actual key data itself, a Catacomb key has a number
188 of other pieces of information attached to it:
191 Every key has a 32-bit identifying number, written in hexadecimal.
192 Keyids are not actually related to the key contents: they're generated
193 randomly. Applications use keyids to refer to specific keys; users are
194 probably better off with tags and types. A
196 key cannot be looked up by keyid.
199 A key's tag is a unique string which can be used by users and
200 applications to identify the key. Tag strings may not contain spaces,
203 key cannot be looked up by tag. Whenever a tag name is wanted, a hex
204 keyid or key type string can be given instead.
207 A key's type string describes what the key may be used for. The type
208 string is arbitrary, except that it may not contain whitespace
209 characters, dots or colons. Applications use key types to obtain an
210 arbitrary but suitable key for some purpose. An
212 key cannot be looked up by type, but may be looked up by keyid or tag.
215 There are a number of different ways in which keys can be represented,
216 according to the uses to which the key will be put. Most symmetric
219 keys. Keys used with number-theoretic systems (like most common
220 public-key systems) use
221 .I "multiprecision integer"
222 keys. Elliptic curve systems use
224 keys, which are either a pair of integers representing field elements,
225 or a `point at infinity'. Algorithms which require several key
226 constituents (again, like most public-key systems) use
228 keys, which consist of a collection of named parts. It's possible to
231 as a key, though this is usually done as a component of a structured
232 key. Finally, keys (including structured keys) can be encrypted.
235 Keys and key components may be selected by a filter expression, a
236 sequence of flag names separated by commas. Flags are:
244 (describing the key encoding);
250 (describing the category of key);
254 (whether the key should be erased from memory after use); and
258 (whether the key is safe to divulge).
261 A key component may be identified by the key's tag (or keyid, or type).
262 Subcomponents of structured keys are identified by following the tag by
263 a dot and the name of the subcomponent.
266 Most keys expire after a certain amount of time. Once a key has
267 expired, it will no longer be chosen as a result of a lookup by key
268 type. However, it is not deleted until its deletion time is also
272 A key's deletion time is the latest expiry time of any of the objects
273 which require that key. For example, a key used for authenticating
274 cryptographic cookies should have its deletion time set to the longest
275 expiry time of any of the cookies it can authenticate. Once a key's
276 deletion time is passed, it can no longer be referred to by
277 applications, and will be removed from the keyring next time it's
281 A key may be given a comment when it's created. The comment is for the
282 benefit of users, and isn't interpreted by applications at all.
286 A key has zero or more name/value pairs. The names and values are
287 arbitrary strings, except that they may not contain null bytes. Some
288 attributes may have meaning for particular applications or key types;
289 others may be assigned global meanings in future.
290 .SH "COMMAND REFERENCE"
294 command behaves exactly as the
296 option. With no arguments, it shows an overview of
298 options; with arguments, it describes the named subcommands.
302 command prints various lists of tokens understood by
304 With no arguments, it prints all of the lists; with arguments, it prints
305 just the named lists, in order. The recognized lists can be enumerated
310 command. The lists are as follows.
313 The lists which can be enumerated by the
318 The hash functions which can be used with the
325 The built-in elliptic curves which can be used with the
330 The built-in Diffie\(enHellman groups which can be used with the
335 The key-generation algorithms which are acceptable to the
342 The pseudorandom generators which are acceptable to the
349 Fingerprint presentation styles, as used by the
357 command creates a new key and adds it to the keyring. The command
358 accepts the following options:
360 .BI "\-a, \-\-algorithm " alg
361 Selects a key generation algorithm. The default algorithm is
363 the different algorithms are described below. The command
365 lists the recognized key-generation algorithms.
367 .BI "\-b, \-\-bits " bits
368 The length of the key to generate, in bits. The default, if this option
369 is not supplied, depends on the key-generation algorithm.
371 .BI "\-B, \-\-qbits " bits
372 The length of the subsidiary key or parameter, in bits. Not all
373 key-generation algorithms have a subsidiary key size.
375 .BI "\-p, \-\-parameters " tag
376 Selects a key containing parameter values to copy.
377 A new key also inherits attributes from its parameter key.
379 .BI "\-A, \-\-seedalg " seed-alg
380 Use the deterministic random number generator algorithm
382 to generate the key. Use
388 options; without one of these,
390 has no effect. The default algorithm is
394 shows a list of recognized seeding algorithms. The seeding algorithm
395 used to generate a key is recorded as the key's
399 .BI "\-s, \-\-seed " seed
400 Generate the key deterministically using the given
402 which should be a Base64-encoded binary string. This is mainly useful
403 for parameters keys (types
407 to demonstrate that a set of parameters has been generated in an honest
410 generation algorithm can be used to generate
412 keys as required by FIPS186. The requested seed is recorded,
413 Base64-encoded, as the new key's
417 .BI "\-n, \-\-newseed " bits
418 Generate a new seed, with the given length in
420 The generated seed is recorded, Base64-encoded, as the new key's
424 .BI "\-e, \-\-expire " expire
425 The expiry date for the generated key. This may be the string
427 if the key should never expire automatically, or any date acceptable to
430 library function. Briefly,
432 understands absolute dates such as
435 .RB ` "August 2nd, 1999" ',
436 and (perhaps more usefully) relative dates such as
438 The default is to allow a 2 week expiry, which isn't useful.
440 .BI "\-c, \-\-comment " comment
441 Sets a comment for the key. The default is not to attach a comment.
443 .BI "\-C, \-\-curve " curve-spec
444 Use the elliptic curve described by
446 when generating elliptic curve parameters.
448 .BI "\-t, \-\-tag " tag
449 Selects a tag string for the key. The default is not to set a tag. It
450 is an error to select a tag which already exists.
455 option is given, remove this tag from any key which already has it.
457 .BI "\-R, \-\-rand-id " tag
458 Selects the key to use for the random number generator. Catacomb's
459 random number generator can be
461 so that, even if the inputs to the generator are compromised, knowledge
462 of the key is also necessary to be able to predict the output. By
463 default, the latest-expiring key with type
465 is used, if present; if not, no key is used.
468 Requests that the secret parts of the newly-generated key be encrypted
472 Suppresses the progress indication which is usually generated while
473 time-consuming key generation tasks are being performed.
475 .BI "\-L, \-\-lim-lee"
476 When generating Diffie\(enHellman parameters, generate a Lim\(enLee
477 prime rather than a random (or safe) prime. See the details on
478 Diffie\(enHellman key generation below.
481 When generating Diffie\(enHellman parameters, generate a KCDSA-style
482 Lim\(enLee prime rather than a random (or safe) prime. See the details
483 on Diffie\(enHellman key generation below.
485 .BI "\-S, \-\-subgroup"
486 When generating Diffie\(enHellman parameters with a Lim\(enLee prime,
487 choose a generator of a prime-order subgroup rather than a subgroup of
489 .RI ( p "\ \-\ 1)/2."
491 The key's type is given by the required
493 argument. Following the type are zero or more attributes, which are
494 attached to the key in the same way as for the
498 The key-generation algorithms supported are as follows:
501 Generates a plain binary key of the requested length. If the requested
502 key length is not a multiple of eight, the high-order bits of the first
503 octet of the key are zeroed. The default key length is 128 bits.
506 Generates a DES key, with parity bits. The key length must be 56, 112
507 or 168; the default is 56. The low-order bit of each octet is ignored by
508 the DES algorithm; it is used to give each octet odd parity.
511 Generates a public/private key pair for use with the RSA algorithm.
513 The key components are
517 a pair of prime numbers;
526 the private exponent, chosen such that
529 .RI lcm( p "\~\-\~1, " q \~\-\~1));
530 and some other values useful for optimizing private-key operations:
531 .IR q "\*(ss\-1\*(se mod " p ,
532 .IR d "\~mod " p \~\-\~1,
534 .IR d "\~mod " q \~\-\~1.
539 constitute the public key; the rest must be kept secret. The key size
542 option determines the size of the modulus
544 the default is 1024 bits.
546 The key generation algorithm chooses
556 have large prime factors \(en call them
560 respectively \(en and
562 also has a large prime factor;
564 has similar properties.
568 cannot be sensibly used as a shared parameter, since knowledge of
569 corrssponding public and private exponents is sufficient to be able to
570 factor the modulus and recover other users' private keys.
573 Generates parameters for use with the Diffie\(enHellman key exchange
574 protocol, and many related systems, such as ElGamal encryption and
575 signatures, and even DSA. (The separate DSA algorithm uses the
576 generator described in FIPS186-1.)
578 The Diffie\(enHellman parameters are a prime modulus
589 option controls the size of the modulus
591 the default size is 1024 bits.
595 size is selected using the
597 option and the Lim\(enLee prime options are disabled, then
599 is chosen to be a `safe' prime (i.e.,
600 .IR p "\~= 2" q \~+\~1,
603 prime). Finding safe primes takes a very long time. In this case, the
608 If a size is chosen for
610 and Lim\(enLee primes are not selected then the prime
621 option was given, Lim\(enLee primes are selected: the parameters are
623 .IR p "\~= 2\~" q \*(us0\*(ue
625 .IR q \*(us2\*(ue\~...\~+\~1,
628 are primes at least as large as the setting given by the
630 option (or 256 bits, if no setting was given).
634 option was given, KCDSA-style Lim\(enLee primes are selected: the
635 parameters are chosen such that
636 .IR p "\~= 2" qv \~+\~1,
648 options were given, the generator
650 is chosen to generate the subgroup of order
654 will generate the group of order
655 .RI ( p "\~\-\~1)/2\~= " q "\*(us0\*(ue " q \*(us1\*(ue
656 .IR q \*(us2\*(ue\~...
660 option can be given, in which case the parameters are taken directly
661 from the provided group specification, which may either be the the name
662 of one of the built-in groups (say
664 for a list) or a triple
665 .RI ( p ,\~ q ,\~ g ).
666 separated by commas. No random generation is done in this case: the
667 given parameters are simply stored.
670 Generates a public/private key pair for use with offline Diffie\(enHellman,
671 ElGamal, DSA or similar discrete-logarithm-based systems. It selects a
674 and computes the public key
675 .IR y "\~= " g \*(ss x "\*(se mod\~" p .
678 Generates parameters for the DSA algorithm. DSA parameters are also
679 suitable for use with Diffie\(enHellman and ElGamal system.
681 The main difference between DSA and Diffie\(enHellman parameter generation
682 is thatthe DSA parameter generation
685 from which the parameters are derived, and, assuming that the SHA-1 hash
686 function is strong, it's not feasible to construct a seed from which
687 deliberately weak parameters are derived. The algorithm used is the one
688 described in the DSA standard, FIPS\ 186, extended only to allow
689 sequential search for a prime
691 and to allow arbitrary parameter sizes. The seed is stored,
692 Base64-encoded, as the value of the attribute
695 The default lengths for
699 are 768 and 160 bits respectively, since the DSA standard specifies that
701 be 160 bits, and the choice of 768 bits for
703 gives commensurate security.
706 Generates a public/private key pair for DSA. As for Diffie\(enHellman
710 and computes the public key
711 .IR y "\~= " g \*(ss x "\*(se mod\~" p .
714 Generates a public/private key pair for the Blum-Blum-Shub random-number
715 generator, and the Blum-Goldwasser semantically-secure public-key
718 The key components are prime numbers
722 both congruent to 3 (mod\~4), and their product
724 The public key is simply the modulus
732 The key-generation algorithm ensures that the two primes
738 (see the discussion of strong primes above, in the section on RSA keys),
743 are relatively prime, giving a maximum possible period length.
745 The key size requested by the
747 option determines the length of the modulus
749 the default length is 1024 bits.
752 Store an elliptic curve specification. If no explicit
756 option) then a curve is chosen whose order is about the size given by the
758 option (default is 256 bits).
762 can be given explicitly (in which case
764 is ignored). It can either be the name of a built-in curve (say
766 for a list of curve names) or a full specification. The curve is
767 checked for correctness and security according to the SEC1
768 specification: failed checks cause a warning to be issued to standard
769 error (though the program continues anyway). The check can be
774 A curve specification consists of the following elements optionally
775 separated by whitespace: a
791 and the representation of the normal element \*(*b; an optional
801 (the `proj' types currently have much better performance);
804 the two field-element parameters
808 which define the elliptic curve
810 separated by an optional
818 of the generator point
820 separated by an optional
826 of the group generated by
837 Generate a private scalar and a corresponding public point on an
840 above for how to specify elliptic curve parameter sets. The scalar
842 is chosen unformly between 0 and the curve order
844 the public point is then
850 Generate a private scalar and a corresponding public point on the
851 (Montgomery-form) Curve25519 elliptic curve.
852 The scalar is simply a random 256-bit string;
853 the public key is the
855 of the corresponding point.
858 Generate a private key and a corresponding public point on the
859 (twisted Edwards-form) Curve25519 elliptic curve.
860 The private key is simply a random 256-bit string,
861 from which a scalar and secret prefix are derived;
862 the public key is the compressed form of the corresponding point.
865 Generate an empty key, with trivial contents.
866 This is useful as a `parameters' key,
867 carrying attributes to be applied to other keys
868 if they don't require more detailed parameters.
870 Forces keys to immediately expire. An expired key is not chosen when a
871 program requests a key by its type. The keys to expire are listed by
875 Deletes keys immediately. The keys to delete are listed by their
877 Be careful when deleting keys. It might be a better idea
878 to expire keys rather than deleting them.
880 Sets, deletes or changes the tag attached to a key. The first tag or
881 keyid names the key to be modified; the second, if present specifies the
882 new tag to be set. If no second argument is given, the existing tag, if
883 any, is removed and no new tag is set. It is an error to set a tag
884 which already exists on another key, unless you give the
886 option, which removes the tag first.
888 Attaches attributes to a key. The key to which the attributes should be
889 attached is given by its
891 Each attribute has the form
893 An attribute can be deleted by assigning it an empty value. Although
894 the keyring file format is capable of representing an attribute with an
895 empty value as distinct from a nonexistant attribute, this interface
896 does not allow empty attributes to be set.
898 Fetches a single attribute of a key. The key whose attribute is to be
901 The attribute's value is written to standard output followed by a
902 newline. If the key or attribute is absent, a message is written to
903 standard error and the program exits nonzero.
905 Sets, deletes or changes the comment attached to a key. The first
906 argument is a key tag or keyid which names the key to be modified; the
907 second, if present, is the new comment. If no second argument is given,
908 the existing comment, if any, is removed, and no new comment is set.
910 Locks a key or key component using a passphrase. If the key is already
911 locked, the existing passphrase is requested, and a new passphrase is
914 Unlocks a passphrase-locked key or key component. If the key is not
915 locked, an error is reported.
917 Lists the keys in the keyring. A couple of options are supported:
919 .B "\-v, \-\-verbose"
920 Increases the amount of information displayed for each key. Repeat for
924 Decreases the amount of information displayed for each key. Each use
930 Display key expiry times as UTC rather than using the local time zone.
932 .BI "\-f, \-\-filter " filter
933 Specifies a filter. Only keys and key components which match the filter
936 By default, a single line of output is generated for each, showing
937 keyids, types, expiry and deletion dates, and comments. Additional
939 options show more information, such as the exact time of day for expiry
940 and deletion, key attributes, and a dump of the actual key data. If the
941 verbosity level is sufficiently high, passphrases are requested to
942 decrypt locked keys. Make sure nobody is looking over your shoulder
945 Reports a fingerprint (secure hash) on components of requested keys.
946 The following options are supported:
948 .BI "\-f, \-\-filter " filter
949 Specifies a filter. Only keys and key components which match the filter
950 are fingerprinted. The default is to only fingerprint nonsecret
953 .BI "\-p, \-\-presentation " style
954 Write fingerprints in the given
956 See below for a list of presentation styles.
958 .BI "\-a, \-\-algorithm " hash
959 Names the hashing algorithm. Run
961 for a list of hashing algorithms. The default is
964 The keys to be fingerprinted are named by their tags or keyids given as
965 command line arguments. If no key tags are given, all keys which match
966 the filter are fingerprinted. See
968 for a description of how key fingerprints are computed.
970 The fingerprint may be shown in the following styles.
973 Lowercase hexadecimal, with groups of eight digits separated by hyphens
974 (`\-'). This is the default presentation style. (On input, colons are
975 also permitted as separators.)
978 Lowercase Base32 encoding, without `=' padding, with groups of six
979 digits separated by colons (`:'). (On input, padding characters are
982 Check a key's fingerprint against a reference copy. The following
983 options are supported:
985 .BI "\-f, \-\-filter " filter
986 Specifies a filter. Only key components which match the filter are
987 hashed. The default is to only fingerprint nonsecret components. An
988 error is reported if no part of the key matches.
990 .BI "\-p, \-\-presentation " style
993 to be in the given presentation
995 These match the styles produced by the
997 command described above.
999 .BI "\-a, \-\-algorithm " hash
1000 Names the hashing algorithm. Run
1002 for a list of hashing algorithms. The default is
1005 The fingerprint should be provided in the form printed by the
1007 command, using the same presentation
1009 A little flexibility is permitted: separators may be placed anywhere (or
1010 not at all) and are ignored; whitespace is permitted and ignored; and
1011 case is ignored in presentation styles which don't make use of both
1012 upper- and lower-case characters.
1014 Simply reads the keyring from file and writes it back again. This has
1015 the effect of removing any deleted keys from the file.
1017 Writes a selection of keys to a file. An option is supported:
1019 .BI "\-f, \-\-filter " filter
1020 Specifies a filter. Only keys and key components which match the filter
1023 Keys extracted are written to the file named by the first argument,
1026 to designate standard output. The keys to extract are listed by their
1027 tags; if no tags are given, all keys which match the filter are
1028 extracted. The output is a valid keyring file.
1030 Merges the keys from the named
1034 to designate standard input, with the keyring. Keys already in the
1035 keyring are not overwritten: you must explicitly remove them first if
1036 you want them to be replaced during the merge.
1040 Mark Wooding, <mdw@distorted.org.uk>