File: openct.html

package info (click to toggle)
openct 0.6.4-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,788 kB
  • ctags: 1,694
  • sloc: ansic: 15,729; sh: 8,596; xml: 651; makefile: 193
file content (1085 lines) | stat: -rw-r--r-- 35,914 bytes parent folder | download
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=UTF-8" />
    <title>OpenCT Manual</title>
    <link rel="stylesheet" href="openct.css" type="text/css" />
    <meta name="generator"
    content="DocBook XSL Stylesheets V1.64.1" />
  </head>
  <body>
    <div class="book" lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h1 class="title">
            <a id="openct"></a>OpenCT Manual</h1>
          </div>
          <div>
            <div class="author">
              <h3 class="author">
                <span class="firstname">Andreas</span>
                <span class="surname">Jellinghaus</span>
              </h3>
              <tt class="email">&lt;
              <a href="mailto:aj@dungeon.inka.de">
              aj@dungeon.inka.de</a>&gt;</tt>
            </div>
          </div>
        </div>
        <div></div>
        <hr />
      </div>
      <div class="toc">
        <p>
          <b>Table of Contents</b>
        </p>
        <dl>
          <dt>
            <span class="chapter">
              <a href="#openct.about">1. About OpenCT</a>
            </span>
          </dt>
          <dt>
            <span class="chapter">
              <a href="#openct.copyright">2. Copyright and
              license</a>
            </span>
          </dt>
          <dt>
            <span class="chapter">
              <a href="#openct.supported">3. Supported readers and
              tokens</a>
            </span>
          </dt>
          <dt>
            <span class="chapter">
              <a href="#openct.requirements">4. Requirements</a>
            </span>
          </dt>
          <dt>
            <span class="chapter">
              <a href="#openct.install">5. Installation</a>
            </span>
          </dt>
          <dt>
            <span class="chapter">
              <a href="#openct.debug">6. Debugging</a>
            </span>
          </dt>
          <dt>
            <span class="chapter">
              <a href="#openct.files">7. OpenCT files and tools</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="section">
                  <a href="#openct.files.varrunopenct">
                  /var/run/openct - OpenCT status directory</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="#openct.files.sbinopenctcontrol">
                  sbin/openct-control - OpenCT manager</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="#openct.files.sbinifdhandler">
                  sbin/ifdhandler - OpenCT device handler</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="#openct.files.opencttool">
                  bin/openct-tool</a>
                </span>
              </dt>
              <dt>
                <span class="section">
                  <a href="#openct.files.openctconf">
                  etc/openct.conf</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="chapter">
              <a href="#openct.ct-api">8. Using OpenCT via CT-API
              interface</a>
            </span>
          </dt>
          <dt>
            <span class="chapter">
              <a href="#openct.pcsc">9. Using OpenCT via PC/SC
              Lite</a>
            </span>
          </dt>
          <dt>
            <span class="chapter">
              <a href="#openct.library">10. Writing smart card
              applications using OpenCT</a>
            </span>
          </dt>
          <dt>
            <span class="chapter">
              <a href="#openct.trouble">11. Troubleshooting</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="section">
                  <a href="#openct.trouble.usb">Problems with USB
                  devices</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="chapter">
              <a href="#openct.security">12. Security</a>
            </span>
          </dt>
        </dl>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.about"></a>Chapter&#160;1.&#160;About
              OpenCT</h2>
            </div>
          </div>
          <div></div>
        </div>
        <p>This is OpenCT, a middleware framework for smart card
        terminals.</p>
        <p>It all started with a reader driver library - Olaf Kirch
        wanted to write a library to provide a framework for people
        writing drivers for smart card readers. The idea was to
        provide all the usual stuff (T=0, T=1, serial vs. USB
        device handling, etc) in a single place, and reduce driver
        writing to interaction with the device itself.</p>
        <p>OpenCT provides a native OpenCT, CT-API and PC/SC Lite
        IFD interface with an OpenCT ifdhandler resource
        manager.</p>
        <p>OpenCT is an open source implementation providing card
        terminal drivers. OpenCT was written by Olaf Kirch 
        <tt class="email">&lt;
        <a href="mailto:okir@suse.de">okir@suse.de</a>&gt;</tt>with
        contributions from the following people:</p>
        <div class="itemizedlist">
          <ul type="disc">
            <li>The checksum code for T=1 (src/ifd/checksum.c) was
            taken from Matthias Bruestle's excellent SCEZ
            library.</li>
            <li>The e-gate and CCID drivers were contributed, and
            are copyright by, Chaskiel Grundman 
            <tt class="email">&lt;
            <a href="mailto:cg2v@andrew.cmu.edu">
            cg2v@andrew.cmu.edu</a>&gt;</tt></li>
            <li>The eToken, Eutron and Rainbow iKey drivers are
            based on code written by Andreas Jellinghaus 
            <tt class="email">&lt;
            <a href="mailto:aj@dungeon.inka.de">
            aj@dungeon.inka.de</a>&gt;</tt></li>
            <li>Markus Friedl helped with the *BSD port.</li>
            <li>Support for Solaris was contributed by William
            Wanders.</li>
            <li>Thanks to Ville Skyttä for help with the
            documentation.</li>
          </ul>
        </div>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.copyright">
              </a>Chapter&#160;2.&#160;Copyright and license</h2>
            </div>
          </div>
          <div></div>
        </div>
        <p>Most of OpenCT is copyright by Olaf Kirch 
        <tt class="email">&lt;
        <a href="mailto:okir@suse.de">
        okir@suse.de</a>&gt;</tt>under BSD license, but see every
        source file for the individual authors.</p>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.supported">
              </a>Chapter&#160;3.&#160;Supported readers and
              tokens</h2>
            </div>
          </div>
          <div></div>
        </div>
        <div class="variablelist">
          <dl>
            <dt>
              <span class="term">
                <a href="http://www.chipdrive.de/cgi-bin/edcstore.cgi?user_action=detail&amp;catalogno=P209005"
                target="_top">Towitoko CHIPDRIVE micro</a>
              </span>
            </dt>
            <dd>A cheap and very popular smart card reader for the
            serial interfaces manufactured by 
            <a href="http://www.towitoko.de/" target="_top">
            Towitoko AG</a>. Fully supported.</dd>
            <dt>
              <span class="term">
                <a href="http://www.kobil.de/e/index.php?s=smartcard"
                target="_top">KOBIL KAAN Professional</a>
              </span>
            </dt>
            <dd>A smart card reader by 
            <a href="http://www.kobil.de/indexe.html"
            target="_top">KOBIL Systems</a>for the serial
            interfaces. Fully supported.</dd>
            <dt>
              <span class="term">
                <a href="http://www.readers.slb.com/Products/e-gate/e-gate.html"
                target="_top">Schlumberger e-gate</a>
              </span>
            </dt>
            <dd>A USB token / smart card reader from 
            <a href="http://www.readers.slb.com/" target="_top">
            Schlumberger</a>. It was only tested with Schlumberger
            cyberflex 32k cards. FIXME: I don't know if that
            adapter should work with other cards as well.</dd>
            <dt>
              <span class="term">
                <a href="http://www.ealaddin.com/etoken/pro/usb.asp"
                target="_top">Aladdin eToken PRO USB</a>
              </span>
            </dt>
            <dd>A USB crypto Token by 
            <a href="http://www.ealaddin.com/" target="_top">
            Aladdin Knowledge Systems</a>. Some older versions
            could have problems with non-Intel mainboards. Except
            for that issue: Fully supported.</dd>
            <dt>
              <span class="term">
                <a href="http://www.cryptoidentity.eutron.com/"
                target="_top">Eutron CryptoIdentity IT-SEC</a>
              </span>
            </dt>
            <dd>A USB crypto Token by 
            <a href="http://www.eutron.com/" target="_top">
            Eutron</a>. Fully supported.</dd>
            <dt>
              <span class="term">
                <a href="http://www.rainbow.com/products/ikey/"
                target="_top">Rainbow iKey 3000</a>
              </span>
            </dt>
            <dd>A USB crypto Token by 
            <a href="http://www.rainbow.com/" target="_top">Rainbow
            Technologies</a>. Fully supported.</dd>
            <dt>
              <span class="term">
                <a href="http://www.omnikey.com/en/kat_smartcard.php?katid=1"
                target="_top">OMNIKEY CardMan</a>
              </span>
            </dt>
            <dd>A USB smart card reader. Not fully working as of
            yet.</dd>
          </dl>
        </div>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.requirements">
              </a>Chapter&#160;4.&#160;Requirements</h2>
            </div>
          </div>
          <div></div>
        </div>
        <p>To use OpenCT with smart card readers attached to the
        serial port, you only need a kernel with a working serial
        port, nothing special is required.</p>
        <p>To use OpenCT with smart card readers attached via USB
        you need a bit more: your kernel needs to support the USB
        controller you are using. On most computers the USB
        controller is part of the mainboard. If your mainboard uses
        Intel chips you need most likely the "uhci" USB controller
        support, for other vendors most likely the "ohci"
        controller support.</p>
        <p>FIXME: Add an URL to a generic USB HOWTO</p>
        <p>You also need to compile your kernel with support for
        the USB device filesystem and mount the filesystem to 
        <tt class="filename">/proc/bus/usb</tt>. The kernel option
        is CONFIG_USB_DEVICEFS, please turn it on. To mount the
        filesystem, please edit your 
        <tt class="filename">/etc/fstab</tt>. For a Linux kernel
        2.4.* system, it should have a line</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
