| 1 |
.\" Copyright (c) 2017 - 2022 by Stephan Mueller ([email protected]) |
| 2 |
.\" |
| 3 |
.\" Permission is granted to make and distribute verbatim copies of this |
| 4 |
.\" manual provided the copyright notice and this permission notice are |
| 5 |
.\" preserved on all copies. |
| 6 |
.\" |
| 7 |
.\" Permission is granted to copy and distribute modified versions of this |
| 8 |
.\" manual under the conditions for verbatim copying, provided that the |
| 9 |
.\" entire resulting derived work is distributed under the terms of a |
| 10 |
.\" permission notice identical to this one. |
| 11 |
.\" |
| 12 |
.\" Formatted or processed versions of this manual, if unaccompanied by |
| 13 |
.\" the source, must acknowledge the copyright and authors of this work. |
| 14 |
.\" License. |
| 15 |
.TH KCAPI-DGST 1 2017-08-14 |
| 16 |
.SH NAME |
| 17 |
kcapi-dgst \- Kernel Crypto API Message Digest Crypto Helper |
| 18 |
.SH SYNOPSIS |
| 19 |
.B kcapi-dgst |
| 20 |
[\fI\,OPTION\/\fR] |
| 21 |
.SH DESCRIPTION |
| 22 |
The |
| 23 |
.I kcapi-dgst |
| 24 |
application provides tool to use the message digest as well as |
| 25 |
keyed message digest ciphers of the Linux kernel crypto API from |
| 26 |
the command line. |
| 27 |
.PP |
| 28 |
The input data can be provided either via STDIN or via a file |
| 29 |
that is referenced with a command line option. Similarly, the output |
| 30 |
data can either be sent to a file referenced with a command line option |
| 31 |
or to STDOUT. |
| 32 |
.PP |
| 33 |
The key used for the keyed message digest operation can either be |
| 34 |
provided via a file descriptor or via a password. When using a file |
| 35 |
descriptor, the provided data is taken directly as the keyed message |
| 36 |
digest key. When providing a password, the |
| 37 |
.IR kcapi-dgst |
| 38 |
application derives a 256 bit key from the password using PBKDF2. |
| 39 |
PBKDF2 with HMAC-SHA256 as default transforms the password into a key. |
| 40 |
The PBKDF2 operation requires two additional input values: a salt and |
| 41 |
an iteration count. Both can be provided via the command line. If |
| 42 |
the iteration count is not specified, |
| 43 |
.IR kcapi-dgst |
| 44 |
determines the iteration count internally by counting how many |
| 45 |
iterations are necessary to surpass 100ms operation time. The determined |
| 46 |
number is provided via STDERR and must be re-used when verifying the |
| 47 |
keyed message digest created from the data. If the salt is not |
| 48 |
provided via command line, |
| 49 |
.IR kcapi-dgst |
| 50 |
generates a 256 bit salt and sends its hexadecimal |
| 51 |
representation to STDERR. This salt must be used during decryption |
| 52 |
to ensure the PBKDF2 operation generates the correct key. |
| 53 |
.LP |
| 54 |
The following options are supported when invoking |
| 55 |
.IR kcapi-dgst : |
| 56 |
.TP |
| 57 |
\fB-c\fR, \fB\-\-cipher \fI\,NAME\/\fR |
| 58 |
The |
| 59 |
.IR NAME |
| 60 |
argument specifies the digest cipher to be used. The allowed |
| 61 |
ciphers are defined by the Linux kernel. Currently registered |
| 62 |
ciphers can be reviewed at |
| 63 |
.IR /proc/crypto . |
| 64 |
The content of this file, however, can change when new ciphers |
| 65 |
are registered. The |
| 66 |
.IR NAME |
| 67 |
argument is given directly to the Linux kernel crypto API. The |
| 68 |
chosen cipher must be either of type |
| 69 |
.IR ahash |
| 70 |
or of type |
| 71 |
.IR shash |
| 72 |
as marked in |
| 73 |
.IR /proc/crypto . |
| 74 |
.TP |
| 75 |
\fB\-i\fR, \fB\-\-infile \fI\,FILE\/\fR |
| 76 |
Use the file referenced with |
| 77 |
.IR FILE |
| 78 |
as the input data. If this option is not provided, |
| 79 |
.IR kcapi-dgst |
| 80 |
expects the input data via STDIN. |
| 81 |
.TP |
| 82 |
\fB\-o\fR, \fB\-\-outfile \fI\,FILE\/\fR |
| 83 |
Use the file referenced with |
| 84 |
.IR FILE |
| 85 |
as the destination for the output of the cryptographic |
| 86 |
operation. If this option is not provided, |
| 87 |
.IR kcapi-dgst |
| 88 |
will provide the output via STDOUT. |
| 89 |
.TP |
| 90 |
\fB\-\-salt \fI\,SALT\/\fR |
| 91 |
When performing the PBKDF2 operation to obtain the key for the keyed |
| 92 |
message digest from the password, the |
| 93 |
.IR SALT |
| 94 |
value is used as one input parameter. To ensure the same |
| 95 |
key is generated from a given password, the same salt value must |
| 96 |
be used. |
| 97 |
.TP |
| 98 |
\fB\-p\fR, \fB\-\-passwd \fI\,PASSWORD\/\fR |
| 99 |
The |
| 100 |
.IR PASSWORD |
| 101 |
parameter provides the password from which the keyed message digest key |
| 102 |
is derived. |
| 103 |
.BI WARNING |
| 104 |
The password provided with the command line can be seen from |
| 105 |
other applications or users when inspecting the |
| 106 |
.IR /proc |
| 107 |
file system! Thus, a password SHOULD NOT be used via the |
| 108 |
command line and the |
| 109 |
.IR passwdfd |
| 110 |
option should be used instead. |
| 111 |
.TP |
| 112 |
\fB\-\-passwdfd \fI\,FD\/\fR |
| 113 |
Instead of providing the password via command line, it can be |
| 114 |
injected into |
| 115 |
.IR kcapi-dgst |
| 116 |
using a file descriptor. The file descriptor number the |
| 117 |
password will be send through can be provided with the |
| 118 |
.IR FD |
| 119 |
option. |
| 120 |
.TP |
| 121 |
\fB\-\-pbkdfiter \fI\,NUM\/\fR |
| 122 |
Perform |
| 123 |
.IR NUM |
| 124 |
iterations of the PBKDF2 operation to derive the keyed message digest |
| 125 |
key. If this option is not supplied, |
| 126 |
.IR kcapi-dgst |
| 127 |
determines a number of iterations that is large enough to surpass |
| 128 |
100ms operational time for the PBKDF2 function. The determined |
| 129 |
iteration number is logged and must be reused if the same |
| 130 |
keyed message digest key is to be generated from the same password. |
| 131 |
.TP |
| 132 |
\fB\-\-pbkdfmac \fI\,MAC\/\fR |
| 133 |
Use the keyed message digest referenced with |
| 134 |
.IR MAC |
| 135 |
for the PBKDF2 operation. If this option is not supplied, the default |
| 136 |
of |
| 137 |
.IR hmac(sha256) |
| 138 |
is used. |
| 139 |
.TP |
| 140 |
\fB\-\-keyfd \fI\,FD\/\fR |
| 141 |
To provide a keyed message digest key that is directly used for the |
| 142 |
message digest operation, the file descriptor referenced with |
| 143 |
.IR FD |
| 144 |
must be used. Using a file descriptor is intentionally the only |
| 145 |
way to provide a key to |
| 146 |
.IR kcapi-dgst . |
| 147 |
.TP |
| 148 |
\fB\-\-hex\fR |
| 149 |
The generated message digest is print out in hexadecimal notation instead |
| 150 |
of as binary string. |
| 151 |
.TP |
| 152 |
\fB\-v\fR, \fB\-\-verbose\fR |
| 153 |
Enable a verbose operation of |
| 154 |
.IR kcapi-dgst . |
| 155 |
Using this option multiple times increases the verbosity. |
| 156 |
.TP |
| 157 |
\fB\-q\fR, \fB\-\-quiet\fR |
| 158 |
Prevent the generation of any log output. Note, some log output |
| 159 |
would be needed for proper operation like the display of the |
| 160 |
number of PBKDF2 iterations or the internally generated PBKDF2 salt. |
| 161 |
During quiet operation, none of this information is displayed. |
| 162 |
Note, both information can also be supplied via the command line |
| 163 |
so that |
| 164 |
.IR kcapi-dgst |
| 165 |
does not need to generate this information. |
| 166 |
.TP |
| 167 |
\fB\-h\fR, \fB\-\-help\fR |
| 168 |
Display the help text. |
| 169 |
.TP |
| 170 |
\fB\-\-version\fR |
| 171 |
Display the version number of the |
| 172 |
.IR kcapi-dgst |
| 173 |
application. |
| 174 |
.PP |
| 175 |
.SH SEE ALSO |
| 176 |
\fBkcapi-enc\fR(1) \fBkcapi-rng\fR(1) |