OpenSC

u64_line

OpenSC -- tools and libraries for smart cards.

OpenSC provides a set of libraries and utilities to work with smart cards. Its main focus is on cards that support cryptographic operations, and facilitate their use in security applications such as authentication, mail encryption and digital signatures. OpenSC implements the PKCS#11 API so applications supporting this API (such as Mozilla Firefox and Thunderbird) can use it. On the card OpenSC implements the PKCS#15 standard and aims to be compatible with every software/card that does so, too.

OpenSC is written by an international team of volunteers and is licensed as Open Source software under the LGPL license version 2.1 of the License, or (at your option) any later version. For a list of all authors and contributors as well as detailed license information see OpenSC-Credits.

Download

More>>

OpenSC tools

OpenSC includes a number of command line tools to personalize, explore, debug and test smart cards

low level tools

  • opensc-tool is the basic test tool. With "-l" you can see the readers, with “-n” you can see if opensc identifies the card correctly. Both are necessary for OpenSC to work.

  • opensc-explorer is a small tool so you can browse your smart card with commands like ls, get information about files, read and write files and so on. Only works on some cards, as not all cards have the required functionality (for example no “ls”/“dir” command). Use pkcs15-tool (below) instead.

high level tools

  • pkcs15-init can erase your smart card, initialize it, create pins, generate keys, store certificates and keys or complete p12 bundle files on the card.

  • pkcs15-tool will show you what is on your card, lets you browse pins, certificates and keys, and lets you unblock and change pins.

  • pkcs15-crypt offers access to the crypto functionality, such as signing data or decrypting data
  • pkcs11-tool does all these things too, but uses the OpenSC PKCS#11 module. As such it works like mozilla and thus is nice for testing. It also has a test mode to check most operations. pkcs11-tool uses OpenSC PKCS#11 module by default, but will work well with any other PKCS#11 implementation specified with “—module”, too.

card specific tools

  • cardos-info prints some information for Siemens CardOS/M4 cards. will not work at all with other cards..

  • cryptoflex-tool can help you with cryptoflex cards, will not work with any other card.

  • eidenv lets you access the extra data on belgian eid cards, like card holder, photo, etc
  • netkey-tool can help you with tcos cards in netkey format. will not work with any other card.
  • PivTool used to do primative card administration operations on PIV cards. Some vendor’s cards may have additional functions not handled by the piv-tool.

low level tools

  • (DEPRECATED) opensc-config was meant to ease developing with opensc, but now we recommend to use pkg-config instead. Only provided for backwards compatibility.

Build

Get source code

git clone https://github.com/OpenSC/OpenSC.git OpenSC-code

Linux

Source from: Compiling and Installing OpenSC on Unix flavors

  • Typical Installation

    We suggest to install OpenSC into /usr and to put the configfile into /etc/opensc. The default however would be /usr/local and /usr/local/etc, so you might want to change those. We suggest to configure and compile OpenSC like this:

    tar xfvz opensc-a.b.c.tar.gz
    cd opensc-a.b.c
    ./bootstrap
    ./configure --prefix=/usr --sysconfdir=/etc/opensc
    make
    sudo make install
                                    
  • Ubuntu / Debian

    Install generic build tools

    sudo apt-get install pcscd libccid libpcsclite-dev libssl-dev libreadline-dev autoconf automake build-essential docbook-xsl xsltproc libtool pkg-config
    ./bootstrap
    ./configure --prefix=/usr --sysconfdir=/etc/opensc
    make
    sudo make install
                                    
  • Fedora

    OpenSC is included in Fedora package collection and installable with ‘yum install opensc’. The following instructions apply for building the opensc development version.

    su -c 'yum install readline-devel openssl-devel libxslt docbook-style-xsl pcsc-lite-devel automake autoconf libtool gcc'
    ./bootstrap
    ./configure --prefix=/usr --sysconfdir=/etc/opensc
    make
    sudo make install
                                    

Windows

  • Build opensc on MingW environment

    Automated OpenSC builds from OpenSC wiki.

  • Notice:

    This method needs Mingw environment and automake tools installed

  • Build opensc without MingW environment.

    Create the .rc file

    copy win32\versioninfo.rc.in win32\versioninfo.rc
    copy win32\versioninfo-customactions.rc.in win32\versioninfo-customactions.rc
    copy src\minidriver\versioninfo-minidriver.rc.in src\minidriver\versioninfo-minidriver.rc
    copy src\pkcs11\versioninfo-pkcs11.rc.in src\pkcs11\versioninfo-pkcs11.rc
    copy src\pkcs11\versioninfo-pkcs11-spy.rc.in src\pkcs11\versioninfo-pkcs11-spy.rc
    copy src\tools\versioninfo-tools.rc.in src\tools\versioninfo-tools.rc
                                    
  • Set fields value in each .rc file

    @OPENSC_VERSION_MAJOR@          => 1
    @OPENSC_VERSION_MINOR@          => 0
    @OPENSC_VERSION_FIX@                => 0
    @OPENSC_VERSION_REVISION@       => 0
    @OPENSC_VS_FF_COMMENTS@             => ""
    @OPENSC_VS_FF_COMPANY_NAME@         => "Your company name"
    @PACKAGE_NAME@                  => ""
    @OPENSC_VS_FF_LEGAL_COPYRIGHT@  => "copyright string"
    @OPENSC_VS_FF_PRODUCT_NAME@         => "product name"
                                    
  • Make .res file from .rc file

    rc.exe win32\versioninfo.rc
    rc.exe win32\versioninfo-customactions.rc
    rc.exe src\minidriver\versioninfo-minidriver.rc
    rc.exe src\pkcs11\versioninfo-pkcs11.rc
    rc.exe src\pkcs11\versioninfo-pkcs11-spy.rc
    rc.exe src\tools\versioninfo-tools.rc
                                    
  • Create config.h file

    copy win32\winconfig.h.in win32\winconfig.h
                                    
  • Build using nmake

    nmake /f Makefile.mak
                                    
  • Notice:

    This method needs Mingw environment and automake tools installed

OpenSource website

OpenSC github

Discussion

Go to JavaCardOS Forum

Follow us