none    /proc/bus/usb   usbdevfs        defaults        0       0
                        
</pre>
            </td>
          </tr>
        </table>
        <p>and for a Linux kernel 2.5.* or 2.6.* system, it should
        have a line:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
none    /proc/bus/usb   usbfs           defaults        0       0
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>Run 
        <tt class="prompt">mount -a</tt>after editing the file 
        <tt class="filename">/etc/fstab</tt>for the changes to take
        effect. You can also reboot. If you are using sometimes
        Linux kernels 2.4.* and sometimes 2.5.*/2.6.*, use the line
        for kernel 2.4.*. You will get a warning, but it will still
        work.</p>
        <p>Your kernel also needs to be compiled with hotplugging
        support. The relevant kernel option is CONFIG_HOTPLUG. You
        don't need any of the hardware adapters.</p>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.install">
              </a>Chapter&#160;5.&#160;Installation</h2>
            </div>
          </div>
          <div></div>
        </div>
        <p>First, you need to build the OpenCT libraries and
        utilities. You do this by first invoking the configure
        script, for instance</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
% ./configure --prefix=/usr --sysconfdir=/etc
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>This will try configure OpenCT so it is installed below 
        <tt class="filename">/usr</tt>, and so that it expects its
        configuration file 
        <tt class="filename">/etc</tt>. If you omit the
        "--sysconfdir" option, OpenCT will look for the
        configuration file in 
        <tt class="filename">$PREFIX/etc</tt>.</p>
        <p>Next, you need to compile and install all libraries and
        utilities using</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
