NingSun | 0c89b3c | 2018-02-08 08:34:03 -0800 | [diff] [blame^] | 1 | .TH SOFTHSM2-UTIL 1 "22 September 2017" "SoftHSM" |
| 2 | .SH NAME |
| 3 | softhsm2-util \- support tool for libsofthsm2 |
| 4 | .SH SYNOPSIS |
| 5 | .B softhsm2-util \-\-show-slots |
| 6 | .PP |
| 7 | .B softhsm2-util \-\-init-token |
| 8 | .B \-\-free |
| 9 | .B \-\-label |
| 10 | .I text |
| 11 | \\ |
| 12 | .ti +0.7i |
| 13 | .RB [ \-\-so-pin |
| 14 | .I PIN |
| 15 | .B \-\-pin |
| 16 | .IR PIN ] |
| 17 | .PP |
| 18 | .B softhsm2-util \-\-import |
| 19 | .I path |
| 20 | .RB [ \-\-file-pin |
| 21 | .IR PIN ] |
| 22 | .B \-\-token |
| 23 | .I label |
| 24 | \\ |
| 25 | .ti +0.7i |
| 26 | .RB [ \-\-pin |
| 27 | .I PIN |
| 28 | .B \-\-no\-public\-key] |
| 29 | .B \-\-label |
| 30 | .I text |
| 31 | .B \-\-id |
| 32 | .I hex |
| 33 | .PP |
| 34 | .B softhsm2-util \-\-import |
| 35 | .I path |
| 36 | .B \-\-aes |
| 37 | .B \-\-token |
| 38 | .I label |
| 39 | \\ |
| 40 | .ti +0.7i |
| 41 | .RB [ \-\-pin |
| 42 | .I PIN] |
| 43 | .B \-\-label |
| 44 | .I text |
| 45 | .B \-\-id |
| 46 | .I hex |
| 47 | .PP |
| 48 | .B softhsm2-util \-\-delete\-token |
| 49 | .B \-\-token |
| 50 | .I text |
| 51 | .SH DESCRIPTION |
| 52 | .B softhsm2-util |
| 53 | is a support tool mainly for libsofthsm2. It can also |
| 54 | be used with other PKCS#11 libraries by using the option |
| 55 | .B \-\-module |
| 56 | .PP |
| 57 | Read the sections below to get more information on |
| 58 | the libsofthsm2 and PKCS#11. |
| 59 | Most applications assumes that the token they want |
| 60 | to use is already initialized. |
| 61 | It is then up to the user |
| 62 | to initialize the PKCS#11 token. |
| 63 | This is done by using the PKCS#11 interface, |
| 64 | but instead of writing your own |
| 65 | tool you can use the |
| 66 | .B softhsm2-util |
| 67 | tool. |
| 68 | .PP |
| 69 | Keys are usually created directly in the token, |
| 70 | but the user may want to use an existing key pair. |
| 71 | Keys can be imported to a token by using the PKCS#11 interface, |
| 72 | but this tool can also be used if the |
| 73 | user has the key pair in a PKCS#8 file. |
| 74 | If you need to convert keys from |
| 75 | BIND .private-key format over to PKCS#8, |
| 76 | one can |
| 77 | use |
| 78 | .BR softhsm2-keyconv . |
| 79 | .LP |
| 80 | The libary |
| 81 | .BR libsofthsm2 , |
| 82 | known as SoftHSM, provides cryptographic functionality |
| 83 | by using the PKCS#11 API. |
| 84 | It was developed as a part of the OpenDNSSEC project, |
| 85 | thus designed to meet the requirements |
| 86 | of OpenDNSSEC, |
| 87 | but can also work together with other |
| 88 | software that want to use the functionality |
| 89 | of the PKCS#11 API. |
| 90 | .PP |
| 91 | SoftHSM is a software implementation of a generic cryptographic device with a PKCS#11 interface. |
| 92 | These devices are often called tokens. |
| 93 | Read in the manual softhsm2.conf(5) on how to create these |
| 94 | tokens and how they are added to a slot in SoftHSM. |
| 95 | .LP |
| 96 | The |
| 97 | .B PKCS#11 |
| 98 | API |
| 99 | can be used to handle and store cryptographic keys. |
| 100 | This interface |
| 101 | specifies how to communicate with cryptographic devices such as HSMs |
| 102 | (Hardware Security Modules) and smart cards. |
| 103 | The purpose of these devices |
| 104 | is, among others, |
| 105 | to generate cryptographic keys and sign information without |
| 106 | revealing private-key material to the outside world. |
| 107 | They are often designed |
| 108 | to perform well on these specific tasks |
| 109 | compared to ordinary processes in a normal computer. |
| 110 | .LP |
| 111 | .SH ACTIONS |
| 112 | .TP |
| 113 | .B \-\-delete\-token |
| 114 | Delete the token at a given slot. |
| 115 | Use with |
| 116 | .BR \-\-token |
| 117 | or |
| 118 | .BR \-\-serial . |
| 119 | Any content in token will be erased. |
| 120 | .TP |
| 121 | .B \-\-help\fR, \fB\-h\fR |
| 122 | Show the help information. |
| 123 | .TP |
| 124 | .B \-\-import \fIpath\fR |
| 125 | Import a key pair from the given |
| 126 | .IR path . |
| 127 | The file must be in PKCS#8-format. |
| 128 | .br |
| 129 | Use with |
| 130 | .BR \-\-slot |
| 131 | or |
| 132 | .BR \-\-token |
| 133 | or |
| 134 | .BR \-\-serial , |
| 135 | .BR \-\-file-pin , |
| 136 | .BR \-\-pin , |
| 137 | .BR \-\-no\-public\-key , |
| 138 | .BR \-\-label , |
| 139 | and |
| 140 | .BR \-\-id . |
| 141 | .br |
| 142 | Can also be used with |
| 143 | .BR \-\-aes |
| 144 | to use file as is and import it as AES. |
| 145 | .TP |
| 146 | .B \-\-init-token |
| 147 | Initialize the token at a given slot, token label or token serial. |
| 148 | If the token is already initialized then this command |
| 149 | will reinitialize it, thus erasing all the objects in the token. |
| 150 | The matching Security Officer (SO) PIN must also |
| 151 | be provided when doing reinitialization. |
| 152 | Initialized tokens will be reassigned to another slot (based on |
| 153 | the token serial number). |
| 154 | .br |
| 155 | Use with |
| 156 | .BR \-\-slot |
| 157 | or |
| 158 | .BR \-\-token |
| 159 | or |
| 160 | .BR \-\-serial |
| 161 | or |
| 162 | .BR \-\-free , |
| 163 | .BR \-\-label , |
| 164 | .BR \-\-so-pin , |
| 165 | and |
| 166 | .BR \-\-pin . |
| 167 | .LP |
| 168 | .TP |
| 169 | .B \-\-show-slots |
| 170 | Display all the available slots and their current status. |
| 171 | .TP |
| 172 | .B \-\-version\fR, \fB\-v\fR |
| 173 | Show the version info. |
| 174 | .SH OPTIONS |
| 175 | .TP |
| 176 | .B \-\-aes |
| 177 | Used to tell import to use file as is and import it as AES. |
| 178 | .TP |
| 179 | .B \-\-file-pin \fIPIN\fR |
| 180 | The |
| 181 | .I PIN |
| 182 | will be used to decrypt the PKCS#8 file. |
| 183 | If not given then the PKCS#8 file is assumed to be unencrypted. |
| 184 | .TP |
| 185 | .B \-\-force |
| 186 | Use this option to override the warnings and force the given action. |
| 187 | .TP |
| 188 | .B \-\-free |
| 189 | Use the first free/uninitialized token. |
| 190 | .TP |
| 191 | .B \-\-id \fIhex\fR |
| 192 | Choose an ID of the key pair. |
| 193 | The ID is in hexadecimal with a variable length. |
| 194 | Use with |
| 195 | .B \-\-force |
| 196 | when importing a key pair if the ID already exists. |
| 197 | .TP |
| 198 | .B \-\-label \fItext\fR |
| 199 | Defines the |
| 200 | .I label |
| 201 | of the object or the token that will be set. |
| 202 | .TP |
| 203 | .B \-\-module \fIpath\fR |
| 204 | Use another PKCS#11 library than SoftHSM. |
| 205 | .TP |
| 206 | .B \-\-no\-public\-key |
| 207 | Do not import the public key. |
| 208 | .TP |
| 209 | .B \-\-pin \fIPIN\fR |
| 210 | The |
| 211 | .I PIN |
| 212 | for the normal user. |
| 213 | .TP |
| 214 | .B \-\-serial \fInumber\fR |
| 215 | Will use the token with a matching serial number. |
| 216 | .TP |
| 217 | .B \-\-slot \fInumber\fR |
| 218 | The slot where the token is located. |
| 219 | .TP |
| 220 | .B \-\-so-pin \fIPIN\fR |
| 221 | The |
| 222 | .I PIN |
| 223 | for the Security Officer (SO). |
| 224 | .TP |
| 225 | .B \-\-token \fIlabel\fR |
| 226 | Will use the token with a matching token label. |
| 227 | .SH EXAMPLES |
| 228 | .LP |
| 229 | The token can be initialized using this command: |
| 230 | .LP |
| 231 | .RS |
| 232 | .nf |
| 233 | softhsm2-util \-\-init-token \-\-slot 1 \-\-label "mytoken" |
| 234 | .fi |
| 235 | .RE |
| 236 | .LP |
| 237 | A key pair can be imported using the softhsm tool where you specify the path |
| 238 | to the key file, slot number, label and ID of the new objects, and the |
| 239 | user PIN. |
| 240 | The file must be in PKCS#8 format. |
| 241 | .LP |
| 242 | .RS |
| 243 | .nf |
| 244 | softhsm2-util \-\-import key1.pem \-\-token "mytoken" \-\-label "My key" \\ |
| 245 | .ti +0.7i |
| 246 | \-\-id A1B2 \-\-pin 123456 |
| 247 | .fi |
| 248 | (Add, \-\-file-pin |
| 249 | .IR PIN , |
| 250 | if the key file is encrypted.) |
| 251 | .RE |
| 252 | .LP |
| 253 | .SH AUTHORS |
| 254 | Written by Rickard Bellgrim, Francis Dupont, René Post, and Roland van Rijswijk. |
| 255 | .LP |
| 256 | .SH "SEE ALSO" |
| 257 | .IR softhsm2-keyconv (1), |
| 258 | .IR softhsm2-migrate (1), |
| 259 | .IR softhsm2.conf (5) |