chiark / gitweb /
progs/*.1: Mention the default hash for `ed25519',
[catacomb] / progs / catsign.1
CommitLineData
fa54fe1e 1.\" -*-nroff-*-
2.de VS
3.sp 1
4.RS
5.nf
6.ft B
7..
8.de VE
9.ft R
10.fi
11.RE
12.sp 1
13..
14.ie t \{\
15. if \n(.g \{\
16. fam P
17. \}
18.\}
19.de hP
20.IP
21.ft B
22\h'-\w'\\$1\ 'u'\\$1\ \c
23.ft P
24..
25.ie t .ds o \(bu
26.el .ds o o
27.TH catsign 1 "17 March 2005" "Straylight/Edgeware" "Catacomb cryptographic library"
28.SH NAME
29catsign \- sign and verify messages
30.SH SYNOPSIS
31.B catsign
32.RB [ \-k
33.IR keyring ]
34.I command
35.PP
36where
37.I command
38is one of:
39.PP
40.B help
41.RI [ command ...]
42.br
43.B show
44.RI [ item ...]
45.br
46.B sign
cd6eca43 47.RB [ \-adptC ]
fa54fe1e 48.RB [ \-k
49.IR tag ]
50.RB [ \-f
51.IR format ]
52.RB [ \-o
53.IR output ]
54.RI [ file ]
55.br
56.B verify
cd6eca43 57.RB [ \-apquvC ]
fa54fe1e 58.RB [ \-k
59.IR tag ]
60.RB [ \-f
61.IR format ]
9cea6911 62.RB [ \-t
63.IR time ]
fa54fe1e 64.br
e51127d5 65\h'8n'
fa54fe1e 66.RB [ \-o
67.IR output ]
68.RI [ file
69.RI [ message ]]
70.br
71.B info
72.RB [ \-a ]
73.RB [ \-f
74.IR format ]
75.RI [ file ]
76.br
77.B format
cd6eca43 78.RB [ \-apuABDET ]
fa54fe1e 79.RB [ \-f
80.IR format ]
81.RB [ \-F
82.IR format ]
83.br
e51127d5 84\h'8n'
fa54fe1e 85.RB [ \-m
86.IR file ]
87.RB [ \-o
88.IR output ]
89.RI [ file
90.RI [ message ]]
91.br
92.B encode
cd6eca43 93.RB [ \-p ]
fa54fe1e 94.RB [ \-f
95.IR format ]
96.RB [ \-b
97.IR boundary ]
98.RB [ \-o
99.IR output ]
100.RI [ file ]
101.br
102.B decode
cd6eca43 103.RB [ \-p ]
fa54fe1e 104.RB [ \-f
105.IR format ]
106.RB [ \-b
107.IR boundary ]
108.RB [ \-o
109.IR output ]
110.RI [ file ]
111.SH "DESCRIPTION"
112The
113.B catsign
114command signs and verifies messages. It also works as a simple PEM
115encoder and decoder. It provides a number of subcommands, by which the
116various operations may be carried out.
117.SS "Global options"
118Before the command name,
119.I "global options"
120may be given. The following global options are supported:
121.TP
122.BR "\-h, \-\-help " [ \fIcommand ...]
123Writes a brief summary of
124.BR catsign 's
125various options to standard output, and returns a successful exit
126status. With command names, gives help on those commands.
127.TP
128.B "\-v, \-\-version"
129Writes the program's version number to standard output, and returns a
130successful exit status.
131.TP
132.B "\-u, \-\-usage"
133Writes a very terse command line summary to standard output, and returns
134a successful exit status.
135.TP
136.BI "\-k, \-\-keyring " file
137Names the keyring file which
138.B key
139is to process. The default keyring, used if this option doesn't specify
140one, is the file named
141.B keyring
142in the current directory. See
143.BR key (1)
144and
145.BR keyring (5)
146for more details about keyring files.
147.SH "KEY SETUP"
148Algorithms to be used with a particular key are described by attributes
149on the key, or its type. The
150.B catsign
151command deals with signing keys. (Note that
152.B catsign
45c0fd36 153uses signing keys in the same way as
fa54fe1e 154.BR catcrypt (1).)
155.PP
156A
157.I sigalgspec
158has the form
159.IR sig \c
160.RB [ / \c
161.IR hash ].
162If a
163.B sig
164attribute is present on the key, then it must have this form; otherwise,
165the key's type must have the form
166.BI ccsig- \c
167.IR sigalgspec .
168Algorithm selections are taken from appropriately-named attributes, or,
169failing that, from the
170.IR sigalgspec .
171.PP
172The signature algorithm is chosen according to the setting of
173.I sig
174as follows. Run
175.B catsign show sig
176for a list of supported signature algorithms.
177.TP
178.B rsapkcs1
179This is almost the same as the RSASSA-PKCS1-v1_5 algorithm described in
180RFC3447; the difference is that the hash is left bare rather than being
45c0fd36 181wrapped in a DER-encoded
fa54fe1e 182.B DigestInfo
183structure. This doesn't affect security since the key can only be used
184with the one hash function anyway, and dropping the DER wrapping permits
185rapid adoption of new hash functions. Regardless, use of this algorithm
186is not recommended, since the padding method has been shown vulnerable
187to attack. Use the
188.B rsa
189algorithm of the
190.B key add
191command (see
192.BR key (1))
193to generate the key.
194.TP
195.B rsapss
196This is the RSASSA-PSS algorithm described in RFC3447. It is the
197preferred RSA-based signature scheme. Use the
198.B rsa
199algorithm of the
200.B key add
201command (see
202.BR key (1))
203to generate the key.
204.TP
205.B dsa
45c0fd36 206This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
fa54fe1e 207.B dsa
208algorithm of the
209.B key add
210command (see
211.BR key (1))
212to generate the key.
213.TP
214.B ecdsa
215This is the ECDSA algorithm described in ANSI X9.62 and FIPS180-2. Use
216the
217.B ec
218algorithm of the
219.B key add
220command (see
221.BR key (1))
222to generate the key.
223.TP
224.B kcdsa
225This is the revised KCDSA (Korean Certificate-based Digital Signature
226Algorithm) described in
227.I The Revised Version of KCDSA
228.RB ( http://dasan.sejong.ac.kr/~chlim/pub/kcdsa1.ps ).
229Use the
230.B dh
231algorithm of the
232.B key add
233command with the
234.B \-LS
235options (see
236.BR key (1))
237to generate the key.
238.TP
239.B eckcdsa
240This is an unofficial elliptic-curve analogue of the KCDSA algorithm.
241Use the
242.B ec
243algorithm of the
244.B key add
245command (see
246.BR key (1))
247to generate the key.
02dfbd5b 248.TP
d56fd9d1
MW
249.B ed25519
250This is Bernstein, Duif, Lange, Schwabe, and Yang's Ed25519 algorithm.
251More specifically, this is HashEd25519
252using the selected
253.B hash
254algorithm \(en by default
255.BR sha512 .
256Use the
257.B ed25519
258algorithm of the
259.B key add
260command
261(see
262.BR key (1))
263to generate the key.
264.TP
02dfbd5b
MW
265.B mac
266This uses a symmetric message-authentication algorithm rather than a
267digital signature. The precise message-authentication scheme used is
268determined by the
269.B mac
270attribute on the key, which defaults to
271.IB hash -hmac
272if unspecified. Use the
273.B binary
274algorithm of the
275.B key add
276command (see
277.BR key (1))
278to generate the key.
fa54fe1e 279.PP
280As well as the signature algorithm itself, a hash function is used.
281This is taken from the
282.B hash
283attribute on the key, or, failing that, from the
284.I hash
285specified in the
286.IR sigalgspec ,
287or, if that is absent, determined by the signature algorithm as follows.
288.hP \*o
289For
290.BR rsapkcs1 ,
291.BR rsapss ,
292.BR dsa ,
293and
294.BR ecdsa ,
295the default hash function is
296.BR sha .
297.hP \*o
298For
45c0fd36 299.BR kcdsa
fa54fe1e 300and
301.BR eckcdsa ,
302the default hash function is
303.BR has160 .
df8800f1
MW
304For
305.BR ed25519 ,
306the default hash function is
307.BR sha512 .
fa54fe1e 308.PP
309Run
310.B catsign show hash
311for a list of supported hash functions.
312.SH "ENCODINGS"
313Two encodings for the ciphertext are supported.
314.TP
315.B binary
316The raw format, which has the benefit of being smaller, but needs to be
317attached to mail messages and generally handled with care.
318.TP
319.B pem
320PEM-encapsulated Base-64 encoded text. This format can be included
321directly in email and picked out again automatically; but there is a
3224-to-3 data expansion as a result.
323.SH "SIGNATURE FORMATS"
324There are two basic signature formats understood by
325.BR catsign .
326.hP \*o
327Embedded signatures include (embed) the message they sign; hence they're
328complete in and of themselves. The
329.B catsign
330program extracts the message during signature verification.
331.hP \*o
332Detached signatures are separate from the messages they sign, and both
333the original file and the signature are required for a successful
334verification.
335.PP
336Another important distinction is whether the message data is considered
337to be plain text or raw binary data.
338.hP \*o
339When dealing with plain text,
340.B catsign
341allows a limited quantity of leeway in the messages it processes. It
342ignores trailing whitespace on a line, including stray carriage-returns,
343which may appear if Windows boxes have had their way with the data. It
344also appends a final newline if there wasn't one before. In embedded
345signatures, the text is left unencoded, so that the message is readable.
346.hP \*o
347Binary files are preserved completely, and no variation whatever is
348permitted.
349.PP
350The
351.VS
352catsign format
353.VE
354command can convert between detached and embedded signatures; it cannot
355convert between binary and text mode signatures. (The data actually
356signed includes a flag saying whether the message is textual. The
357rationale here is that what looks like an ASCII space before a newline
358may be devastatingly significant in a binary data file, and if a message
359is signed as raw binary then no changes whatever should be allowed.)
360.SH "COMMAND REFERENCE"
361.SS help
362The
363.B help
364command behaves exactly as the
365.B \-\-help
366option. With no arguments, it shows an overview of
367.BR catsign 's
368options; with arguments, it describes the named subcommands.
369.SS show
370The
371.B show
372command prints various lists of tokens understood by
373.BR catsign .
374With no arguments, it prints all of the lists; with arguments, it prints
375just the named lists, in order. The recognized lists can be enumerated
376using the
377.VS
378catsign show list
379.VE
380command. The lists are as follows.
381.TP
382.B list
383The lists which can be enumerated by the
384.B show
385command.
386.TP
387.B sig
388The signature algorithms which can be used in a signing key's
389.B sig
390attribute.
391.TP
392.B hash
393The hash functions which can be used in a key's
394.B hash
395attribute.
396.TP
397.B enc
45c0fd36 398The encodings which can be applied to encrypted messages; see
fa54fe1e 399.B ENCODINGS
400above.
401.SS sign
402The
403.B sign
404command signs a message and writes out an appropriately-encoded
405signature. By default, it reads a message from standard input and
406writes the signature to standard output. If a filename argument is
407given, this file is read instead.
408.PP
409The following options are recognized.
410.TP
411.B "\-a, \-\-armour"
412Produce ASCII-armoured output. This is equivalent to specifying
413.BR "\-f pem" .
414The variant spelling
415.B "\-\-armor"
416is also accepted.
417.TP
418.B "\-b, \-\-binary"
419Read and sign the input as binary data. The default is to treat the
420input as text.
421.TP
422.B "\-d, \-\-detach"
423Produce a detached signature. The default is to produce a signature
424with embedded message.
425.TP
426.BI "\-f, \-\-format " format
427Produce output encoded according to
428.IR format .
429.TP
430.BI "\-k, \-\-key " tag
431Use the signing key named
432.I tag
433in the current keyring; the default key is
434.BR ccsig .
435.TP
436.BI "\-o, \-\-ouptut " file
437Write output to
438.I file
439rather than to standard output.
440.TP
cd6eca43
MW
441.BI "\-p, \-\-progress"
442Write a progress meter to standard error while processing large files.
443.TP
fa54fe1e 444.B "\-t, \-\-text"
445Read and sign the input as text. This is the default.
946c3f72 446.TP
447.B "\-C, \-\-nocheck"
448Don't check the private key for validity. This makes signing go much
449faster, but at the risk of using a duff key, and potentially leaking
450information about the private key.
fa54fe1e 451.SS verify
452The
453.B verify
454command checks a signature's validity, producing as output information
455about the signature and the signed message.
456.PP
457The first non-option argument is the name of the file containing the
45c0fd36 458signature data; this may be omitted or
fa54fe1e 459.RB ` \- '
460to indicate that the signature be read from standard input. The second
461non-option argument, if any, is the name of the file to read the message
462from, if the signature is detached. An error is reported if a message
463file is specified but the signature contains an embedded message
464already; if the signature is detached but no filename is given, then the
465message is expected on stdin (immediately after the signature, if any).
466.TP
467.B "\-a, \-\-armour"
468Read ASCII-armoured input. This is equivalent to specifying
469.BR "\-f pem" .
470The variant spelling
471.B "\-\-armor"
472is also accepted.
473.TP
474.B "\-b, \-\-buffer"
475Buffer the message until the signature is verified. This is forced on
476if output is to stdout, but is always available as an option.
477.TP
478.BI "\-f, \-\-format " format
479Read input encoded according to
480.IR format .
481.TP
482.B "\-v, \-\-verbose"
483Produce more verbose messages. See below for the messages produced
484during decryption. The default verbosity level is 1. (Currently this
485is the most verbose setting. This might not be the case always.)
21aac40c 486.TP
cd6eca43
MW
487.BI "\-p, \-\-progress"
488Write a progress meter to standard error while processing large files.
489.TP
fa54fe1e 490.B "\-q, \-\-quiet"
491Produce fewer messages.
492.TP
493.BI "\-k, \-\-key " tag
494Usually
495.B catsign
496uses the signature header to work out which key to use to verify a
497signature. Using this option causes verification to fail unless the
498signature header specifies the key named
499.IR tag .
500.TP
9cea6911 501.BI "\-t, \-\-freshtime " time
502Only accept signatures claiming to have been made more recently than
503.IR time .
504If
505.I time
506is
507.B always
508(the default) then any timestamp in the past is acceptable.
509.TP
fa54fe1e 510.B "\-u, \-\-utc"
511Show the datestamp in the signature in UTC rather than (your) local
512time. The synonym
513.B \-\-gmt
514is also accepted.
515.TP
516.BI "\-o, \-\-output " file
517Write the verified message to
518.IR file .
519The file is written in text or binary
520mode as appropriate. The default is to write the message to standard
521output unless verifying a detached signature, in which case nothing is
522written.
946c3f72 523.TP
524.B "\-C, \-\-nocheck"
525Don't check the public key for validity. This makes verification go
526much faster, but at the risk of using a duff key, and potentially
527accepting false signatures.
fa54fe1e 528.PP
529Output is written to standard output in a machine-readable format.
530Major problems cause the program to write a diagnostic to standard error
531and exit nonzero as usual. The quantity of output varies depending on
532the verbosity level and whether the message is also being written to
533standard output. Output lines begin with a keyword:
534.TP
535.BI "FAIL " reason
536An error prevented verification. The program will exit nonzero.
537.TP
538.BI "WARN " reason
539.B catsign
540encountered a situation which may or may not invalidate the
541verification.
542.TP
543.BI "OK " message
544Verification was successful. This is only produced if the message is
545being sent somewhere other than standard output.
546.TP
547.B "DATA"
548The message follows, starting just after the next newline character or
549sequence. This is only produced if the message is being written to
550standard output.
551.TP
552.BI "INFO " note
553Any other information.
554.PP
555The information written at the various verbosity levels is as follows.
556.hP 0.
557No output. Watch the exit status.
558.hP 1.
559All messages.
560.PP
561.B Warning!
7cb116b7
MW
562Unless the
563.B \-b
564option is set (which happens automatically if writing to standard
565output),
566.BR catsign 's
567output is
568.I not
569checked for authenticity until it has all been written. Even with
570.BR \-b ,
571output can fail midway for many reasons, and the resulting message may
45c0fd36 572therefore be truncated. Don't rely on the output being complete until
4224d0b9 573.B OK
574is printed or
fa54fe1e 575.B catsign verify
576exits successfully.
577.SS info
578The
579.B info
580command analyses a signature without verifying it, and prints
581interesting information about it. This might be useful for diagnostic
582purposes. No keys are needed for this operation, though you get more
583useful information if you have them.
584.PP
585If a non-option argument is given, and it is not
586.RB ` \- ',
587then it is taken to name the file containing the signature to parse;
588otherwise a signature is read from standard input.
589.PP
590The following options are recognized.
591.TP
592.B "\-a, \-\-armour"
593Read ASCII-armoured input. This is equivalent to specifying
594.BR "\-f pem" .
595The variant spelling
596.B "\-\-armor"
597is also accepted.
598.TP
599.BI "\-f, \-\-format " format
600Read input encoded according to
601.IR format .
602.TP
cd6eca43
MW
603.BI "\-p, \-\-progress"
604Write a progress meter to standard error while processing large files.
605.TP
fa54fe1e 606.B "\-u, \-\-utc"
607Show the datestamp in the signature in UTC rather than (your) local
608time. The synonym
609.B \-\-gmt
610is also accepted.
611.PP
612A description of the signature block is produced on standard output; it
613is mostly machine-readable. The first word on each line explains what
614kind of output it is.
615.TP
616.BI "BAD " message
617The signature data is invalid and cannot be parsed.
618.TP
619.BI "WARN " message
620Something is wrong with the data, but isn't fatal.
621.TP
622.BI "NOTE " message
623An environmental problem means that the information isn't as helpful as
624it might be. For example, the keyring file can't be opened, so we don't
625know whether the verification key is there.
626.TP
627.BI "INFO flags " flags
628Describes the flags set in the signature header. The
629.I flags
630are a list of flags, one per word, preceded by a
631.RB ` ! '
632if the flag is clear.
633.TP
634.BI "INFO expected-flags " flags
635If the PEM boundary string didn't match the actual signature data then
636this line is output, listing the expected flags and their settings.
637Problems with boundary mismatches can be resolved using the
638.B format
639command.
640.TP
641.BI "INFO date " yyyy "\-" mm "\-" dd " " hh ":" mm ":" ss " " tz
642Signature was (allegedly!) made at the given time and date. If the
643.B \-u
644option was given, this will be in UTC.
645.TP
646.BI "INFO key " tag
647Signature was (allegedly!) made using the key
648.IR tag ,
649which is present in the current keyring.
650.TP
651.BI "INFO unknown-key " keyid
652Signature was (allegedly!) made using the key with id
653.IR keyid
654which is not in the current keyring (or the keyring wasn't found).
655.SS format
656The
657.B format
658command translates signatures between the various supported formats.
659This is a (slightly) more complex operation than re-encoding, though it
660does not require any cryptographic operations.
661.PP
662The first non-option argument is the name of the file containing the
45c0fd36 663signature data; this may be omitted or
fa54fe1e 664.RB ` \- '
665to indicate that the signature be read from standard input. The second
666non-option argument, if any, is the name of the file to read the message
667from, if the signature is detached. An error is reported if a message
668file is specified but the signature contains an embedded message
669already; if the signature is detached but no filename is given, then the
670message is expected on stdin (immediately after the signature, if any).
671.PP
672The options follow a rough convention: options describing the input
673format are lower-case and options specifying the output format are
674upper-case. The following options are recognized.
0ac1f186 675.TP
676.BI "\-a, \-\-armour-in"
fa54fe1e 677Read ASCII-armoured input. This is equivalent to specifying
678.BR "\-f pem" .
679The variant spelling
680.B "\-\-armor"
681is also accepted.
0ac1f186 682.TP
cd6eca43
MW
683.BI "\-p, \-\-progress"
684Write a progress meter to standard error while processing large files.
685.TP
0ac1f186 686.BI "\-A, \-\-armour-out"
fa54fe1e 687Produce ASCII-armoured output. This is equivalent to specifying
688.BR "\-F pem" .
689The variant spelling
690.B "\-\-armor-out"
691is also accepted.
692.TP
693.B "\-D, \-\-detach"
694Produce a detached signature. This may be used to detach a signature
695from an embedded message.
696.TP
697.B "\-E, \-\-embed"
698Produce a signature with embedded message. This may be used to
699reattach a message to its detached signature.
700.TP
701.BI "\-f, \-\-format-in " format
702Read input encoded according to
703.IR format .
704.TP
705.BI "\-F, \-\-format-out " format
706Produce output encoded according to
707.IR format .
708.TP
709.BI "\-m, \-\-message " file
710Write the message to
711.IR file .
712If
713.I file
714is
715.RB ` \- '
716then write the message to standard output. Don't send the message and
717signature to the same place because it doesn't work.
718.TP
719.BI "\-o, \-\-output " file
720Write the signature to
721.IR file .
722If no
723.B \-m
724or
725.B \-o
726option is given, a signature is written to standard output.
e1cba07d 727.SS "encode"
728The
729.B encode
730command encodes an input file according to one of the encodings
731described above in
732.BR ENCODINGS .
45c0fd36 733The input is read from the
e1cba07d 734.I file
735given on the command line, or from standard input if none is specified.
736Options provided are:
737.TP
738.BI "\-f, \-\-format " format
739Produce output in
740.IR format .
741Run
65802cb1 742.B catsign show enc
e1cba07d 743for a list of encoding formats.
744.TP
745.BI "\-b, \-\-boundary " label
746Set the PEM boundary string to
747.IR label ;
748i.e., assuming we're encoding in PEM format, the output will have
749.BI "\-\-\-\-\-BEGIN " label "\-\-\-\-\-"
750at the top and
751.BI "\-\-\-\-\-END " label "\-\-\-\-\-"
752at the bottom. The default
753.I label
754is
755.BR MESSAGE .
756.TP
cd6eca43
MW
757.BI "\-p, \-\-progress"
758Write a progress meter to standard error while processing large files.
759.TP
e1cba07d 760.BI "\-o, \-\-output " file
761Write output to
762.I file
763instead of to standard output.
764.SS "decode"
765The
766.B decode
767command decodes an input file encoded according to one of the encodings
768described above in
769.BR ENCODINGS .
45c0fd36 770The input is read from the
e1cba07d 771.I file
772given on the command line, or from standard input if none is specified.
773Options provided are:
774.TP
775.BI "\-f, \-\-format " format
776Decode input in
777.IR format .
778Run
65802cb1 779.B catsign show enc
e1cba07d 780for a list of encoding formats.
781.TP
782.BI "\-b, \-\-boundary " label
783Set the PEM boundary string to
784.IR label ;
785i.e., assuming we're encoding in PEM format, start processing input
786between
787.BI "\-\-\-\-\-BEGIN " label "\-\-\-\-\-"
45c0fd36 788and
e1cba07d 789.BI "\-\-\-\-\-END " label "\-\-\-\-\-"
790lines. Without this option,
65802cb1 791.B catsign
e1cba07d 792will start reading at the first plausible boundary string, and continue
793processing until it reaches the matching end boundary.
794.TP
cd6eca43
MW
795.BI "\-p, \-\-progress"
796Write a progress meter to standard error while processing large files.
797.TP
e1cba07d 798.BI "\-o, \-\-output " file
799Write output to
800.I file
801instead of to standard output.
fa54fe1e 802.SH "BUGS"
803The trailing-whitespace deletion doesn't work for more than 32K of
804whitespace. I don't think this is a big problem, really.
805.PP
806The
807.B format
808command does something unhelpful if message and signature are sent to
809the same file.
810.SH "SEE ALSO"
811.BR key (1),
812.BR catcrypt (1),
813.BR dsig (1),
814.BR hashsum (1),
815.BR keyring (5).
816.SH AUTHOR
f387fcb1 817Mark Wooding, <mdw@distorted.org.uk>