% make
% make install
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>Once that has completed, create the directory 
        <tt class="filename">/var/run/openct</tt>and set the
        permissions. Do this with the commands:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
# mkdir /var/run/openct
# chmod 755 /var/run/openct
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>These default permissions will allow everyone on your
        system to use smart card readers available via OpenCT. For
        details and a more restrictive setup, please consult the 
        <a href="#openct.security"
        title="Chapter&#160;12.&#160;Security">chapter on
        Security</a>.</p>
        <p>Next, you need the configuration file 
        <tt class="filename">openct.conf</tt>. The exact location
        of the file depends on how you invoked the 
        <tt class="filename">configure</tt>script, but using the
        options shown above, the file should go to 
        <tt class="filename">/etc</tt>:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
# cp etc/openct.conf /etc/
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>You need to edit the config file for any serial reader
        you might have. If you are only using USB tokens, the
        default file is already fine.</p>
        <p>Third you need an init script to perform some operations
        on startup and shutdown. OpenCT ships with an init script
        that should work at least on Debian systems. Install the
        script by copying it from the source directory:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
# cp etc/init-script /etc/init.d/openct
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>Now configure your runlevels to start the init script
        every time the system boots, and to stop the init script
        every time the system shuts down. Use whatever your
        distribution provides or a GUI tool like the KDE runlevel
        editor.</p>
        <p>Debian users can do this with a single command:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
