| 1 |
.\" pkcsstats.1 |
| 2 |
.\" |
| 3 |
.\" Copyright IBM Corp. 2021 |
| 4 |
.\" See LICENSE for details. |
| 5 |
.\" |
| 6 |
.TH PKCSSTATS 1 "October 2021" "@PACKAGE_VERSION@" "openCryptoki" |
| 7 |
.SH NAME |
| 8 |
pkcsstats \- utility to display mechanism usage statistics for openCryptoki. |
| 9 |
|
| 10 |
.SH SYNOPSIS |
| 11 |
.B pkcsstats |
| 12 |
.RB [ OPTIONS ] |
| 13 |
. |
| 14 |
.PP |
| 15 |
.B pkcsstats |
| 16 |
.BR \-\-help | \-h |
| 17 |
.br |
| 18 |
|
| 19 |
.SH DESCRIPTION |
| 20 |
Displays mechanism usage statistics for openCryptoki. Usage statistics are |
| 21 |
collected by openCryptoki on a per user basis. For each user, mechanism |
| 22 |
usage is counted per configured slot and mechanism. For each mechanism a set of |
| 23 |
counters exist, one for each cryptographic strength of the cryptographic |
| 24 |
key used with the mechanism. |
| 25 |
.PP |
| 26 |
The available strengths are defined in the strength configuration file |
| 27 |
\fB/etc/opencryptoki/strength.conf\fP. Supported strengths are 112, 128, 192, |
| 28 |
and 256 representing the corresponding strength in bits. |
| 29 |
The strength configuration file defines how the strength is determined for the |
| 30 |
various key types. A strength of zero is used to count those mechanisms that |
| 31 |
do not use a key, or where the key strength is less than 112 bits. |
| 32 |
.PP |
| 33 |
.B Note: |
| 34 |
The strength does not specify the cryptographic strength of the mechanism, but |
| 35 |
the cryptographic strength of the key used with the mechanism (if any). |
| 36 |
For example, usage of mechanism CKM\_SHA256 is reported under strength 0, |
| 37 |
because no key is used with this mechanism. However, usage of mechanism |
| 38 |
CKM\_AES\_CBC is reported under strength 128, 192, or 256, dependent on the |
| 39 |
cryptographic size of the AES key used with it (and the definitions in the |
| 40 |
strength configuration file). |
| 41 |
.PP |
| 42 |
Statistics collection is enabled by default. It can be disabled and configured |
| 43 |
in the openCryptoki configuration file |
| 44 |
\fB/etc/opencryptoki/opencryptoki.conf\fP. |
| 45 |
By default only explicit mechanism usage statistics from PKCS#11 applications |
| 46 |
are collected. |
| 47 |
.PP |
| 48 |
Optionally, implicit mechanism usage statistics can be collected, where |
| 49 |
additional mechanisms are specified in mechanism parameters. For example, |
| 50 |
RSA\-PSS or RSA\-OAEP allows to specify a hash mechanism and a mask generation |
| 51 |
function (MGF) in the mechanism parameter. ECDH allows to specify a key |
| 52 |
derivation function (KDF) in the mechanism parameter. The PBKDF2 mechanism |
| 53 |
allows to specify a pseudo random function (PRF) in the mechanism parameter. |
| 54 |
.PP |
| 55 |
Also optionally, opencryptoki\-internal mechanism usage statistics can be |
| 56 |
collected. This collects usage statistics for crypto operations used internally |
| 57 |
for pin handling and encryption of private token objects in the data store. |
| 58 |
.PP |
| 59 |
.B Note: |
| 60 |
Implicit or internal mechanism usage can not be distinguished from explicit |
| 61 |
mechanism usage of PKCS#11 applications in the displayed statistics. |
| 62 |
.PP |
| 63 |
Statistics are collected in a POSIX shared memory segment per user. This shared |
| 64 |
memory segment contains all counters for all configured slots, mechanisms, and |
| 65 |
strengths. The shared memory segments are named |
| 66 |
\fBvar.lib.opencryptoki_stats_<uid>\fP, where \fBuid\fP is the numeric user\-id |
| 67 |
of the user the statistics belong to. The shared memory segments are |
| 68 |
automatically created for a user on the first attempt to collect statistics |
| 69 |
(when not already existent). The shared memory segments can be deleted using |
| 70 |
the \fBpkcsstats\fP command with the \fB\-\-delete\fP, or \fB\-\-delete\-all\fP |
| 71 |
options. |
| 72 |
.PP |
| 73 |
The usage of a mechanism is counted once when the cryptographic operation is |
| 74 |
sucessfully initialized, i.e. during \fBC_DigestInit\fP, \fBC_EncryptInit\fP, |
| 75 |
\fBC_DecryptInit\fP, \fBC_SignInit\fP, \fBC_SignRecoverInit\fP, and |
| 76 |
\fBC_VerifyInit\fP. Multi-part operations involving the update functions like |
| 77 |
\fBC_DigestUpdate\fP, \fBC_EncryptUpdate\fP, \fBC_DecryptUpdate\fP, |
| 78 |
\fBC_SignUpdate\fP, and \fBC_VerifyUpdate\fP, are not counted additionally. |
| 79 |
.PP |
| 80 |
Other operations such as key generation, key derivation, key wrapping and |
| 81 |
unwrapping are counted during the respective functions like \fBC_GenerateKey\fP, |
| 82 |
\fBC_GenerateKeyPair\fP, \fBC_DeriveKey\fP, \fBC_DeriveKey\fP, |
| 83 |
\fBC_UnwrapKey\fP. |
| 84 |
|
| 85 |
.SH "OPTIONS" |
| 86 |
|
| 87 |
.TP |
| 88 |
.BR \-U ", " \-\-user\~\fIuser\-id\fP |
| 89 |
Specifies the user\-id of the user to display, reset, or delete statistics for. |
| 90 |
If this option is omitted, the statistics of the current user are displayed, |
| 91 |
resetted, or deleted. Only the \fBroot\fP user can display, reset, or delete |
| 92 |
statistics of other users. |
| 93 |
.TP |
| 94 |
.BR \-S ", " \-\-summary |
| 95 |
Shows the accumulated statistics from all users. Only the \fBroot\fP user can |
| 96 |
display the accumulated statistics from other users. |
| 97 |
.TP |
| 98 |
.BR \-A ", " \-\-all |
| 99 |
Shows the statistics from all users. Only the \fBroot\fP user can display |
| 100 |
statistics from all users. |
| 101 |
.TP |
| 102 |
.BR \-a ", " \-\-all\-mechs |
| 103 |
Shows the statistics for all mechanisms, also those with all\-zero counters. |
| 104 |
If this option is omitted, only those mechanisms are displayed where at least |
| 105 |
one counter is non\-zero. |
| 106 |
.TP |
| 107 |
.BR \-s ", " \-\-slot\~\fIslot\-id\fP |
| 108 |
Specifies the slot\-id to display statistics for. If this option is omitted, |
| 109 |
the statistics for all configured slots are displayed. |
| 110 |
.TP |
| 111 |
.BR \-r ", " \-\-reset |
| 112 |
Resets the statistics counters for the current user, or for the user specified |
| 113 |
with the \fB\-\-user\fP option. Only the \fBroot\fP user can reset the |
| 114 |
statistics from other users. |
| 115 |
.TP |
| 116 |
.BR \-R ", " \-\-reset\-all |
| 117 |
Resets the statistics counters for all users. Only the \fBroot\fP user |
| 118 |
can reset the statistics from other users. |
| 119 |
.TP |
| 120 |
.BR \-d ", " \-\-delete |
| 121 |
Deletes the shared memory segment containing the statistics counters for the |
| 122 |
current user, or for the user specified with the \fB\-\-user\fP option. |
| 123 |
Only the \fBroot\fP user can delete the statistics from other users. |
| 124 |
.TP |
| 125 |
.BR \-D ", " \-\-delete\-all |
| 126 |
Deletes the shared memory segment containing the statistics counters for all |
| 127 |
users. Only the \fBroot\fP user can delete the statistics from other users. |
| 128 |
.TP |
| 129 |
.BR \-j ", " \-\-json |
| 130 |
Shows the statistics in JSON format. This is usefull to get the statistics in |
| 131 |
a machine readable format. |
| 132 |
.TP |
| 133 |
.BR \-h ", " \-\-help |
| 134 |
Displays help text and exits. |
| 135 |
|
| 136 |
.SH SEE ALSO |
| 137 |
.PD 0 |
| 138 |
.TP |
| 139 |
\fBopencryptoki.conf\fP(5). |
| 140 |
.TP |
| 141 |
\fBstrength.conf\fP(5), |
| 142 |
.TP |
| 143 |
\fBopencryptoki\fP(7), |
| 144 |
|
| 145 |
.PD |