summaryrefslogtreecommitdiff
path: root/usr.bin/sectok/sectok.1
blob: 05b89f714f6cc91d6fc9dd044903aff4bcf20063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
.\"	$OpenBSD: sectok.1,v 1.13 2007/05/31 19:20:15 jmc Exp $
.\"
.\" Copyright (C) 2001, Jakob Schlyter. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the project nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd $Mdocdate: May 31 2007 $
.Dt SECTOK 1
.Os
.\"
.Sh NAME
.Nm sectok
.Nd communicate with smartcards using iso7816
.\"
.Sh SYNOPSIS
.Nm sectok
.Op Fl 0123
.Op Fl f Ar scriptfile
.Op Fl s Ar sleeptime
.\"
.Sh DESCRIPTION
.Nm
is a command-line-like interface for communicating with smartcards.
APDUs can be sent to the card, and results are displayed. Some
commands are card-specific, and focus on the Schlumberger Cyberflex
Access Javacards.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl 0123
Select port.
.Pp
.It Fl f Ar scriptfile
Run commands from scriptfile.
.Pp
.It Fl s Ar sleeptime
Set sleep (in milliseconds) between commands in the script.
.El
.Sh COMMANDS
.Ss Non-card commands
.Bl -tag -width Ds
.It Xo
.Cm help
.Xc
List all commands.
.It Xo
.Cm help
.Op command
.Xc
Show help for
.Ar command .
.It Xo
.Cm \&?
.Op command
.Xc
Show help for
.Ar command .
.It Xo
.Cm reset
.Op Fl 0123ivf
.Xc
Reset smartcard.
.Bl -tag -width Ds
.It Fl 0123
select port
.It Fl i
don't wait for card insertion
.It Fl v
verbose
.It Fl f
open connection even if atr is bad
.El
.It Xo
.Cm open
.Op Fl 0123ivf
.Xc
Synonym for reset.
.It Xo
.Cm close
.Xc
Close smartcard connection.
.It Xo
.Cm quit
.Xc
Quit
.Nm Li .
.El
.Ss ISO 7816-4 commands
.Bl -tag -width Ds
.It Xo
.Cm apdu
.Op Fl c Ar class
.Ar "ins p1 p2 p3 data ..."
.Xc
Send APDU to smartcard.
.It Xo
.Cm fid
.Op Fl v
.Ar fid/aid
.Xc
Select file or aid identified by
.Ar fid/aid .
.Ar fid/aid
can be a numeric fid such as 3f00, a two character name, or an aid in hex or
ASCII.
.It Xo
.Cm isearch
.Xc
Try all 256 possible instructions and print results.
.It Xo
.Cm class
.Op Ar class
.Xc
Inquire or set default application
.Ar class .
.It Xo
.Cm read
.Op Fl x
.Ar filesize
.Xc
Read selected fid and write to stdout.
.It Xo
.Cm write
.Ar input-filename
.Xc
Read from
.Ar input-filename
and write to selected fid.
.It Xo
.Cm challenge
.Op Ar length
.Xc
Get a random challenge from the card.
.It Xo
.Cm pin
.Op Fl k Ar keyno
.Op Ar PIN
.Xc
Verify CHV (PIN).
.It Xo
.Cm chpin
.Op Fl k Ar keyno
.Xc
Change CHV (PIN).
.El
.Ss Cyberflex commands
.Bl -tag -width Ds
.It Xo
.Cm ls
.Op Fl l
.Xc
List all files in current DF.
.It Xo
.Cm acl
.Ar fid
.Op Ar principal: "r1 r2 ..."
.Xc
.Bl -tag -width Ds
.It principals
world, CHV1, CHV2, AUT0, AUT1, AUT2, AUT3, AUT4
.It f_rights
r, w, x/a, inval, rehab, dec, inc
.It d_rights
l, d, a, i, manage
.El
.It Xo
.Cm create
.Ar fid
.Ar size
.Xc
.It Xo
.Cm delete
.Ar fid
.Xc
.It Xo
.Cm jdefault
.Op Fl d
.Xc
Set default applet.
.Bl -tag -width Ds
.It Fl d
set default applet to default loader
.El
.It Xo
.Cm jatr
.Xc
Set java atr.
.It Xo
.Cm jdata
.Xc
Print useful info about the card
.It Xo
.Cm login
.Op Fl d
.Op Fl k Ar keyno
.Op Fl v
.Op Fl x Ar hex-aut0
.Xc
"login" (verify AUT0 key)
.Bl -tag -width Ds
.It Fl d
use manufacturer's default AUT0 key
.El
.It Xo
.Cm jload
.Op Fl p Ar progID
.Op Fl c Ar contID
.Op Fl s Ar cont_size
.Op Fl i Ar inst_size
.Op Fl v
.Op Fl a Ar aid
.Ar filename
.Xc
Load an applet to the card.
If the first byte of the
.Ar aid
is '#' it will be converted to 0xfc.
.It Xo
.Cm junload
.Op Fl p Ar progID
.Op Fl c Ar contID
.Xc
.It Xo
.Cm jselect
.Op Fl a Ar aid
.Op Fl d
.Xc
Select applet.
.Bl -tag -width Ds
.It Fl d
select default loader
.El
.It Xo
.Cm setpass
.Op Fl d
.Op Fl x Ar hex-aut0
.Xc
.Bl -tag -width Ds
.It Fl d
use manufacturer's default AUT0 key
.El
.El
.\"
.Sh HISTORY
.Nm
first appeared in
.Ox 3.0 .
.Sh AUTHORS
.Nm
was written by Jim Rees and others at University of Michigan
Center for Information Technology Integration (CITI).
.\"