# update-rc.d openct start 99 2 3 4 5 . stop 01 0 1 6 .
 Adding system startup for /etc/init.d/openct ...
   /etc/rc0.d/K01openct -&gt; ../init.d/openct
   /etc/rc1.d/K01openct -&gt; ../init.d/openct
   /etc/rc6.d/K01openct -&gt; ../init.d/openct
   /etc/rc2.d/S99openct -&gt; ../init.d/openct
   /etc/rc3.d/S99openct -&gt; ../init.d/openct
   /etc/rc4.d/S99openct -&gt; ../init.d/openct
   /etc/rc5.d/S99openct -&gt; ../init.d/openct
#
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>Call the init script once with "start". Or reboot.
        :-)</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
# /etc/init.d/openct start
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>And now the last task: if you want to use USB readers or
        USB crypto tokens, you need to configure the hotplug system
        to call openct every time there is a new smart card reader
        or crypto token. The future releases will work better
        without hotplug scripts because of multi-OS support issues.
        For now, we recommend you to install Linux hotplug package
        before installing OpenCT. After that, the standard install
        mechanism should add all required files correctly to
        directory 
        <tt class="filename">/etc/hotplug</tt>.</p>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.debug">
              </a>Chapter&#160;6.&#160;Debugging</h2>
            </div>
          </div>
          <div></div>
        </div>
        <p>Edit 
        <tt class="filename">openct.conf</tt>and set debug to
        4.</p>
        <p>If the problem is with some USB crypto token, please
        grep for usb_control - these are the lines we need to see
        what is happening.</p>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.files"></a>Chapter&#160;7.&#160;OpenCT
              files and tools</h2>
            </div>
          </div>
          <div></div>
        </div>
        <div class="toc">
          <p>
            <b>Table of Contents</b>
          </p>
          <dl>
            <dt>
              <span class="section">
                <a href="#openct.files.varrunopenct">
                /var/run/openct - OpenCT status directory</a>
              </span>
            </dt>
            <dt>
              <span class="section">
                <a href="#openct.files.sbinopenctcontrol">
                sbin/openct-control - OpenCT manager</a>
              </span>
            </dt>
            <dt>
              <span class="section">
                <a href="#openct.files.sbinifdhandler">
                sbin/ifdhandler - OpenCT device handler</a>
              </span>
            </dt>
            <dt>
              <span class="section">
                <a href="#openct.files.opencttool">
                bin/openct-tool</a>
              </span>
            </dt>
            <dt>
              <span class="section">
                <a href="#openct.files.openctconf">
                etc/openct.conf</a>
              </span>
            </dt>
          </dl>
        </div>
        <p>This chapter will list all tools and files and explain
        what they do.</p>
        <div class="section" lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h2 class="title" style="clear: both">
                <a id="openct.files.varrunopenct">
                </a>/var/run/openct - OpenCT status directory</h2>
              </div>
            </div>
            <div></div>
          </div>
          <p>This directory holds status files for OpenCT. Create
          it with:</p>
          <table border="0" bgcolor="#E0E0E0">
            <tr>
              <td>
                <pre class="screen">
