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