리눅스에서 SmartCard 을 이용한 작업을 하는데 막히는 부분이 있어 질문드립니다.

moonjw1520의 이미지

안녕하세요 ..
Linux에서 스마트카드 리더기를 사용하여 스마트카드의 내용을 읽어와서 작업을 해야하는 상황입니다.

보통 serial port을 사용할 경우
fd = open("/dev/cua0", O_RDWR);
이런식으로 device의 fd을 가져와서 사용 하는 것으로 알고 있습니다.

저는 usb SmartCard Reader을 사용하는데
device의 fd을 가져오기 위해서 device의 path을 알아야 되는데
path을 모르겠습니다.

---제가 해본 테스트---
lsusb 실행
Bus 002 Device 003: ID 076b:1021 OmniKey AG CardMan 1021
위와같이 리더기의 usb의 정보가 위와 같이 나와서
fd = open("/dev/bus/usb/002/003", O_RDONLY);
(crw-rw-r-- 1 root root 189, 130 2012-04-02 00:53 /dev/bus/usb/002/003
flag을 O_RDONLY 바꾼 이유는 other권한이 읽기 밖에 없어서 바꿨습니다.)

실행을 시키니 fd는 가지고 오는데
struct termios termio;
tcgetattr(fd, &termio) 에서 Error을 return 을 합니다.

opensc-tool -l 을 실행 했을 때 내용입니다.

Nr. Driver Name
0 openct OpenCT reader (detached)
1 openct OpenCT reader (detached)
2 pcsc OMNIKEY CardMan 1021 00 00

pcsc_scan 을 실행했을 때 내용입니다.

PC/SC device scanner
V 1.4.16 (c) 2001-2009, Ludovic Rousseau
Compiled with PC/SC lite version: 1.5.3
Scanning present readers...
0: OMNIKEY CardMan 1021 00 00

Mon Apr 2 23:01:58 2012
Reader 0: OMNIKEY CardMan 1021 00 00
Card state: Card inserted,
ATR: 3B 69 00 00 80 63 48 46 37 83 03 90 00

ATR: 3B 69 00 00 80 63 48 46 37 83 03 90 00
+ TS = 3B --> Direct Convention
+ T0 = 69, Y(1): 0110, K: 9 (historical bytes)
TB(1) = 00 --> VPP is not electrically connected
TC(1) = 00 --> Extra guard time: 0
+ Historical bytes: 80 63 48 46 37 83 03 90 00
Category indicator byte: 80 (compact TLV data object)
Tag: 6, len: 3 (pre-issuing data)
Data: 48 46 37
Tag: 8, len: 3 (status indicator)
LCS (life card cycle): 03 (Initialisation state)
SW: 9000 (Normal processing.)

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
NONE

Your card is not present in the database.
You can get the latest version of the database from
http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt
or use: wget http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt --output-document=/home/mun15/.smartcard_list.txt

If your ATR is still not in the latest version then please send a mail
to containing:
- your ATR
- a card description (in english)

---질문을 요약---
1. 제가 저기서 사용한 path(/dev/bus/usb/002/003)가 맞는것인지 아니면 어떤 Path 사용해야되는지
2. 만약 mknod을 이용하여 장치 파일을 만들어야되면 device의 주번호를 알아야되는데 주 번호를 알 수 있는 방법이 궁금합니다.
3. 해당 스마트카드 리더기의 driver을 설치 하였는데 이게 정확하게 어떤 역할을 하는지를 모르겠습니다.
(install하면 /usr/lib/pcsc/drivers에 .so 가 있는 디렉토리를 복사하고 다른디렉토리에는 다른 파일들을 copy하는데...)

감사합니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.