mkdir /var/run/openct
chmod 755 /var/run/openct
                                
</pre>
              </td>
            </tr>
          </table>
          <p></p>
          <p>By default everyone can use smart cards via OpenCT.
          You can create a group "openct", assign users to that
          group, and limit access to smart cards via openct like
          this:</p>
          <table border="0" bgcolor="#E0E0E0">
            <tr>
              <td>
                <pre class="screen">
chgrp openct /var/run/openct
chmod 750 /var/run/openct
                                
</pre>
              </td>
            </tr>
          </table>
          <p></p>
        </div>
        <div class="section" lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h2 class="title" style="clear: both">
                <a id="openct.files.sbinopenctcontrol">
                </a>sbin/openct-control - OpenCT manager</h2>
              </div>
            </div>
            <div></div>
          </div>
          <p>Run openct-control once to setup the 
          <tt class="filename">status</tt>file in 
          <tt class="filename">/var/run/openct</tt>. Without that
          file OpenCT will not work.</p>
          <p></p>
          <table border="0" bgcolor="#E0E0E0">
            <tr>
              <td>
                <pre class="screen">
# /usr/sbin/openct-control
usage: openct-control [-d] [-f configfile] command
  -d   enable debugging; repeat to increase verbosity
  -n   disable coldplugging
  -f   specify config file (default /etc/openct.conf)
  -h   display this message

Where command is one of:
init - initialize OpenCT
attach device ident - attach a hotplug device
status - display status of all readers present
shutdown - shutdown OpenCT
                                
</pre>
              </td>
            </tr>
          </table>
          <p></p>
        </div>
        <div class="section" lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h2 class="title" style="clear: both">
                <a id="openct.files.sbinifdhandler">
                </a>sbin/ifdhandler - OpenCT device handler</h2>
              </div>
            </div>
            <div></div>
          </div>
          <p>This app is called by openct-control to handle one
          device, e.g. a smart card reader or an USB token.</p>
          <p></p>
          <table border="0" bgcolor="#E0E0E0">
            <tr>
              <td>
                <pre class="screen">
# /usr/sbin/ifdhandler
usage: ifdhandler [-Hds] [-r reader] driver [device]
  -r   specify index of reader
  -F   stay in foreground
  -H   hotplug device, monitor for detach
  -s   send error and debug messages to syslog
  -d   enable debugging; repeat to increase verbosity
  -h   display this message
                                
</pre>
              </td>
            </tr>
          </table>
          <p></p>
        </div>
        <div class="section" lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h2 class="title" style="clear: both">
                <a id="openct.files.opencttool">
                </a>bin/openct-tool</h2>
              </div>
            </div>
            <div></div>
          </div>
          <p></p>
          <table border="0" bgcolor="#E0E0E0">
            <tr>
              <td>
                <pre class="screen">
# /usr/bin/openct-tool
usage: openct-tool [-d] [-f configfile] [-r reader] command ...
  -d   enable debugging; repeat to increase verbosity
  -f   specify config file (default /etc/openct.conf)
  -r   specify index of reader to use
  -h   display this message

command: can be one of the following
 list  list all readers found
 atr   print ATR of card in selected reader
 wait  wait for card to be inserted
 rwait wait for reader to attached
 mf    try to select main folder of card
 read  dump memory of synchronous card
                                
</pre>
              </td>
            </tr>
          </table>
          <p></p>
        </div>
        <div class="section" lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h2 class="title" style="clear: both">
                <a id="openct.files.openctconf">
                </a>etc/openct.conf</h2>
              </div>
            </div>
            <div></div>
          </div>
          <p></p>
          <table border="0" bgcolor="#E0E0E0">
            <tr>
              <td>
                <pre class="screen">
