.\" $OpenBSD: sectok.1,v 1.15 2007/12/30 19:23:53 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: December 30 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 .Op Ar command Op Ar arg ... .\" .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). .\"