.RI [ item ...]
.br
.B encrypt
-.RB [ \-a ]
+.RB [ \-aC ]
.RB [ \-k
.IR tag ]
.RB [ \-f
.RI [ file ]
.br
.B decrypt
-.RB [ \-aqv ]
+.RB [ \-aqvC ]
.RB [ \-f
.IR format ]
.RB [ \-o
.B catcrypt
command deals with both signing and key-encapsulation keys. (Note that
.B catcrypt
-uses signing keys in the same way as
+uses signing keys in the same way as
.BR catsign (1).)
.SS "Key-encapsulation keys"
(Key encapsulation is a means of transmitting a short, known, random
.TP
.B ec
This is the elliptic-curve analogue of
-.BR dh . Use the
+.BR dh .
+Use the
.B ec
algorithm of the
.BR key (1))
command to generate the key.
+.TP
+.B symm
+This is a simple symmetric encapsulation scheme. It works by hashing a
+binary key with a randomly-generated salt. Use the
+.B binary
+algorithm of the
+.B key add
+command (see
+.BR key (1))
+to generate the key.
.PP
As well as the KEM itself, a number of supporting algorithms are used.
These are taken from appropriately named attributes on the key or,
attribute then the
.I hash
in the
-.I kemalgspec is used; if that is absent then the default of
+.I kemalgspec
+is used; if that is absent then the default of
.B rmd160
is used. Run
.B catcrypt show hash
.B rsapkcs1
This is almost the same as the RSASSA-PKCS1-v1_5 algorithm described in
RFC3447; the difference is that the hash is left bare rather than being
-wrapped in a DER-encoded
+wrapped in a DER-encoded
.B DigestInfo
structure. This doesn't affect security since the key can only be used
with the one hash function anyway, and dropping the DER wrapping permits
to generate the key.
.TP
.B dsa
-This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
+This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
.B dsa
algorithm of the
.B key add
command (see
.BR key (1))
to generate the key.
+.TP
+.B mac
+This uses a symmetric message-authentication algorithm rather than a
+digital signature. The precise message-authentication scheme used is
+determined by the
+.B mac
+attribute on the key, which defaults to
+.IB hash -hmac
+if unspecified. Use the
+.B binary
+algorithm of the
+.B key add
+command (see
+.BR key (1))
+to generate the key.
.PP
As well as the signature algorithm itself, a hash function is used.
This is taken from the
.BR sha .
.hP \*o
For
-.BR kcdsa
+.BR kcdsa
and
.BR eckcdsa ,
the default hash function is
attribute.
.TP
.B enc
-The encodings which can be applied to encrypted messages; see
+The encodings which can be applied to encrypted messages; see
.B ENCODINGS
above.
.SS encrypt
Write output to
.I file
rather than to standard output.
+.TP
+.B "\-C, \-\-nocheck"
+Don't check the public key for validity. This makes encryption go much
+faster, but at the risk of using a duff key.
.SS decrypt
The
.B decrypt
instead of to standard output. The file is written in binary mode.
Fixing line-end conventions is your problem; there are lots of good
tools for dealing with it.
+.TP
+.B "\-C, \-\-nocheck"
+Don't check the private key for validity. This makes decryption go much
+faster, but at the risk of using a duff key, and possibly leaking
+information about the private key.
.PP
Output is written to standard output in a machine-readable format.
Major problems cause the program to write a diagnostic to standard error
.BI "WARN " reason
.B catcrypt
encountered a situation which may or may not invalidate the decryption.
-.TP
+.TP
.BI "OK " message
Decryption was successful. This is only produced if main output is
being sent somewhere other than standard output.
.TP
.B "DATA"
The plaintext follows, starting just after the next newline character or
-sequence. This is only produced if main output is being sent to
+sequence. This is only produced if main output is also being sent to
standard output.
.TP
.BI "INFO " note
.B Warning!
All output written has been checked for authenticity. However, output
can fail madway through for many reasons, and the resulting message may
-therefore be truncated. Don't rely on the output being complete until
-.B OK is printed or
+therefore be truncated. Don't rely on the output being complete until
+.B OK
+is printed or
.B catcrypt decrypt
exits successfully.
.SS "encode"
command encodes an input file according to one of the encodings
described above in
.BR ENCODINGS .
-The input is read from the
+The input is read from the
.I file
given on the command line, or from standard input if none is specified.
Options provided are:
command decodes an input file encoded according to one of the encodings
described above in
.BR ENCODINGS .
-The input is read from the
+The input is read from the
.I file
given on the command line, or from standard input if none is specified.
Options provided are:
i.e., assuming we're encoding in PEM format, start processing input
between
.BI "\-\-\-\-\-BEGIN " label "\-\-\-\-\-"
-and
+and
.BI "\-\-\-\-\-END " label "\-\-\-\-\-"
lines. Without this option,
.B catcrypt
warranties. But it does avoid the usual problem with separate signing
and encryption that a careful leak by the recipient can produce evidence
that you signed some incriminating message.
+.PP
+Note that
+.BR catcrypt 's
+signatures do
+.I not
+provide `non-repudiation' in any useful way. This is deliberate: the
+purpose of signing is to convince the recipient of the sender's
+identity, rather than to allow the recipient to persuade anyone else.
+Indeed, given an encrypted and signed message, the recipient can
+straightforwardly construct a new message, apparently from the same
+sender, and whose signature still verifies, but with arbitrarily chosen
+content.
.SH "CRYPTOGRAPHIC THEORY"
Encryption of a message proceeds as follows.
.hP 0.
scheme; use the next bits to key a message authentication code.
.hP 4.
If we're signing the message then extract 1024 bytes from the keystream,
-sign them, and emit a packet containing the signature. The signature
-packet doesn't contain the signed message, just the signature.
+sign the header and public value, and the keystream bytes; emit a packet
+containing the signature. The signature packet doesn't contain the
+signed message, just the signature.
.hP 5.
Split the message into blocks. For each block, pick a random IV from
the keystream, encrypt the block and emit a packet containing the
.BR hashsum (1),
.BR keyring (5).
.SH AUTHOR
-Mark Wooding, <mdw@nsict.org>
+Mark Wooding, <mdw@distorted.org.uk>