# Set debug level
debug   = 0;
#
# Enable hot plugging
hotplug = yes;
#
# Path to ifdhandler
ifdhandler = /usr/sbin/ifdhandler;

#
# Configuration for ifdproxy (if you use it)
ifdproxy {
#       server-port     = /var/run/openct/.ifdproxy,
#       device-port     = :6666;
};

# Configure static, non-hotplug aware readers here
#
# For a list of drivers try command 'ifdhandler -i', please
# notice that not all drivers have serial device capability.

#reader towitoko {
#       driver = towitoko;
#       device = serial:/dev/ttyS0;
#};

#
# Hotplug IDs
driver  egate {
        ids = {
                usb:0973/0001,
        };
};
driver  etoken {
        ids = {
                usb:0529/050c,
                usb:0529/0514,
        };
};
driver  eutron {
        ids = {
                usb:073d/0005,
        };
};
driver  ikey2k {
        ids = {
                usb:04b9/1202,
        };
};
driver  ikey3k {
        ids = {
                usb:04b9/1300,
        };
};
driver  cardman {
        ids = {
                usb:076b/0596, # OMNIKEY CardMan 2020
                usb:076b/1784, # OMNIKEY CardMan 6020
                usb:08d4/0009, # Fujitsu Siemens SCR USB SmartCard
Reader
        };
};
driver  ccid {
        ids = {
                usb:08e6/3437,
                usb:08e6/3438,
                usb:08e6/4433,
                usb:04e6/5115,
                usb:04e6/E001,
                usb:04e6/E003,
                usb:076b/3021,
                usb:0783/0003,
        };
};
                                
</pre>
              </td>
            </tr>
          </table>
          <p></p>
        </div>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.ct-api"></a>Chapter&#160;8.&#160;Using
              OpenCT via CT-API interface</h2>
            </div>
          </div>
          <div></div>
        </div>
        <p>Install and configure the file 
        <tt class="filename">/etc/openct.conf</tt>as discussed.
        Configure your CT-API application to load 
        <tt class="filename">lib/libopenctapi.so</tt>.</p>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.pcsc"></a>Chapter&#160;9.&#160;Using
              OpenCT via PC/SC Lite</h2>
            </div>
          </div>
          <div></div>
        </div>
        <p>Install and configure the file 
        <tt class="filename">/etc/openct.conf</tt>as discussed.
        Configure PC/SC Lite /etc/reader.conf to load 
        <tt class="filename">lib/openct-ifd.so</tt>.</p>
        <p></p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
