progs/catcrypt.1: The default `cipher' depends on the bulk transform.
[catacomb] / progs / catcrypt.1
CommitLineData
c65df279 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 catcrypt 1 "30 September 2004" "Straylight/Edgeware" "Catacomb cryptographic library"
28.SH NAME
29catcrypt \- encrypt and decrypt messages
30.SH SYNOPSIS
31.B catcrypt
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 encrypt
cd6eca43 47.RB [ \-apC ]
c65df279 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 decrypt
cd6eca43 57.RB [ \-apqvC ]
c65df279 58.RB [ \-f
59.IR format ]
60.RB [ \-o
61.IR output ]
62.RI [ file ]
63.br
64.B encode
cd6eca43 65.RB [ \-p ]
c65df279 66.RB [ \-f
67.IR format ]
68.RB [ \-b
69.IR boundary ]
70.RB [ \-o
71.IR output ]
72.RI [ file ]
73.br
fa54fe1e 74.B decode
cd6eca43 75.RB [ \-p ]
c65df279 76.RB [ \-f
77.IR format ]
78.RB [ \-b
79.IR boundary ]
80.RB [ \-o
81.IR output ]
82.RI [ file ]
83.SH "DESCRIPTION"
84The
85.B catcrypt
86command encrypts and decrypts messages. It also works as a simple PEM
87encoder and decoder. It provides a number of subcommands, by which the
88various operations may be carried out.
89.SS "Global options"
90Before the command name,
91.I "global options"
92may be given. The following global options are supported:
93.TP
94.BR "\-h, \-\-help " [ \fIcommand ...]
95Writes a brief summary of
96.BR catcrypt 's
97various options to standard output, and returns a successful exit
98status. With command names, gives help on those commands.
99.TP
100.B "\-v, \-\-version"
101Writes the program's version number to standard output, and returns a
102successful exit status.
103.TP
104.B "\-u, \-\-usage"
105Writes a very terse command line summary to standard output, and returns
106a successful exit status.
107.TP
108.BI "\-k, \-\-keyring " file
109Names the keyring file which
110.B key
111is to process. The default keyring, used if this option doesn't specify
112one, is the file named
113.B keyring
114in the current directory. See
115.BR key (1)
116and
117.BR keyring (5)
118for more details about keyring files.
119.SH "KEY SETUP"
120Algorithms to be used with a particular key are described by attributes
121on the key, or its type. The
122.B catcrypt
fa54fe1e 123command deals with both signing and key-encapsulation keys. (Note that
124.B catcrypt
45c0fd36 125uses signing keys in the same way as
fa54fe1e 126.BR catsign (1).)
c65df279 127.SS "Key-encapsulation keys"
128(Key encapsulation is a means of transmitting a short, known, random
129secret to a recipient. It differs from encryption in technical ways
130which are largely uninteresting at this point.)
131.PP
132A
133.I kemalgspec
134has the syntax
135.IR kem \c
136.RB [ / \c
66ff643c
MW
137.IR bulk \c
138.RB [ \- \c
139.IR cipher ] \c
140.RB [ / \c
141.IR hash ]]
142or
143.IR kem \c
144.RB [ / \c
c65df279 145.IR cipher \c
146.RB [ / \c
147.IR hash ]].
148If a
149.B kem
150attribute is present on the key, then it must have this form; otherwise,
151the key's type must have the form
152.BR cckem- \c
153.IR kemalgspec .
154Algorithm selections are taken from appropriately-named attributes, or,
155failing that, from the
156.IR kemalgspec .
157.PP
158The key-encapsulation mechanism is chosen according to the setting of
159.I kem
160as follows. Run
161.B catcrypt show kem
162for a list of supported KEMs.
163.TP
164.B rsa
165This is Shoup's RSA-KEM (formerly Simple RSA); see
166.I
167A proposal for an ISO standard for public key encryption (version 2.0)
168available at
169.BR http://eprint.iacr.org/2000/060/ .
170Use the
171.B rsa
172algorithm of the
173.B key add
174command (see
175.BR key (1))
176to generate the key.
177.TP
178.B dh
179This is standard Diffie-Hellman key exchange, hashing the resulting
180shared secret to form the key, as used in, e.g., DLIES (P1363a).
181Use the
182.B dh
183algorithm of the
184.B key add
185command, preferably with the
186.B \-LS
187options, to generate the key.
188.TP
189.B ec
190This is the elliptic-curve analogue of
b98200ad 191.BR dh .
192Use the
c65df279 193.B ec
194algorithm of the
195.BR key (1))
196command to generate the key.
02dfbd5b
MW
197.TP
198.B symm
199This is a simple symmetric encapsulation scheme. It works by hashing a
200binary key with a randomly-generated salt. Use the
201.B binary
202algorithm of the
203.B key add
204command (see
205.BR key (1))
206to generate the key.
fc2d44af
MW
207.TP
208.B x25519
209This is Bernstein's Curve25519, a fast Diffie-Hellman using a specific
210elliptic curve.
211Use the
212.B x25519
213algorithm of the
214.B key add
215command
216(see
217.BR key (1))
218to generate the key.
643eb1bb
MW
219.TP
220.B x448
221This is Hamburg's Curve25519, a strong Diffie-Hellman using a specific
222elliptic curve.
223Use the
224.B x448
225algorithm of the
226.B key add
227command
228(see
229.BR key (1))
230to generate the key.
c65df279 231.PP
66ff643c
MW
232The bulk crypto transform is chosen based on the
233.B bulk
234attribute on the key, or, failing that,
235from the
236.I bulk
237stated in the
238.IR kemalgspec .
239Run
240.B catcrypt show bulk
241for a list of supported bulk crypto transforms.
242.TP
243.B gencomp
244A generic composition of
245a cipher secure against chosen-plaintext attack,
246and a message authentication code.
247Makes use of
248.B cipher
249and
250.B mac
b2973dcf
MW
251attributes. Run
252.B catcrypt show cipher
253for a list of supported symmetric encryption algorithms; the default
254.I cipher
255is
256.BR blowfish-cbc .
66ff643c 257This is the default transform.
d9d419b0
MW
258.TP
259.B naclbox
260Use Salsa20 or ChaCha and Poly1305 to secure the bulk data.
261This is nearly the same as the NaCl
262.B crypto_secretbox
263construction,
264except that
265.B catcrypt
266uses Salsa20 or ChaCha rather than XSalsa20,
267because it doesn't need the latter's extended nonce.
268The
269.B cipher
270attribute may be set to one of
271.BR salsa20 ,
272.BR salsa20/12 ,
273.BR salsa20/8 ,
274.BR chacha20 ,
275.BR chacha12 ,
276or
277.BR chacha8 ;
278the default is
279.BR salsa20 .
66ff643c 280.PP
c65df279 281As well as the KEM itself, a number of supporting algorithms are used.
282These are taken from appropriately named attributes on the key or,
283failing that, derived from other attributes as described below.
284.TP
285.B cipher
66ff643c
MW
286This is the symmetric encryption algorithm
287used by the bulk data transform.
288If there is no
c65df279 289.B cipher
290attribute then the
66ff643c 291.I bulk
c65df279 292in the
293.I kemalgspec
b2973dcf
MW
294is used; if that it absent, then the default depends on the bulk
295transform.
c65df279 296.TP
297.B hash
298This is the hash function used to distil entropy from the shared secret
299constructed by the raw KEM. If there is no
300.B hash
301attribute then the
302.I hash
303in the
b98200ad 304.I kemalgspec
305is used; if that is absent then the default of
c65df279 306.B rmd160
307is used. Run
308.B catcrypt show hash
309for a list of supported symmetric encryption algorithms.
310.TP
311.B mac
66ff643c
MW
312This is the message authentication algorithm
313used by the
314.B gencomp
315bulk data transform
316to ensure integrity of the encrypted message and
317defend against chosen-ciphertext attacks.
318If there is no
c65df279 319.B mac
320attribute then
321.IB hash -hmac
322is chosen as a default. Run
323.B catcrypt show mac
324for a list of supported message authentication algorithms.
325.TP
326.B kdf
327This is the key derivation function used to stretch the hashed shared
328secret to a sufficient length to select symmetric encryption and
329authentication keys, initialization vectors and other necessary
330pseudorandom quantities. If there is no
331.B kdf
332attribute then
333.IB hash -mgf
334is chosen as a default. Run
335.B catcrypt show kdf
336for a list of supported key derivation functions.
337.B Caution!
338Not all supported functions have the required security features: don't
339override the default choice unless you know what you're doing.
340.SS "Signing keys"
341A
342.I sigalgspec
343has the form
344.IR sig \c
345.RB [ / \c
346.IR hash ].
347If a
348.B sig
349attribute is present on the key, then it must have this form; otherwise,
350the key's type must have the form
351.BI ccsig- \c
352.IR sigalgspec .
353Algorithm selections are taken from appropriately-named attributes, or,
354failing that, from the
355.IR sigalgspec .
356.PP
357The signature algorithm is chosen according to the setting of
358.I sig
359as follows. Run
360.B catcrypt show sig
361for a list of supported signature algorithms.
362.TP
363.B rsapkcs1
364This is almost the same as the RSASSA-PKCS1-v1_5 algorithm described in
365RFC3447; the difference is that the hash is left bare rather than being
45c0fd36 366wrapped in a DER-encoded
c65df279 367.B DigestInfo
368structure. This doesn't affect security since the key can only be used
369with the one hash function anyway, and dropping the DER wrapping permits
370rapid adoption of new hash functions. Regardless, use of this algorithm
371is not recommended, since the padding method has been shown vulnerable
372to attack. Use the
373.B rsa
374algorithm of the
375.B key add
376command (see
377.BR key (1))
378to generate the key.
379.TP
380.B rsapss
381This is the RSASSA-PSS algorithm described in RFC3447. It is the
382preferred RSA-based signature scheme. Use the
383.B rsa
384algorithm of the
385.B key add
386command (see
387.BR key (1))
388to generate the key.
389.TP
390.B dsa
45c0fd36 391This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
c65df279 392.B dsa
393algorithm of the
394.B key add
395command (see
396.BR key (1))
397to generate the key.
398.TP
399.B ecdsa
400This is the ECDSA algorithm described in ANSI X9.62 and FIPS180-2. Use
401the
402.B ec
403algorithm of the
404.B key add
405command (see
406.BR key (1))
407to generate the key.
408.TP
409.B kcdsa
410This is the revised KCDSA (Korean Certificate-based Digital Signature
411Algorithm) described in
412.I The Revised Version of KCDSA
413.RB ( http://dasan.sejong.ac.kr/~chlim/pub/kcdsa1.ps ).
414Use the
415.B dh
416algorithm of the
417.B key add
418command with the
419.B \-LS
420options (see
421.BR key (1))
422to generate the key.
423.TP
424.B eckcdsa
425This is an unofficial elliptic-curve analogue of the KCDSA algorithm.
426Use the
427.B ec
428algorithm of the
429.B key add
430command (see
431.BR key (1))
432to generate the key.
02dfbd5b 433.TP
d56fd9d1
MW
434.B ed25519
435This is Bernstein, Duif, Lange, Schwabe, and Yang's Ed25519 algorithm.
436More specifically, this is HashEd25519
437using the selected
438.B hash
439algorithm \(en by default
440.BR sha512 .
441Use the
442.B ed25519
443algorithm of the
444.B key add
445command
446(see
447.BR key (1))
448to generate the key.
449.TP
c578d5d8
MW
450.B ed448
451This is Bernstein, Duif, Lange, Schwabe, and Yang's EdDSA algorithm,
452using Hamburg's Ed448-Goldilocks elliptic curve,
453as specified in RFC8032.
454More specifically, this is HashEd448
455using the selected
456.B hash
457algorithm \(en by default
458.BR sha3-512 .
459Use the
460.B ed448
461algorithm of the
462.B key add
463command
464(see
465.BR key (1))
466to generate the key.
467.TP
02dfbd5b
MW
468.B mac
469This uses a symmetric message-authentication algorithm rather than a
470digital signature. The precise message-authentication scheme used is
471determined by the
472.B mac
473attribute on the key, which defaults to
474.IB hash -hmac
475if unspecified. Use the
476.B binary
477algorithm of the
478.B key add
479command (see
480.BR key (1))
481to generate the key.
c65df279 482.PP
483As well as the signature algorithm itself, a hash function is used.
484This is taken from the
485.B hash
486attribute on the key, or, failing that, from the
487.I hash
488specified in the
489.IR sigalgspec ,
490or, if that is absent, determined by the signature algorithm as follows.
491.hP \*o
492For
493.BR rsapkcs1 ,
494.BR rsapss ,
495.BR dsa ,
496and
497.BR ecdsa ,
498the default hash function is
499.BR sha .
500.hP \*o
501For
45c0fd36 502.BR kcdsa
c65df279 503and
504.BR eckcdsa ,
505the default hash function is
506.BR has160 .
df8800f1
MW
507For
508.BR ed25519 ,
509the default hash function is
510.BR sha512 .
c578d5d8
MW
511For
512.BR ed448 ,
513the default hash function is
514.BR shake256 .
c65df279 515.PP
516Run
517.B catcrypt show hash
518for a list of supported hash functions.
519.SH "ENCODINGS"
520Two encodings for the ciphertext are supported.
521.TP
522.B binary
523The raw format, which has the benefit of being smaller, but needs to be
524attached to mail messages and generally handled with care.
525.TP
526.B pem
527PEM-encapsulated Base-64 encoded text. This format can be included
528directly in email and picked out again automatically; but there is a
5294-to-3 data expansion as a result.
530.SH "COMMAND REFERENCE"
531.SS help
532The
533.B help
534command behaves exactly as the
535.B \-\-help
536option. With no arguments, it shows an overview of
537.BR catcrypt 's
538options; with arguments, it describes the named subcommands.
539.SS show
540The
541.B show
542command prints various lists of tokens understood by
543.BR catcrypt .
544With no arguments, it prints all of the lists; with arguments, it prints
545just the named lists, in order. The recognized lists can be enumerated
546using the
547.VS
548catcrypt show list
549.VE
550command. The lists are as follows.
551.TP
552.B list
553The lists which can be enumerated by the
554.B show
555command.
556.TP
557.B kem
558The key-encapsulation algorithms which can be used in a
559key-encapsulation key's
560.B kem
561attribute.
562.TP
563.B cipher
564The symmetric encryption algorithms which can be used in a
565key-encapsulation key's
566.B cipher
b2973dcf
MW
567attribute when using the
568.B gencomp
569bulk transform.
c65df279 570.TP
571.B mac
572The message authentication algorithms which can be used in a
573key-encapsulation key's
574.B mac
575attribute.
576.TP
577.B sig
578The signature algorithms which can be used in a signing key's
579.B sig
580attribute.
581.TP
582.B hash
583The hash functions which can be used in a key's
584.B hash
585attribute.
586.TP
587.B enc
45c0fd36 588The encodings which can be applied to encrypted messages; see
c65df279 589.B ENCODINGS
590above.
591.SS encrypt
592The
593.B encrypt
594command encrypts a file and writes out the appropriately-encoded
595ciphertext. By default, it reads from standard input and writes to
596standard output. If a filename argument is given, this file is read
597instead (as binary data).
598.PP
599The following options are recognized.
600.TP
601.B "\-a, \-\-armour"
602Produce ASCII-armoured output. This is equivalent to specifying
603.BR "\-f pem" .
604The variant spelling
605.B "\-\-armor"
606is also accepted.
607.TP
608.BI "\-f, \-\-format " format
609Produce output encoded according to
610.IR format .
611.TP
612.BI "\-k, \-\-key " tag
613Use the key-encapsulation key named
614.I tag
615in the current keyring; the default key is
616.BR ccrypt .
617.TP
cd6eca43
MW
618.BI "\-p, \-\-progress"
619Write a progress meter to standard error while processing large files.
620.TP
c65df279 621.BI "\-s, \-\-sign-key " tag
622Use the signature key named
623.I tag
624in the current keyring; the default is not to sign the ciphertext.
625.TP
626.BI "\-o, \-\-ouptut " file
627Write output to
628.I file
629rather than to standard output.
946c3f72 630.TP
631.B "\-C, \-\-nocheck"
632Don't check the public key for validity. This makes encryption go much
633faster, but at the risk of using a duff key.
c65df279 634.SS decrypt
635The
636.B decrypt
637command decrypts a ciphertext and writes out the plaintext. By default,
638it reads from standard input and writes to standard output. If a
639filename argument is given, this file is read instead.
640.PP
641The following options are recognized.
642.TP
643.B "\-a, \-\-armour"
fa54fe1e 644Read ASCII-armoured input. This is equivalent to specifying
c65df279 645.BR "\-f pem" .
646The variant spelling
647.B "\-\-armor"
648is also accepted.
649.TP
fa54fe1e 650.B "\-b, \-\-buffer"
651Buffer plaintext data until we're sure we've got it all. This is forced
652on if output is to stdout, but is always available as an option.
653.TP
c65df279 654.BI "\-f, \-\-format " format
655Read input encoded according to
656.IR format .
657.TP
cd6eca43
MW
658.BI "\-p, \-\-progress"
659Write a progress meter to standard error while processing large files.
660.TP
c65df279 661.B "\-v, \-\-verbose"
662Produce more verbose messages. See below for the messages produced
663during decryption. The default verbosity level is 1. (Currently this
664is the most verbose setting. This might not be the case always.)
665.TP
666.B "\-q, \-\-quiet"
667Produce fewer messages.
668.TP
669.BI "\-o, \-\-output " file
670Write output to
671.I file
672instead of to standard output. The file is written in binary mode.
673Fixing line-end conventions is your problem; there are lots of good
674tools for dealing with it.
946c3f72 675.TP
676.B "\-C, \-\-nocheck"
677Don't check the private key for validity. This makes decryption go much
678faster, but at the risk of using a duff key, and possibly leaking
679information about the private key.
c65df279 680.PP
681Output is written to standard output in a machine-readable format.
682Major problems cause the program to write a diagnostic to standard error
683and exit nonzero as usual. The quantity of output varies depending on
684the verbosity level and whether the plaintext is also being written to
fa54fe1e 685standard output. Output lines begin with a keyword:
c65df279 686.TP
687.BI "FAIL " reason
688An error prevented decryption. The program will exit nonzero.
689.TP
690.BI "WARN " reason
691.B catcrypt
692encountered a situation which may or may not invalidate the decryption.
45c0fd36 693.TP
c65df279 694.BI "OK " message
695Decryption was successful. This is only produced if main output is
696being sent somewhere other than standard output.
697.TP
698.B "DATA"
699The plaintext follows, starting just after the next newline character or
b98200ad 700sequence. This is only produced if main output is also being sent to
fa54fe1e 701standard output.
c65df279 702.TP
703.BI "INFO " note
704Any other information.
705.PP
706The information written at the various verbosity levels is as follows.
707.hP 0.
708No output. Watch the exit status.
709.hP 1.
710All messages.
711.PP
712.B Warning!
fa54fe1e 713All output written has been checked for authenticity. However, output
77e4471a 714can fail midway through for many reasons, and the resulting message may
45c0fd36 715therefore be truncated. Don't rely on the output being complete until
4224d0b9 716.B OK
717is printed or
c65df279 718.B catcrypt decrypt
fa54fe1e 719exits successfully.
c65df279 720.SS "encode"
721The
722.B encode
723command encodes an input file according to one of the encodings
724described above in
725.BR ENCODINGS .
45c0fd36 726The input is read from the
c65df279 727.I file
728given on the command line, or from standard input if none is specified.
729Options provided are:
730.TP
cd6eca43
MW
731.BI "\-p, \-\-progress"
732Write a progress meter to standard error while processing large files.
733.TP
c65df279 734.BI "\-f, \-\-format " format
735Produce output in
736.IR format .
737Run
738.B catcrypt show enc
739for a list of encoding formats.
740.TP
741.BI "\-b, \-\-boundary " label
742Set the PEM boundary string to
743.IR label ;
744i.e., assuming we're encoding in PEM format, the output will have
745.BI "\-\-\-\-\-BEGIN " label "\-\-\-\-\-"
746at the top and
747.BI "\-\-\-\-\-END " label "\-\-\-\-\-"
748at the bottom. The default
749.I label
750is
751.BR MESSAGE .
752.TP
753.BI "\-o, \-\-output " file
754Write output to
755.I file
756instead of to standard output.
757.SS "decode"
758The
759.B decode
760command decodes an input file encoded according to one of the encodings
761described above in
762.BR ENCODINGS .
45c0fd36 763The input is read from the
c65df279 764.I file
765given on the command line, or from standard input if none is specified.
766Options provided are:
767.TP
768.BI "\-f, \-\-format " format
769Decode input in
770.IR format .
771Run
772.B catcrypt show enc
773for a list of encoding formats.
774.TP
775.BI "\-b, \-\-boundary " label
776Set the PEM boundary string to
777.IR label ;
778i.e., assuming we're encoding in PEM format, start processing input
779between
780.BI "\-\-\-\-\-BEGIN " label "\-\-\-\-\-"
45c0fd36 781and
c65df279 782.BI "\-\-\-\-\-END " label "\-\-\-\-\-"
783lines. Without this option,
784.B catcrypt
785will start reading at the first plausible boundary string, and continue
786processing until it reaches the matching end boundary.
787.TP
cd6eca43
MW
788.BI "\-p, \-\-progress"
789Write a progress meter to standard error while processing large files.
790.TP
c65df279 791.BI "\-o, \-\-output " file
792Write output to
793.I file
794instead of to standard output.
795.SH "SECURITY PROPERTIES"
796Assuming the security of the underlying primitive algorithms, the
797following security properties of the ciphertext hold.
798.hP \*o
799An adversary given the public key-encapsulation key and capable of
800requesting encryption of arbitrary plaintexts of his own devising is
801unable to decide whether he is given ciphertexts corresponding to his
802chosen plaintexts or random plaintexts of the same length. This holds
803even if the adversary is permitted to request decryption of any
804ciphertext other than one produced as a result of an encryption request.
805This property is called
806.BR IND-CCA2 .
807.hP \*o
808An adversary given the public key-encapsulation and verification keys,
809and capable of requesting encryption of arbitrary plaintext of his own
810devising is unable to produce a new ciphertext which will be accepted as
811genuine. This property is called
812.BR INT-CTXT .
813.hP \*o
814An adversary given the public key-encapsulation and verification keys,
815and capable of requesting encryption of arbitrary plaintext of his own
816devising is unable to decide whether the ciphertexts he is given are
817correctly signed. This property doesn't seem to have a name.
818.PP
819Not all is rosy. If you leak intermediate values during decryption then
820an adversary can construct a new correctly-signed message. Don't do
821that, then \(en leaking intermediate values often voids security
822warranties. But it does avoid the usual problem with separate signing
823and encryption that a careful leak by the recipient can produce evidence
824that you signed some incriminating message.
4224d0b9 825.PP
826Note that
827.BR catcrypt 's
828signatures do
829.I not
830provide `non-repudiation' in any useful way. This is deliberate: the
831purpose of signing is to convince the recipient of the sender's
832identity, rather than to allow the recipient to persuade anyone else.
833Indeed, given an encrypted and signed message, the recipient can
834straightforwardly construct a new message, apparently from the same
835sender, and whose signature still verifies, but with arbitrarily chosen
836content.
c65df279 837.SH "CRYPTOGRAPHIC THEORY"
838Encryption of a message proceeds as follows.
839.hP 0.
840Emit a header packet containing the key-ids for the key-encapsulation
841key, and signature key if any.
842.hP 1.
843Use the KEM to produce a public value and a shared secret the recipient
844will be able to extract from the public value using his private key.
845Emit a packet containing the public value.
846.hP 2.
847Hash the shared secret. Use the KDF to produce a pseudorandom keystream
848of indefinite length.
849.hP 3.
850Use the first bits of the keystream to key a symmetric encryption
851scheme; use the next bits to key a message authentication code.
852.hP 4.
853If we're signing the message then extract 1024 bytes from the keystream,
f9e51332 854sign the header and public value, and the keystream bytes; emit a packet
855containing the signature. The signature packet doesn't contain the
856signed message, just the signature.
c65df279 857.hP 5.
858Split the message into blocks. For each block, pick a random IV from
859the keystream, encrypt the block and emit a packet containing the
aaa2361e 860IV, ciphertext, and a MAC tag over the ciphertext and a sequence number.
861.hP 6.
862The last chunk is the encryption of an empty plaintext block. No
863previous plaintext block is empty. This lets us determine the
864difference between a complete file and one that's been maliciously
865truncated.
c65df279 866.PP
867That's it. Nothing terribly controversial, really.
868.SH "SEE ALSO"
869.BR key (1),
fa54fe1e 870.BR catsign (1),
c65df279 871.BR dsig (1),
872.BR hashsum (1),
873.BR keyring (5).
874.SH AUTHOR
f387fcb1 875Mark Wooding, <mdw@distorted.org.uk>