Linux 平台下Libusb & ccid & pcsc-lite & OpenSC 通用安装步骤

http://blog.csdn.net/wenjunfen   《

PCSC那事儿

》 一系列很详细,没有看呢,保存一下!

  

本文章已收录于: 
http://blog.csdn.net/jhy8421/article/details/45246947 HID、SCSI、CCID设备的通信

一、libusb 安装步骤:
1.下载安装包:
  http://www.libusb.org/
  
2.解压安装包:
  $ tar zxvf libusb-版本号.tar.gz
  
3.编译且安装:
  $ cd libusb-版本号
  $ ./configure
  $ ./make
  $ ./make install <- 要有 root 权限,Ubuntu 下可以 sudo ./make install
  
4.运行做测试:
  $ lsusb
  显示出如下类似信息则为安装成功
  Bus 002 Device 002: ID 413c:2105 Dell Computer Corp. Model L100 Keyboard

二、ccid 安装步骤:
1.下载安装包:
  http://pcsclite.alioth.debian.org

2.解压安装包:
  $ tar jxvf ccid-版本号.tar.bz2

3.编译且安装:
  $ cd ccid-版本号
  $ ./configure
  
  出现错误提示:
  configure: error: usb.h not found, install libusb or use ./configure LIBUSB_CFLAGS=…

  没有安装 libusb 。
  
  $ ./make
  $ ./make install <- 要有 root 权限,Ubuntu 下可以 sudo ./make install

  如果 ccid 读卡器的 厂商ID 和产品ID 和 产品名称 不在 info.plist 文件中的话,
  则添加它们在 <array> 列表的最后,因为这样 厂商ID 和 产品ID 和 产品名称就可以保证对应了:
  
  如下例子的  厂商ID 和 产品ID 是 飞天诚信 的 Rocky 301 读卡器,
  它已经在 ccid-1.4.5 中包含了,产品名称 一般是由 厂商名 加 型号名 组成的,
  也可以任意起,只是不便于识别。(由于新浪博客的原因,请将如下 [] 改为 <>)
  
  [key]ifdVendorID[/key] 
  [array]
      ...
      [string]0x096E[/string]
  [/array]
  
  和 
  
  [key]ifdProductID[/key] 
  [array]
      ...
      [string]0x0503[/string]
  [/array]

  和
    
  [key]ifdFriendlyName[/key]
  [array]
      ...
      [string]Feitian SCR301[/string]
  [/array]
  
  info.plist 文件在 ubuntu 更新源安装时的路径:
  /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents
  
  info.plist 文件在 ubuntu 源代码安装时的路径:
  /usr/local/pcsc/drivers/ifd-ccid.bundle/Contents

4.运行做测试:
  在安装好 pcsc-lite 后一块做测试。

三、pcsc-lite 安装步骤:
1.下载安装包:
  http://pcsclite.alioth.debian.org

2.解压安装包:
  $ tar jxvf pcsc-lite-版本号.tar.bz2

3.编译且安装:
  $ cd pcsc-lite-版本号
  $ ./configure
  
  出现类似错误提示:
  configure: error: install libhal-dev or use --disable-libhal
  
  可以选择安装 libhal 也可以用如下参数禁用它:
  $ ./configure --disable-libhal

  $ ./make
  $ ./make install <- 要有 root 权限,Ubuntu 下可以 sudo ./make install
  
4.运行做测试:
  $ /usr/local/sbin/pcscd -adf <- 要用 root 权限启动 pcscd 服务(前台运行且带输出信息)
  显示出如下类似信息则为安装成功
  00017575 pcscdaemon.c:518:main() pcsc-lite 1.8.1 daemon ready.
  
  成功启动后,按 Ctrl + C 终止 pcscd 服务进程。
  
  出现如下类似错误:
  error while loading shared libraries:
  libpkcs15init.so.2: cannot open shared object file: No such file or directory
  
  $ sudo ldconfig <- 重新加载一下动态连接库的索引
  
  出现如下类似错误:
  00001001 hotplug_libhal.c:527:HPRegisterForHotplugEvents()
  No bundle files in pcsc drivers directory: /usr/local/pcsc/drivers
  
  没有安装 ccid 驱动。

四、 安装步骤:
1.下载安装包:
  https://www.opensc-project.org/opensc

2.解压安装包:
  $ tar zxvf opensc-版本号.tar.gz

3.编译且安装:
  $ cd opensc-版本号
  $ ./configure --enable-openssl --enable-pcsc
  或
  $ ./configure --enable-openssl --enable-pcsc --with-pcsc-provider=/usr/local/lib/libpcsclite.so
  注:/usr/local/lib/libpcsclite.so 是举个例子,--with-pcsc-provider=/实际路径/libpcsclite.so
    不用 --with-pcsc-provider 参数指出的话,使用系统默认的。
  
  出现错误提示:configure: error: xsl-stylesheets are required for svn build with man
  $ ./configure --enable-openssl --enable-pcsc --disable-man

  $ ./make
  $ ./make install <- 要有 root 权限,Ubuntu 下可以 sudo ./make install

4.运行做测试:
  $ opensc-tool --list-readers
  显示出如下类似信息则为安装成功
  # Detected readers (pcsc)
  Nr.  Card  Features  Name
  0    No              Feitian SCR301 00 00
  
  $ opensc-tool --reader 0 --atr
  显示出如下类似信息则为安装成功
  3b:9f:95:81:31:fe:9f:00:65:46:53:05:30:06:71:df:00:00:00:80:00:00:b6
NEWS for OpenSC -- History of user visible changes Complete change history is available online: http://www.opensc-project.org/opensc/timeline New in 0.12.0; 2010-12-22 * OpenSC uses a single reader driver, specified at compile time. * New card driver: Italian eID (CNS) by Emanuele Pucciarelli. * New card driver: Portuguese eID by Jo茫o Poupino. * New card driver: westcos by Fran莽ois Leblanc. * pkcs11-tool can use a slot based on ID, label or index in the slot list. * PIN flags are updated from supported cards when C_GetTokenInfo is called. * Support for CardOS 4.4 cards added. * Fature to exclude readers from OpenSC PKCS#11 via "ignored_readers" configuration file entry. * #229: Support semi-automatic fixes to cards personalized with older and broken OpenSC versions. * Software keys removed from pkcs15-init and the PKCS#11 module. OpenSC can either generate keys on card or import plaintext keys to the card, but will never generate plaintext key material in software by itself. All traces of a software token (PKCS#15 Section 7) shall be removed. * Updates to PC/SC driver to build with pcsc-lite >= 1.6.2 * Build script for a binary Mac OS X installer for 10.5 and 10.6 systems. Binary installer includes OpenSC.tokend for platform integration. 10.6 installer includes engine_pkcs11. * Modify Rutoken S binary interfaces by Aktiv Co. * Support GOST R 34.10-2001 and GOST R 34.11-94 by Aktiv Co. * CardOS driver now emulates sign on rsa keys with sign+decrypt usage with padding and decrypt(). This is compatible with old cards and card initialized by Siemens software. Removed "--split-key" option, as it is no longer needed. * Improved debugging support: debug level 3 will show everything except of ASN1 and card matching debugging (usualy not needed). * Massive changes to libopensc. This library is now internal, only used by opensc-pkcs11.so and command line tools. Header files are no longer installed, library should not be used by other applications.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值