FRIENDLYNAME     "OpenCT"
DEVICENAME       OPENCT_DEV
LIBPATH          /usr/lib/openct-ifd.so
CHANNELID        1
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.library">
              </a>Chapter&#160;10.&#160;Writing smart card
              applications using OpenCT</h2>
            </div>
          </div>
          <div></div>
        </div>
        <p>OpenCT has a proprietary, but very easy to use
        interface. Take a look at the header files 
        <tt class="filename">include/openct/*.h</tt>and the library
        
        <tt class="filename">lib/libopenct.*</tt>.</p>
        <p>If your application uses autoconf, we made it easy for
        you to search for OpenCT and link with libopenct by
        shipping OpenCT with a pkg-config file: 
        <tt class="filename">lib/pkg-config/libopenct.pc</tt></p>
        <p>See the pkg-config man page for detailed
        information.</p>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.trouble">
              </a>Chapter&#160;11.&#160;Troubleshooting</h2>
            </div>
          </div>
          <div></div>
        </div>
        <div class="toc">
          <p>
            <b>Table of Contents</b>
          </p>
          <dl>
            <dt>
              <span class="section">
                <a href="#openct.trouble.usb">Problems with USB
                devices</a>
              </span>
            </dt>
          </dl>
        </div>
        <p>If something does not work, please join the OpenSC
        mailing list and ask for help. For details on the mailing
        list take a look at 
        <a href="http://www.opensc.org/" target="_top">
        http://www.opensc.org/</a></p>
        <p>If you try to use a USB device, please try this: Do you
        have a 
        <tt class="filename">/proc</tt>filesystem? This command
        should work: 
        <tt class="prompt">ls /proc/sys</tt></p>
        <p>Is your kernel compiled with USB support? Does the USB
        support work? This command should list all USB devices: 
        <tt class="prompt">lsusb</tt></p>
        <p>Is your kernel compiled with hotplugging support? This
        command give the same output on your system:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
% cat /proc/sys/kernel/hotplug
/sbin/hotplug
%
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>Do you have a hotplug script? This command should work: 
        <tt class="prompt">ls /sbin/hotplug</tt></p>
        <p>Did you create the directory 
        <tt class="filename">/var/run/openct</tt>? What files are
        in there? What are the file permissions? Try this command,
        it should work and give you a similar output:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
% ls -la /var/run/openct/
total 8
drwxr-xr-x    2 root     root         4096 2003-07-02 08:13 ./
drwxr-xr-x    8 root     root         4096 2003-07-02 08:13 ../
-rw-r--r--    1 root     root         1728 2003-07-02 08:13 status
%
                        
</pre>
            </td>
          </tr>
        </table>
        <p>See the 
        <a href="#openct.security"
        title="Chapter&#160;12.&#160;Security">security
        chapter</a>for details on file permissions of this
        directory.</p>
        <div class="section" lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h2 class="title" style="clear: both">
                <a id="openct.trouble.usb"></a>Problems with USB
                devices</h2>
              </div>
            </div>
            <div></div>
          </div>
          <p>Are you using an USB smart card reader or USB crypto
          token? What is it's USB vendor and product id? 
          <tt class="prompt">lsusb</tt>will tell you.</p>
          <p>Is that product id listed in 
          <tt class="filename">openct.conf</tt>? If not, please add
          it.</p>
          <p>If you have a file 
          <tt class="filename">
          /etc/hotplug/usb/openct.usermap</tt>, is the vendor and
          product id listed in that file?</p>
          <p>If that solves the problem, please let the OpenCT
          developers know, so we can improve the default
          configuration and documentation. You can reach us using
          the OpenSC developer mailing list at 
          <tt class="email">&lt;
          <a href="mailto:opensc-devel@opensc.org">
          opensc-devel@opensc.org</a>&gt;</tt>.</p>
        </div>
      </div>
      <div class="chapter" lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title">
              <a id="openct.security">
              </a>Chapter&#160;12.&#160;Security</h2>
            </div>
          </div>
          <div></div>
        </div>
        <p>The default setting is not very secure: all users can
        access your smart card readers. Several processes can use
        the same smart card reader at the same time, but they
        always have to be owned by the same users. (FIXME: is it
        necessary to issue a LOCK command for this, or will it
        always work like this?)</p>
        <p>You can restrict access to smart card readers using
        OpenCT to one user with these commands:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
# chown user /var/run/openct
# chmod 700 /var/run/openct
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>You can also create a group, add users to that group and
        restrict access to smart card readers using OpenCT to that
        group with these commands:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
# chgrp group /var/run/openct
# chmod 750 /var/run/openct
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
        <p>In both cases root can still access the smart card
        readers. Replace 
        <i class="replaceable">
          <tt>user</tt>
        </i>and 
        <i class="replaceable">
          <tt>group</tt>
        </i>with the user and group of your choice.</p>
        <p>If you want all users to be able to access smart card
        readers using OpenCT:</p>
        <table border="0" bgcolor="#E0E0E0">
          <tr>
            <td>
              <pre class="screen">
# chmod 755 /var/run/openct
                        
</pre>
            </td>
          </tr>
        </table>
        <p></p>
      </div>
    </div>
  </body>
</html>