You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(10) |
Feb
(10) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(17) |
Sep
(9) |
Oct
(10) |
Nov
(2) |
Dec
(5) |
| 2009 |
Jan
(17) |
Feb
(8) |
Mar
(10) |
Apr
(1) |
May
|
Jun
(11) |
Jul
(18) |
Aug
|
Sep
|
Oct
(10) |
Nov
(40) |
Dec
(4) |
| 2010 |
Jan
(2) |
Feb
(5) |
Mar
(13) |
Apr
(14) |
May
(27) |
Jun
(86) |
Jul
(1) |
Aug
(12) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(5) |
| 2011 |
Jan
|
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
(11) |
Aug
(1) |
Sep
(3) |
Oct
(65) |
Nov
|
Dec
(1) |
| 2012 |
Jan
(1) |
Feb
(4) |
Mar
(6) |
Apr
(6) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
(12) |
Oct
(3) |
Nov
(1) |
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
(1) |
| 2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(4) |
Oct
(1) |
Nov
(24) |
Dec
(10) |
| 2015 |
Jan
(1) |
Feb
(10) |
Mar
|
Apr
|
May
(1) |
Jun
(15) |
Jul
(4) |
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: <lu...@us...> - 2015-02-18 17:53:13
|
Revision: 668
http://sourceforge.net/p/pyscard/code/668
Author: ludov
Date: 2015-02-18 17:47:21 +0000 (Wed, 18 Feb 2015)
Log Message:
-----------
Use from ... instead of import ...
https://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Packages
Modified Paths:
--------------
trunk/contrib/parseATR/parseATR.py
Modified: trunk/contrib/parseATR/parseATR.py
===================================================================
--- trunk/contrib/parseATR/parseATR.py 2015-02-18 17:42:05 UTC (rev 667)
+++ trunk/contrib/parseATR/parseATR.py 2015-02-18 17:47:21 UTC (rev 668)
@@ -24,12 +24,12 @@
ATR_MAX_PROTOCOLS = 7
T = -1
-import exceptions
+from exceptions import Exception
import re
-import types
+from types import StringTypes
-class ParseAtrException(exceptions.Exception):
+class ParseAtrException(Exception):
""" Base class for exceptions in this module """
def __init__(self, text):
@@ -736,7 +736,7 @@
def colorize_line(line, left, right):
# colorize data from the format: foo: data, ...
- if isinstance(line, types.StringTypes):
+ if isinstance(line, StringTypes):
return line
template = line[0]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2015-02-18 17:37:43
|
Revision: 666
http://sourceforge.net/p/pyscard/code/666
Author: ludov
Date: 2015-02-18 17:37:41 +0000 (Wed, 18 Feb 2015)
Log Message:
-----------
Fix PEP8
parseATR.py:904:9: E265 block comment should start with '# '
Modified Paths:
--------------
trunk/contrib/parseATR/parseATR.py
Modified: trunk/contrib/parseATR/parseATR.py
===================================================================
--- trunk/contrib/parseATR/parseATR.py 2015-02-18 17:36:47 UTC (rev 665)
+++ trunk/contrib/parseATR/parseATR.py 2015-02-18 17:37:41 UTC (rev 666)
@@ -901,7 +901,7 @@
if len(sys.argv) > 1:
ATR = " ".join(sys.argv[1:])
else:
- #ATR = "3B A7 00 40 18 80 65 A2 08 01 01 52"
+ # ATR = "3B A7 00 40 18 80 65 A2 08 01 01 52"
ATR = "3F FF 95 00 FF 91 81 71 A0 47 00 44 4E 41 53 50 30 31 31 20 52 65 76 42 30 36 4E"
atr = parseATR(ATR)
print "ATR:", toHexString(normalize(ATR))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2015-02-18 17:36:49
|
Revision: 665
http://sourceforge.net/p/pyscard/code/665
Author: ludov
Date: 2015-02-18 17:36:47 +0000 (Wed, 18 Feb 2015)
Log Message:
-----------
Reindent
Fix pep8:
parseATR.py:859:13: E128 continuation line under-indented for visual indent
parseATR.py:860:13: E128 continuation line under-indented for visual indent
parseATR.py:861:13: E128 continuation line under-indented for visual indent
Modified Paths:
--------------
trunk/contrib/parseATR/parseATR.py
Modified: trunk/contrib/parseATR/parseATR.py
===================================================================
--- trunk/contrib/parseATR/parseATR.py 2015-02-18 17:35:50 UTC (rev 664)
+++ trunk/contrib/parseATR/parseATR.py 2015-02-18 17:36:47 UTC (rev 665)
@@ -856,9 +856,9 @@
db_list.append(cache + "/smartcard_list.txt")
db_list += [os.environ['HOME'] + "/.smartcard_list.txt",
- "/usr/local/pcsc/smartcard_list.txt",
- "/usr/share/pcsc/smartcard_list.txt",
- "/usr/local/share/pcsc/smartcard_list.txt"]
+ "/usr/local/pcsc/smartcard_list.txt",
+ "/usr/share/pcsc/smartcard_list.txt",
+ "/usr/local/share/pcsc/smartcard_list.txt"]
for atr_file in db_list:
try:
file = open(atr_file)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2015-02-18 17:35:53
|
Revision: 664
http://sourceforge.net/p/pyscard/code/664
Author: ludov
Date: 2015-02-18 17:35:50 +0000 (Wed, 18 Feb 2015)
Log Message:
-----------
colorize_line(): rewrite code
Avoid a long line and (try to) make the code easier to read.
Fix pep8:
parseATR.py:736:9: E128 continuation line under-indented for visual indent
parseATR.py:737:9: E128 continuation line under-indented for visual indent
Modified Paths:
--------------
trunk/contrib/parseATR/parseATR.py
Modified: trunk/contrib/parseATR/parseATR.py
===================================================================
--- trunk/contrib/parseATR/parseATR.py 2015-02-18 17:10:54 UTC (rev 663)
+++ trunk/contrib/parseATR/parseATR.py 2015-02-18 17:35:50 UTC (rev 664)
@@ -732,9 +732,9 @@
if isinstance(line, types.StringTypes):
return line
- template = line[0].replace("%s", left + "%s" +
- right).replace("%d", left + "%d" + right).replace("%g", left
- + "%g" + right)
+ template = line[0]
+ for text in ["%s", "%d", "%g"]:
+ template = template.replace(text, left + text + right)
flattened = template % line[1]
return flattened
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2015-02-18 17:10:57
|
Revision: 663
http://sourceforge.net/p/pyscard/code/663
Author: ludov
Date: 2015-02-18 17:10:54 +0000 (Wed, 18 Feb 2015)
Log Message:
-----------
Add Author and Licence chapters
Modified Paths:
--------------
trunk/contrib/parseATR/README.rst
Modified: trunk/contrib/parseATR/README.rst
===================================================================
--- trunk/contrib/parseATR/README.rst 2015-02-18 17:10:31 UTC (rev 662)
+++ trunk/contrib/parseATR/README.rst 2015-02-18 17:10:54 UTC (rev 663)
@@ -3,7 +3,31 @@
This Python code parses a smart card ATR and display the result.
+Author
+******
+Ludovic Rousseau <lud...@fr...>
+
+Licence
+*******
+
+ Copyright (C) 2009-2015 Ludovic Rousseau
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
parseATR.py
***********
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2015-02-18 17:10:34
|
Revision: 662
http://sourceforge.net/p/pyscard/code/662
Author: ludov
Date: 2015-02-18 17:10:31 +0000 (Wed, 18 Feb 2015)
Log Message:
-----------
Update copyright date
Modified Paths:
--------------
trunk/contrib/parseATR/parseATR.py
Modified: trunk/contrib/parseATR/parseATR.py
===================================================================
--- trunk/contrib/parseATR/parseATR.py 2015-02-18 17:07:24 UTC (rev 661)
+++ trunk/contrib/parseATR/parseATR.py 2015-02-18 17:10:31 UTC (rev 662)
@@ -1,7 +1,7 @@
#! /usr/bin/env python
"""
parseATR: convert an ATR in a human readable format
- Copyright (C) 2009-2012 Ludovic Rousseau
+ Copyright (C) 2009-2015 Ludovic Rousseau
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2015-02-18 17:07:34
|
Revision: 661
http://sourceforge.net/p/pyscard/code/661
Author: ludov
Date: 2015-02-18 17:07:24 +0000 (Wed, 18 Feb 2015)
Log Message:
-----------
Add a README.rst file with minimal documentation
Added Paths:
-----------
trunk/contrib/parseATR/README.rst
Added: trunk/contrib/parseATR/README.rst
===================================================================
--- trunk/contrib/parseATR/README.rst (rev 0)
+++ trunk/contrib/parseATR/README.rst 2015-02-18 17:07:24 UTC (rev 661)
@@ -0,0 +1,25 @@
+parseATR
+########
+
+This Python code parses a smart card ATR and display the result.
+
+
+parseATR.py
+***********
+
+Display the result as text
+
+Usage:
+
+ $ ./parseATR.py 3B A7 00 40 18 80 65 A2 08 01 01 52
+
+
+parseATRhtml.py
+***************
+
+Display the result as HTML
+
+Usage:
+
+ $ ./parseATRhtml.py 3B A7 00 40 18 80 65 A2 08 01 01 52
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2015-02-05 19:28:16
|
Revision: 660
http://sourceforge.net/p/pyscard/code/660
Author: ludov
Date: 2015-02-05 19:28:13 +0000 (Thu, 05 Feb 2015)
Log Message:
-----------
Fix "Maximum number of logical channels" value
See ISO 7816-4, 8.1.1.2.7 Card capabilities, table 88.
Thanks to Kevin Su (?\232?\152?\135?\229?\152?\137?\232?\136?\136) for the bugs report.
Modified Paths:
--------------
trunk/contrib/parseATR/parseATR.py
Modified: trunk/contrib/parseATR/parseATR.py
===================================================================
--- trunk/contrib/parseATR/parseATR.py 2015-01-05 09:32:49 UTC (rev 659)
+++ trunk/contrib/parseATR/parseATR.py 2015-02-05 19:28:13 UTC (rev 660)
@@ -486,7 +486,7 @@
t = ["No logical channel\n", "by the interface device\n", "by the card\n", "by the interface device and card\n"]
text.append(" - Logical channel number assignment: " + t[v])
- text.append(" - Maximum number of logical channels: %d\n" % (cc & 7))
+ text.append(" - Maximum number of logical channels: %d\n" % (1 + cc & 7))
return ''.join(text)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2015-01-05 09:32:52
|
Revision: 659
http://sourceforge.net/p/pyscard/code/659
Author: ludov
Date: 2015-01-05 09:32:49 +0000 (Mon, 05 Jan 2015)
Log Message:
-----------
Add support of cygwin as a build plateform
Thanks to Olivier FAURAX for the bug report and testing.
Closes bug #19 Unable to compile under cygwin
http://sourceforge.net/p/pyscard/bugs/19/
Modified Paths:
--------------
trunk/pyscard/src/setup.py
Modified: trunk/pyscard/src/setup.py
===================================================================
--- trunk/pyscard/src/setup.py 2014-12-13 16:20:55 UTC (rev 658)
+++ trunk/pyscard/src/setup.py 2015-01-05 09:32:49 UTC (rev 659)
@@ -51,6 +51,15 @@
platform_include_dirs = []
platform_extra_compile_args = []
platform_extra_link_args = []
+
+elif 'cygwin-' in get_platform():
+ platform__cc_defines = [('WIN32', '100')]
+ platform_swig_opts = ['-DWIN32']
+ platform_sources = []
+ platform_libraries = ['winscard']
+ platform_include_dirs = []
+ platform_extra_compile_args = []
+ platform_extra_link_args = []
#
# Mac OS X Tiger has python 2.3 preinstalled
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-12-13 16:20:58
|
Revision: 658
http://sourceforge.net/p/pyscard/code/658
Author: ludov
Date: 2014-12-13 16:20:55 +0000 (Sat, 13 Dec 2014)
Log Message:
-----------
Release 1.6.16
Added Paths:
-----------
tags/release-1.6.16/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-12-13 16:19:02
|
Revision: 657
http://sourceforge.net/p/pyscard/code/657
Author: ludov
Date: 2014-12-13 16:18:59 +0000 (Sat, 13 Dec 2014)
Log Message:
-----------
Release 1.6.16
Modified Paths:
--------------
trunk/pyscard/src/smartcard/ChangeLog
Modified: trunk/pyscard/src/smartcard/ChangeLog
===================================================================
--- trunk/pyscard/src/smartcard/ChangeLog 2014-12-13 12:28:02 UTC (rev 656)
+++ trunk/pyscard/src/smartcard/ChangeLog 2014-12-13 16:18:59 UTC (rev 657)
@@ -1,10 +1,11 @@
-1.6.16 (Decembre 2012s)
+1.6.16 (December 2014)
===================
* added support for windows 64bit amd64 (Jean-Daniel Aussel)
* support python "new" classes (derive classes from object) (Ludovic Rousseau from chrysn feature request ID 3110077)
* fixed Reader.__eq__() (Ludovic Rousseau from Bernard Paulus bug ID 3418113)
* fixed extended APDU transmit buffer too short by 2 (Jean-Daniel Aussel from bugs ID 2914636 and 3106761)
- + make Card and Reader objects hashable (Jean-Daniel Aussel from Hans-Peter Jansen feature request and patch)
+ * make Card and Reader objects hashable (Jean-Daniel Aussel from Hans-Peter Jansen feature request and patch)
+ * convert the user guide to python-Sphinx
1.6.12 (August 2010)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-12-13 12:28:10
|
Revision: 656
http://sourceforge.net/p/pyscard/code/656
Author: ludov
Date: 2014-12-13 12:28:02 +0000 (Sat, 13 Dec 2014)
Log Message:
-----------
Correct chapter title
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/index.rst
Modified: trunk/pyscard/src/smartcard/doc/index.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 10:45:16 UTC (rev 655)
+++ trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 12:28:02 UTC (rev 656)
@@ -24,8 +24,8 @@
.. image:: ../doc/images/pyscard.jpg
:align: center
-Documentation Index
-*******************
+Documentation
+*************
:ref:`pyscard_user_guide`
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-12-13 10:45:19
|
Revision: 655
http://sourceforge.net/p/pyscard/code/655
Author: ludov
Date: 2014-12-13 10:45:16 +0000 (Sat, 13 Dec 2014)
Log Message:
-----------
Update the download URL
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/index.rst
Modified: trunk/pyscard/src/smartcard/doc/index.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 10:44:15 UTC (rev 654)
+++ trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 10:45:16 UTC (rev 655)
@@ -5,7 +5,8 @@
<https://sourceforge.net/projects/pyscard/>`_ is a python module adding
smart cards support to `python <http://www.python.org/>`_.
-`download <http://sourceforge.net/projects/pyscard/>`_ pyscard from sourceforge.net.
+`download <https://sourceforge.net/projects/pyscard/files/pyscard/>`_
+pyscard from sourceforge.net.
Report bugs, patches and feature requests using the `sourceforge pyscard
bug tracking system <https://sourceforge.net/p/pyscard/_list/tickets>`_.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-12-13 10:44:23
|
Revision: 654
http://sourceforge.net/p/pyscard/code/654
Author: ludov
Date: 2014-12-13 10:44:15 +0000 (Sat, 13 Dec 2014)
Log Message:
-----------
Add a link to the sourceforge project page
Link to the sourceforge.org home project page.
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/index.rst
Modified: trunk/pyscard/src/smartcard/doc/index.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 10:42:29 UTC (rev 653)
+++ trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 10:44:15 UTC (rev 654)
@@ -1,8 +1,9 @@
pyscard - python for smart cards
################################
-pyscard - python smart card library - is a python module adding smart
-cards support to `python <http://www.python.org/>`_.
+`pyscard - python smart card library -
+<https://sourceforge.net/projects/pyscard/>`_ is a python module adding
+smart cards support to `python <http://www.python.org/>`_.
`download <http://sourceforge.net/projects/pyscard/>`_ pyscard from sourceforge.net.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-12-13 10:42:32
|
Revision: 653
http://sourceforge.net/p/pyscard/code/653
Author: ludov
Date: 2014-12-13 10:42:29 +0000 (Sat, 13 Dec 2014)
Log Message:
-----------
Add the toctree
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/index.rst
Modified: trunk/pyscard/src/smartcard/doc/index.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 10:40:52 UTC (rev 652)
+++ trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 10:42:29 UTC (rev 653)
@@ -40,3 +40,24 @@
High level API samples: See :ref:`framework_samples`
Low level API samples: See :ref:`wrapper_samples`
+
+Index
+*****
+
+Contents:
+
+.. toctree::
+ :maxdepth: 4
+
+ user-guide
+ pyscard-framework
+ pyscard-wrapper
+ license
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-12-13 10:40:55
|
Revision: 652
http://sourceforge.net/p/pyscard/code/652
Author: ludov
Date: 2014-12-13 10:40:52 +0000 (Sat, 13 Dec 2014)
Log Message:
-----------
Move main.rst in index.rst
Added Paths:
-----------
trunk/pyscard/src/smartcard/doc/index.rst
Removed Paths:
-------------
trunk/pyscard/src/smartcard/doc/index.rst
trunk/pyscard/src/smartcard/doc/main.rst
Deleted: trunk/pyscard/src/smartcard/doc/index.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.rst 2014-12-11 13:28:09 UTC (rev 651)
+++ trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 10:40:52 UTC (rev 652)
@@ -1,26 +0,0 @@
-.. pyscard documentation master file, created by
- sphinx-quickstart on Thu Dec 4 14:38:51 2014.
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
-Welcome to pyscard's documentation!
-===================================
-
-Contents:
-
-.. toctree::
- :maxdepth: 4
-
- main
- user-guide
- pyscard-framework
- pyscard-wrapper
- license
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
Copied: trunk/pyscard/src/smartcard/doc/index.rst (from rev 651, trunk/pyscard/src/smartcard/doc/main.rst)
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.rst (rev 0)
+++ trunk/pyscard/src/smartcard/doc/index.rst 2014-12-13 10:40:52 UTC (rev 652)
@@ -0,0 +1,42 @@
+pyscard - python for smart cards
+################################
+
+pyscard - python smart card library - is a python module adding smart
+cards support to `python <http://www.python.org/>`_.
+
+`download <http://sourceforge.net/projects/pyscard/>`_ pyscard from sourceforge.net.
+
+Report bugs, patches and feature requests using the `sourceforge pyscard
+bug tracking system <https://sourceforge.net/p/pyscard/_list/tickets>`_.
+
+Pyscard consists of:
+
+* `smartcard.scard
+ <http://pyscard.sourceforge.net/epydoc/smartcard.scard.scard-module.html>`_,
+ an extension module wrapping the WinSCard API (smart card base
+ components) also known as PC/SC, and
+
+* `smartcard <http://pyscard.sourceforge.net/epydoc/index.html>`_, a
+ higher level python framework built on top of the raw PC/SC API.
+
+.. image:: ../doc/images/pyscard.jpg
+ :align: center
+
+Documentation Index
+*******************
+
+ :ref:`pyscard_user_guide`
+
+ `smartcard reference (python smart card library)
+ <http://pyscard.sourceforge.net/epydoc/index.html>`_
+
+ `scard reference (python PCSC wrapper)
+ <http://pyscard.sourceforge.net/epydoc/smartcard.scard.scard-module.html>`_,
+ the python wrapper around PCSC
+
+Samples
+*******
+
+ High level API samples: See :ref:`framework_samples`
+
+ Low level API samples: See :ref:`wrapper_samples`
Deleted: trunk/pyscard/src/smartcard/doc/main.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/main.rst 2014-12-11 13:28:09 UTC (rev 651)
+++ trunk/pyscard/src/smartcard/doc/main.rst 2014-12-13 10:40:52 UTC (rev 652)
@@ -1,42 +0,0 @@
-pyscard - python for smart cards
-################################
-
-pyscard - python smart card library - is a python module adding smart
-cards support to `python <http://www.python.org/>`_.
-
-`download <http://sourceforge.net/projects/pyscard/>`_ pyscard from sourceforge.net.
-
-Report bugs, patches and feature requests using the `sourceforge pyscard
-bug tracking system <https://sourceforge.net/p/pyscard/_list/tickets>`_.
-
-Pyscard consists of:
-
-* `smartcard.scard
- <http://pyscard.sourceforge.net/epydoc/smartcard.scard.scard-module.html>`_,
- an extension module wrapping the WinSCard API (smart card base
- components) also known as PC/SC, and
-
-* `smartcard <http://pyscard.sourceforge.net/epydoc/index.html>`_, a
- higher level python framework built on top of the raw PC/SC API.
-
-.. image:: ../doc/images/pyscard.jpg
- :align: center
-
-Documentation Index
-*******************
-
- :ref:`pyscard_user_guide`
-
- `smartcard reference (python smart card library)
- <http://pyscard.sourceforge.net/epydoc/index.html>`_
-
- `scard reference (python PCSC wrapper)
- <http://pyscard.sourceforge.net/epydoc/smartcard.scard.scard-module.html>`_,
- the python wrapper around PCSC
-
-Samples
-*******
-
- High level API samples: See :ref:`framework_samples`
-
- Low level API samples: See :ref:`wrapper_samples`
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-12-11 13:28:13
|
Revision: 651
http://sourceforge.net/p/pyscard/code/651
Author: ludov
Date: 2014-12-11 13:28:09 +0000 (Thu, 11 Dec 2014)
Log Message:
-----------
Update to use the Sphinx generated doc
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/sync.sh
Modified: trunk/pyscard/src/smartcard/doc/sync.sh
===================================================================
--- trunk/pyscard/src/smartcard/doc/sync.sh 2014-12-11 12:54:06 UTC (rev 650)
+++ trunk/pyscard/src/smartcard/doc/sync.sh 2014-12-11 13:28:09 UTC (rev 651)
@@ -3,4 +3,4 @@
set -e
set -v
-scp *.html lu...@we...:/home/project-web/pyscard/htdocs/
+scp -r _build/html/* lu...@we...:/home/project-web/pyscard/htdocs/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-12-11 12:54:08
|
Revision: 650
http://sourceforge.net/p/pyscard/code/650
Author: ludov
Date: 2014-12-11 12:54:06 +0000 (Thu, 11 Dec 2014)
Log Message:
-----------
Remove old documentation
The documentation is now in Sphinx format
Removed Paths:
-------------
trunk/pyscard/src/smartcard/doc/framework-samples.html
trunk/pyscard/src/smartcard/doc/index.html
trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html
trunk/pyscard/src/smartcard/doc/scard-samples.html
Deleted: trunk/pyscard/src/smartcard/doc/framework-samples.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-12-11 11:22:22 UTC (rev 649)
+++ trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-12-11 12:54:06 UTC (rev 650)
@@ -1,145 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
- <meta name="generator" content=
- "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
-
- <title>smartcard python framework samples</title>
-</head>
-
-<body bgcolor="#FFFFFF">
- <h1 align="center">pyscard library samples</h1><a href=
- "http://sourceforge.net/projects/pyscard"><img src=
- "http://sflogo.sourceforge.net/sflogo.php?group_id=196342&type=11"
- width="120" height="30" align="right" alt=
- "Get pyscard at SourceForge.net. Fast, secure and Free Open Source software downloads"></a>
- <hr>
-
- Last update : pyscard 1.6.16 (Decembre 2012)
-
- <p><a href="pyscard-usersguide.html">pyscard</a> is a python
- module adding smart cards support to <a href=
- "http://www.python.org">python</a>.</p>
-
- <p>It consists of <a href=
- "epydoc/smartcard.scard.scard-module.html">smartcard.scard</a>,
- an extension module wrapping Windows smart card base components
- (also known as PCSC), and <a href=
- "epydoc/index.html">smartcard</a>, a python framework library
- hiding PCSC complexity.</p>
-
- <p align="center"><img src="images/pyscard.jpg" width="396"
- height="540" align="middle" alt="pyscard"></p>
-
- <h2>Smartcard python framework samples</h2>
-
- <table summary="samples" border>
- <tr>
- <td width="327">Display the ATR of inserted cards</td>
-
- <td width="76"><a href="Examples/simple/getATR.py">view
- source</a></td>
- </tr>
-
- <tr>
- <td width="327">Selecting the DF_TELECOM of a card</td>
-
- <td width="76"><a href=
- "Examples/simple/selectDF_TELECOM.py">view source</a></td>
- </tr>
-
- <tr>
- <td width="327">A simple apdu tracer and interpreter</td>
-
- <td width="76"><a href=
- "Examples/framework/sample_apduTracerInterpreter.py">view
- source</a></td>
- </tr>
-
- <tr>
- <td width="327">Tracing connection events</td>
-
- <td width="76"><a href=
- "Examples/framework/sample_ConsoleConnectionTracer.py">view
- source</a></td>
- </tr>
-
- <tr>
- <td width="327">Decorating Card Connections to add custom
- behavior</td>
-
- <td width="76"><a href=
- "Examples/framework/sample_CardConnectionDecorator.py">view
- source</a></td>
- </tr>
-
- <tr>
- <td width="327">Detecting response apdu errors</td>
-
- <td width="76"><a href=
- "Examples/framework/sample_ErrorChecking.py">view
- source</a></td>
- </tr>
-
- <tr>
- <td width="327">Implementing a custom ErrorChecker</td>
-
- <td width="76"><a href=
- "Examples/framework/sample_CustomErrorChecker.py">view
- source</a></td>
- </tr>
-
- <tr>
- <td width="327">Implementing a custom card type</td>
-
- <td width="76"><a href=
- "Examples/framework/sample_CustomCardType.py">view
- source</a></td>
- </tr>
-
- <tr>
- <td width="327">Monitoring smartcard readers</td>
-
- <td width="76"><a href=
- "Examples/framework/sample_MonitorReaders.py">view
- source</a></td>
- </tr>
-
- <tr>
- <td width="327">Monitoring smartcard insertion/removal</td>
-
- <td width="76"><a href=
- "Examples/framework/sample_MonitorCards.py">view
- source</a></td>
- </tr>
-
- <tr>
- <td width="327">APDU/ATR byte to string utilities</td>
-
- <td width="76"><a href=
- "Examples/framework/sample_toHexString.py">view
- source</a></td>
- </tr>
- </table>
- <hr>
-
- <p>This file is part of pyscard.</p>
-
- <p>pyscard is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later
- version.</p>
-
- <p>pyscard is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.</p>
-
- <p>You should have received a copy of the GNU Lesser General
- Public License along with pyscard; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA</p>
-</body>
-</html>
Deleted: trunk/pyscard/src/smartcard/doc/index.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.html 2014-12-11 11:22:22 UTC (rev 649)
+++ trunk/pyscard/src/smartcard/doc/index.html 2014-12-11 12:54:06 UTC (rev 650)
@@ -1,88 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
- <meta name="generator" content=
- "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
-
- <title>pyscard - python for smart cards</title>
-</head>
-
-<body bgcolor="#FFFFFF">
- <h1 align="center">pyscard<a href=
- "http://sourceforge.net/projects/pyscard"></a> <a href=
- "http://sourceforge.net/projects/pyscard"><img src=
- "http://sflogo.sourceforge.net/sflogo.php?group_id=196342&type=11"
- width="120" height="30" align="right" alt=
- "Get pyscard at SourceForge.net. Fast, secure and Free Open Source software downloads">
- </a></h1>
- <hr>
- Last update : pyscard 1.6.16 (Decembre 2012)
-
- <p><a href="pyscard-usersguide.html">pyscard - python smart card
- library</a> is a python module adding smart cards support to
- <a href="http://www.python.org">python.</a></p>
-
- <p><a href=
- "http://sourceforge.net/projects/pyscard/">download</a> pyscard
- from sourceforge.net.</p>
-
- <p>Report bugs, patches and feature requests using the
- sourceforge <a href=
- "https://sourceforge.net/p/pyscard/_list/tickets">pyscard bug
- tracking system</a>.</p>
-
- <p>Pyscard consists of <a href=
- "epydoc/smartcard.scard.scard-module.html">smartcard.scard</a>,
- an extension module wrapping Windows smart card base components
- (also known as PCSC) on Windows and PCSC lite on linux and Mac OS
- X Tiger and later versions, and <a href=
- "epydoc/index.html">smartcard</a>, a higher level python
- framework built on top of the raw PCSC API.</p>
-
- <p align="center"><img src="images/pyscard.jpg" width="396"
- height="540" align="middle" alt="pyscard"></p>
-
- <h2>Documentation Index</h2>
-
- <ul>
- <li>pyscard <a href="pyscard-usersguide.html">user's
- guide</a></li>
-
- <li><a href="epydoc/index.html">smartcard reference (python
- smart card library)</a></li>
-
- <li><a href="epydoc/smartcard.scard.scard-module.html">scard
- reference (python PCSC wrapper)</a>, the python wrapper around
- PCSC</li>
- </ul>
-
- <h2>Samples</h2>
-
- <ul>
- <li><a href="framework-samples.html">pyscard smartcard
- framework samples</a></li>
-
- <li><a href="scard-samples.html">PCSC wrapper samples</a></li>
- </ul>
- <hr>
-
- <p>This file is part of pyscard.</p>
-
- <p>pyscard is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later
- version.</p>
-
- <p>pyscard is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.</p>
-
- <p>You should have received a copy of the GNU Lesser General
- Public License along with pyscard; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA</p>
-</body>
-</html>
Deleted: trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html 2014-12-11 11:22:22 UTC (rev 649)
+++ trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html 2014-12-11 12:54:06 UTC (rev 650)
@@ -1,2675 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
- <meta name="generator" content=
- "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
-
- <title>pyscard smartcard module</title>
-</head>
-
-<body bgcolor="#FFFFFF">
- <h1 align="center">pyscard user's guide</h1><a href=
- "http://sourceforge.net/projects/pyscard"><img src=
- "http://sflogo.sourceforge.net/sflogo.php?group_id=196342&type=11"
- width="120" height="30" align="right" alt=
- "Get pyscard at SourceForge.net. Fast, secure and Free Open Source software downloads"></a>
- <pre>
-
-</pre>
- <hr>
-
- <h1><a name="top" id="top"></a>Contents</h1>
-
- <ul>
- <li><a href="#copyright">Copyright</a></li>
-
- <li><a href="#introduction">Introduction</a></li>
-
- <li><a href="#smartcards">Smart Cards</a></li>
-
- <li>
- <a href="#quickstart">Quick-Start</a>
-
- <ul>
- <li><a href="#readercentric">The reader-centric
- approach</a></li>
-
- <li><a href="#atr">The Answer To Reset (ATR)</a></li>
-
- <li>
- <a href="#cardcentric">The card-centric approach</a>
-
- <ul>
- <li><a href="#atrrequest">Requesting a card with a
- known ATR</a></li>
-
- <li><a href="#anycardrequest">Requesting any
- card</a></li>
-
- <li><a href="#customtyperequest">Designing custom card
- type requests</a></li>
- </ul>
- </li>
-
- <li><a href="#objectcentric">The object-centric
- approach</a></li>
- </ul>
- </li>
-
- <li>
- <a href="#apdutracing">Tracing APDUs</a>
-
- <ul>
- <li><a href="#bruteforcetracing">The brute force</a></li>
-
- <li><a href="#connectionobservers">Using card connection
- observers to trace apdu transmission</a></li>
- </ul>
- </li>
-
- <li>
- <a href="#apduerror">Testing for APDU transmission errors</a>
-
- <ul>
- <li><a href="#bruteforceerror">The brute force</a></li>
-
- <li>
- <a href="#errorcheckingchains">Using error checking
- chains to check for apdu transmission errors</a>
-
- <ul>
- <li><a href="#errorcheckers">Error checkers</a></li>
-
- <li><a href="#errorcheckingchains2">Error checking
- chains</a></li>
-
- <li><a href="#filteringerrors">Filtering
- errors</a></li>
-
- <li><a href="#cardconnectionchecking">Checking errors
- for a card connection</a></li>
-
- <li><a href="#customerrorcheckers">Writing custom error
- checkers</a></li>
- </ul>
- </li>
- </ul>
- </li>
-
- <li>
- <a href="#readers">Smartcard readers</a>
-
- <ul>
- <li><a href="#listingreaders">Listing smartcard
- readers</a></li>
-
- <li><a href="#readergroups">Organizing smartcard readers
- into groups</a></li>
-
- <li><a href="#readermonitoring">Monitoring readers</a></li>
- </ul>
- </li>
-
- <li>
- <a href="#smartcards2">Smart cards</a>
-
- <ul>
- <li><a href="#monitoringsmartcards">Monitoring smart
- cards</a></li>
-
- <li><a href="#sendingapdutocards">Sending APDUs to a smart
- card obtained from card monitoring</a></li>
- </ul>
- </li>
-
- <li>
- <a href="#connections">Connections</a>
-
- <ul>
- <li><a href="#cardrequestconnection">Creating a connection
- from a CardRequest</a></li>
-
- <li><a href="#cardmonitoringconnection">Creating a
- connection from CardMonitoring</a></li>
-
- <li>
- <a href="#cardconnectiondecorators">Card connection
- decorators</a>
-
- <ul>
- <li><a href="#exclusiveconnectiondecorator">Exclusive
- card connection decorator</a></li>
-
- <li><a href="#exclusivetransmitdecorator">Exclusive
- transmit card connection decorator</a></li>
-
- <li><a href="#securechanneldecorator">Secure channel
- decorator</a></li>
- </ul>
- </li>
- </ul>
- </li>
-
- <li><a href="smartcard.html">Smartcard reference</a></li>
-
- <li>
- <a href="#cryptography">A word on cryptography</a>
-
- <ul>
- <li><a href="#binstring">Binary strings and list of
- bytes</a></li>
-
- <li><a href="#hashing">Hashing</a></li>
-
- <li><a href="#secretkey">Secret key cryptography</a></li>
- </ul>
- </li>
-
- <li><a href="#License">License</a></li>
- </ul>
- <hr>
- <a name="copyright" id="copyright"></a>
-
- <h2>Copyright</h2>
- <pre>
-Copyright 2001-2009 <a href=
-"http://www.gemalto.com">gemalto</a><br>Author: Jean-Daniel Aussel, <a href="mailto:jea...@ge...">mailto:jea...@ge...</a>
-</pre>
-
- <p>This file is part of pyscard.</p>
-
- <p>pyscard is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later
- version.</p>
-
- <p>pyscard is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.</p>
-
- <p>You should have received a copy of the GNU Lesser General
- Public License along with pyscard; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA<br></p>
- <hr>
- <a name="introduction" id="introduction"></a>
-
- <h2>Introduction</h2>
-
- <p>The pyscard smartcard library is a framework for building
- smart card aware applications in Python. The smartcard module is
- built on top of the <a href="scard.html">PCSC API</a> Python
- wrapper module.</p>
-
- <p>pyscard supports Windows 2000 and XP by using the <a href=
- "http://msdn2.microsoft.com/en-us/library/aa374731.aspx#smart_card_functions">
- Microsoft Smart Card Base</a> components, and linux and Mac OS X
- by using <a href=
- "http://pcsclite.alioth.debian.org/">PCSC-lite</a>.</p>
- <hr>
-
- <h2><a name="smartcards" id="smartcards"></a>Smart Cards</h2>
-
- <p>Smart cards are plastic cards having generally the size of a
- credit card and embedding a microprocessor. Smart cards
- communicate with the outside world thru a serial port interface
- and an half-duplex protocol. Smartcards usually interface with a
- dedicated terminal, such as a point-of-sale terminal or a mobile
- phone. Sometime, smart cards have to be interfaced with personal
- computers. This is the case for some applications such as secure
- login, mail cyphering or digital signature, but also for some PC
- based smart card tools used to personnalize or edit the content
- of smart cards. Smart cards are interfaced with a personnal
- computer using a smart card reader. The smart card reader
- connects on one side to the serial port of the smart card, and on
- the other side to the PC, often nowadays thru a USB port.</p>
-
- <p>The PCSC workgroup has defined a standard API to interface
- smart card and smart card readers to a PC. The resulting
- reference implementation on linux and Mac OS X operating systems
- is <a href="http://pcsclite.alioth.debian.org/">PC/SC-lite</a>.
- All windows operating systems also include out of the box smart
- card support, usually called <a href=
- "http://msdn2.microsoft.com/en-us/library/aa374731.aspx#smart_card_functions">
- PCSC</a>.</p>
-
- <p>The PCSC API is implemented in C language, and several bridges
- are provided to access the PCSC API from different languages such
- as java or visual basic. pyscard is a python framework to develop
- smart card PC applications on linux, Mac OS X and windows.
- pyscard lower layers interface to the PCSC API to access the
- smart cards and smart card readers.</p>
-
- <hr>
-
- <h2><a name="quickstart" id="quickstart"></a>Quick-start</h2>
-
- <p>We will see in this section some variations on how to send
- APDU commands to a smart card.</p>
-
- <h3><a name="readercentric" id="readercentric"></a>The
- reader-centric approach</h3>
-
- <p>A PC application interacts with a card by sending list of
- bytes, known as Application Protocol Data Units (APDU). The
- format of these APDUs is defined in the ISO7816-4 standard. To
- send APDUs to a card, the application needs first to connect to a
- card thru a smart card reader. Smart card aware applications that
- first select a smart card reader, then connect to the card
- inserted in the smart card reader use the reader-centric
- approach.</p>
-
- <p>In the reader-centric approach, we open a connection with a
- card thru a smart card reader, and send APDU commands to the card
- using the connection:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.System import readers<br>
- >>> from smartcard.util import toHexString<br>
- >>><br>
- >>> r=readers()<br>
- >>> print r<br>
- ['SchlumbergerSema Reflex USB v.2 0', 'Utimaco CardManUSB 0']<br>
- >>> connection = r[0].createConnection()<br>
- >>> connection.connect()<br>
- >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]<br>
- >>> DF_TELECOM = [0x7F, 0x10]<br>
- >>> data, sw1, sw2 = connection.transmit( SELECT +
- DF_TELECOM )<br>
- >>> print "%x %x" % (sw1, sw2)<br>
- 9f 1a<br>
- >>></font></p>
-
- <p>The list of available readers is retrieved with the
- <font face="Courier New, Courier, mono" size="2">readers()</font>
- function. We create a connection with the first reader (index 0
- for reader 1, 1 for reader 2, ...) with the <font face=
- "Courier New, Courier, mono" size=
- "2">r[0].createConnection()</font> call and connect to the card
- with the <font face="Courier New, Courier, mono" size=
- "2">connect()</font> method of the connection. We can then send
- APDU commands to the card with the <font face=
- "Courier New, Courier, mono"><font size=
- "2">transmit()</font></font> method.</p>
-
- <p>Scripts written with the reader centric approach however have
- the following drawbacks:</p>
-
- <ul>
- <li>the reader index or reader name is hardcoded in the
- scripts; the scripts must be edited to match each user
- configuration; for example in the previous script, we would
- have to edit the script and change r[0] to r[1] for using the
- second reader</li>
-
- <li>there is no a-priori knowledge that the card is in the
- reader; to detect card insertion, we would have to execute the
- script and eventually catch a CardConnectionException that
- would indicate that there is no card in the reader.</li>
-
- <li>there is no built-in check that the card in the reader is
- of the card type we expect; in the previous example, we might
- try to select the DF_TELECOM of an EMV card.</li>
- </ul>
-
- <p>Most of these issues are solved with the card-centric
- approach, based on card type detection techniques, such as using
- the Answer To Reset (ATR) of the card.</p>
-
- <p><a href="#top">to the top</a></p>
-
- <h3><a name="atr" id="atr"></a>The Answer To Reset (ATR)</h3>
-
- <p>The first answer of a smart card inserted in a smart card
- reader is call the ATR. The purpose of the ATR is to describe the
- supported communication parameters. The smart card reader, smart
- card reader driver, and operating system will use these
- parameters to establish a communication with the card. The ATR is
- described in the ISO7816-3 standard. The first bytes of the ATR
- describe the voltage convention (direct or inverse), followed by
- bytes describing the available communication interfaces and their
- respective parameters. These interface bytes are then followed by
- Historical Bytes which are not standardized, and are useful for
- transmitting proprietary informations such as the card type, the
- version of the embedded software, or the card state. Finally
- these historical bytes are eventually followd by a checksum
- byte.</p>
-
- <p>The class <a href=
- "epydoc/smartcard.ATR.ATR-class.html">smartcard.ATR</a> is a
- pyscard utility class that can interpret the content of an
- ATR:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">#! /usr/bin/env python<br>
- from smartcard.ATR import ATR<br>
- from smartcard.util import toHexString<br>
- <br>
- atr = ATR([0x3B, 0x9E, 0x95, 0x80, 0x1F, 0xC3, 0x80, 0x31, 0xA0,
- 0x73,<br>
- 0xBE, 0x21, 0x13, 0x67, 0x29, 0x02, 0x01, 0x01, 0x81,0xCD,0xB9]
- )<br>
- print atr<br>
- print 'historical bytes: ', toHexString( atr.getHistoricalBytes()
- )<br>
- print 'checksum: ', "0x%X" % atr.getChecksum()<br>
- print 'checksum OK: ', atr.checksumOK<br>
- print 'T0 supported: ', atr.isT0Supported()<br>
- print 'T1 supported: ', atr.isT1Supported()<br>
- print 'T15 supported: ', atr.isT15Supported()<br></font></p>
-
- <p>Which results in the following output:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">3B 9E 95 80 1F C3 80 31 A0 73 BE 21 13 67 29 02 01 01
- 81 CD B9<br>
- historical bytes: 80 31 A0 73 BE 21 13 67 29 02 01 01 81 CD<br>
- checksum: 0xB9<br>
- checksum OK: True<br>
- T0 supported: True<br>
- T1 supported: False<br>
- T15 supported: True<br></font></p>
-
- <p>In practice, the ATR can be used to detect a particular card,
- either by trying to match a card with a complete ATR, or by
- matching a card with some data in the historical bytes. Smart
- card aware PC applications that detects smart cards based on the
- content of the ATR use the card-centric approach, independently
- on the smart card reader in which the card is inserted..<br></p>
-
- <h3><a name="cardcentric" id="cardcentric"></a>The card-centric
- approach</h3>
-
- <p>In the card-centric approach, we create a request for a
- specific type of card and wait until a card matching the request
- is inserted. Once a matching card is introduced, a connection to
- the card is automatically created and we can send APDU commands
- to the card using this connection.</p>
-
- <h4><a name="atrrequest" id="atrrequest"></a>Requesting a card by
- ATR</h4>
-
- <p>The following scripts requests a card with a known ATR:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- ATRCardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.util import toHexString, toBytes<br>
- >>><br>
- >>> cardtype = ATRCardType( toBytes( "3B 16 94 20 02 01
- 00 00 0D" ) )<br>
- >>> cardrequest = CardRequest( timeout=1,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- >>> print toHexString( cardservice.connection.getATR()
- )<br>
- 3B 16 94 20 02 01 00 00 0D<br>
- >>><br>
- >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]<br>
- >>> DF_TELECOM = [0x7F, 0x10]<br>
- >>> data, sw1, sw2 = cardservice.connection.transmit(
- SELECT + DF_TELECOM )<br>
- >>> print "%x %x" % (sw1, sw2)<br>
- 9f 1a<br>
- >>></font></p>
-
- <p>To request a card with a know ATR, you must first create an
- <a href=
- "epydoc/smartcard.CardType.ATRCardType-class.html">ATRCardType</a>
- object with the desired ATR:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> cardtype = ATRCardType( toBytes( "3B 16 94
- 20 02 01 00 00 0D" ) )<br></font></p>
-
- <p>And then create a <a href=
- "epydoc/smartcard.CardRequest.CardRequest-class.html">CardRequest</a>
- for this card type. In the sample, we request a time-out of 1
- second.</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> cardrequest = CardRequest( timeout=1,
- cardType=cardtype )<br>
- >>> cardservice =
- cardrequest.waitforcard()<br></font></p>
-
- <p>The waitforcard() will either return with a card service or a
- time-out. The card service connection attribute can be used
- thereafter to transmit APDU commands to the card, as with the
- reader centric approach.</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> cardservice.connection.connect()<br>
- >>> print toHexString( cardservice.connection.getATR()
- )<br></font></p>
-
- <p>If necessary, the reader used for the connection can be
- accessed thru the <a href=
- "epydoc/smartcard.CardConnection.CardConnection-class.html">CardConnection</a>
- object:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> print
- cardservice.connection.getReader()<br>
- SchlumbergerSema Reflex USB v.2 0</font></p>
-
- <p>The <a href=
- "epydoc/smartcard.CardType.ATRCardType-class.html">ATRCardType</a>
- also supports masks:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- ATRCardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.util import toHexString, toBytes<br>
- >>><br>
- >>> cardtype = ATRCardType( toBytes( "3B 1<b>5</b> 94 20
- 02 01 00 00 0<b>F</b>" ), toBytes( "00 00 FF FF FF FF FF FF 00" )
- )<br>
- >>> cardrequest = CardRequest( timeout=1,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- >>> print toHexString( cardservice.connection.getATR()
- )<br>
- 3B 1<b>6</b> 94 20 02 01 00 00 0<b>D</b></font></p>
-
- <p>Other CardTypes are available, and new CardTypes can be
- created, as described below.</p>
-
- <p><a href="#top">to the top</a></p>
-
- <h4><a name="anycardrequest" id="anycardrequest"></a>Requesting
- any card</h4>
-
- <p>The <a href=
- "epydoc/smartcard.CardType.AnyCardType-class.html">AnyCardType</a>
- is useful for requesting any card in any reader:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- AnyCardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.util import toHexString<br>
- >>><br>
- >>> cardtype = AnyCardType()<br>
- >>> cardrequest = CardRequest( timeout=1,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- >>> print toHexString( cardservice.connection.getATR()
- )<br>
- 3B 16 94 20 02 01 00 00 0D<br>
- >>> print cardservice.connection.getReader()<br>
- SchlumbergerSema Reflex USB v.2 0</font></p>
-
- <p><a href="#top">to the top</a></p>
-
- <h4><a name="customtyperequest" id="customtyperequest"></a>Custom
- CardTypes</h4>
-
- <p>Custom CardTypes can be created, e.g. a card type that checks
- the ATR and the historical bytes of the card. To create a custom
- CardType, deriver your CardType class from the the <a href=
- "epydoc/smartcard.CardType.CardType-class.html">CardType</a> base
- class (or any other CardType) and override the <font face=
- "Courier New, Courier, mono" size="2">matches()</font> method.
- For exemple to create a DCCardType that will match cards with the
- direct convention (first byte of ATR to 0x3b):</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- CardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.util import toHexString<br>
- >>><br>
- >>> class DCCardType(CardType):<br>
- ... def matches( self, atr,
- reader=None ):<br>
- ... return
- atr[0]==0x3B<br>
- ...<br>
- >>> cardtype = DCCardType()<br>
- >>> cardrequest = CardRequest( timeout=1,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- >>> print toHexString( cardservice.connection.getATR()
- )<br>
- 3B 16 94 20 02 01 00 00 0D<br>
- >>> print cardservice.connection.getReader()<br>
- SchlumbergerSema Reflex USB v.2 0<br>
- >>></font></p>
-
- <p>Scripts written with the card-centric approach fixes the
- problems of the reader-centric approach:</p>
-
- <ul>
- <li>there is no assumption concerning the reader index or
- reader name; the desired card will be located in any
- reader</li>
-
- <li>the request will block or time-out if the desired card type
- is not inserted</li>
-
- <li>since we request the desired card type, the script is not
- played on an unknown or uncompatible card</li>
- </ul>
-
- <p>Scripts written with the card-centric approach have however
- the following drawbacks:</p>
-
- <ul>
- <li>the script is limited to a specific card type; we have to
- modify the script if we want to execute the script on another
- card type. For exemple, we have to modify the ATR of the card
- if we are using the ATRCardType. This can be partially solved
- by having a custom CardType that matches several ATRs,
- though.</li>
- </ul>
-
- <p><a href="#top">to the top</a></p>
-
- <h3><a name="protocol" id="protocol"></a>Selecting the card
- communication protocol</h3>
-
- <p>Communication parameters are mostly important for the protocol
- negociation between the smart card reader and the card. The main
- smartcard protocols are the T=0 protocol and the T=1 protocol,
- for byte or block transmission, respectively. The required
- protocol can be specified at card connection or card
- transmission.</p>
-
- <p>By defaults, the connect() method of the CardConnection
- object.will try to connect using either the T=0 or T=1 protocol.
- To force a connection protocol, you can pass the required
- protocol to the connect() method.</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- AnyCardType<br>
- >>> from smartcard.CardConnection import
- CardConnection<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.util import toHexString<br>
- >>><br>
- >>> cardtype = AnyCardType()<br>
- >>> cardrequest = CardRequest( timeout=1,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> cardservice.connection.connect(
- CardConnection.T1_protocol )<br>
- >>> print toHexString( cardservice.connection.getATR()
- )<br>
- 3B 16 94 20 02 01 00 00 0D<br>
- >>> print cardservice.connection.getReader()<br>
- SchlumbergerSema Reflex USB v.2 0</font></p>
-
- <p><a href="#top"></a>Alternatively, you can specify the required
- protocol in the CardConnection transmit() method:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- AnyCardType<br>
- >>> from smartcard.CardConnection import
- CardConnection<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.util import toHexString, toBytes<br>
- >>><br>
- >>> cardtype = AnyCardType()<br>
- >>> cardrequest = CardRequest( timeout=1,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- >>><br>
- >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]<br>
- >>> DF_TELECOM = [0x7F, 0x10]<br>
- >>><br>
- >>> apdu = SELECT+DF_TELECOM<br>
- >>> print 'sending ' + toHexString(apdu)<br>
- sending A0 A4 00 00 02 7F 10<br>
- >>> response, sw1, sw2 =
- cardservice.connection.transmit( apdu, CardConnection.T1_protocol
- )<br>
- >>> print 'response: ', response, ' status words: ', "%x
- %x" % (sw1, sw2)<br>
- response: [] status words: 9f 1a<br>
- >>><br>
- >>> if sw1 == 0x9F:<br>
- ... GET_RESPONSE = [0XA0, 0XC0, 00, 00
- ]<br>
- ... apdu = GET_RESPONSE + [sw2]<br>
- ... print 'sending ' +
- toHexString(apdu)<br>
- ... response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- ... print 'response: ',
- toHexString(response), ' status words: ', "%x %x" % (sw1,
- sw2)<br>
- ...<br>
- sending A0 C0 00 00 1A<br>
- response: 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00
- 83 8A 83 8A 00 01 00 00 status words: 90 0<br>
- >>></font></p>
-
- <h3><a name="objectcentric" id="objectcentric"></a>The
- object-centric approach</h3>
-
- <p>In the object-centric approach, we associate a high-level
- object with a set of smart cards supported by the object. For
- example we associate a javacard loader class with a set of
- javacard smart cards. We create a request for the specific
- object, and wait until a card supported by the object is
- inserted. Once a card supported by the object is inserted, we
- perform the required function by calling the objec methods.</p>
-
- <p><i>To be written...</i></p>
- <hr>
-
- <h2><a name="apdutracing" id="apdutracing"></a>Tracing APDUs</h2>
-
- <h3><a name="bruteforcetracing" id="bruteforcetracing"></a>The
- brute force</h3>
-
- <p>A straightforward way of tracing command and response APDUs is
- to insert print statements around the transmit() method
- calls:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- ATRCardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.util import toHexString, toBytes<br>
- >>><br>
- >>> cardtype = ATRCardType( toBytes( "3B 16 94 20 02 01
- 00 00 0D" ) )<br>
- >>> cardrequest = CardRequest( timeout=1,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- >>><br>
- >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]<br>
- >>> DF_TELECOM = [0x7F, 0x10]<br>
- >>><br>
- >>> apdu = SELECT+DF_TELECOM<br>
- >>> print 'sending ' + toHexString(apdu)<br>
- sending A0 A4 00 00 02 7F 10<br>
- >>> response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- >>> print 'response: ', response, ' status words: ', "%x
- %x" % (sw1, sw2)<br>
- response: [] status words: 9f 1a<br>
- >>><br>
- >>> if sw1 == 0x9F:<br>
- ... GET_RESPONSE = [0XA0, 0XC0, 00, 00
- ]<br>
- ... apdu = GET_RESPONSE + [sw2]<br>
- ... print 'sending ' +
- toHexString(apdu)<br>
- ... response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- ... print 'response: ',
- toHexString(response), ' status words: ', "%x %x" % (sw1,
- sw2)<br>
- ...<br>
- sending A0 C0 00 00 1A<br>
- response: 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00
- 83 8A 83 8A 00 01 00 00 status words: 90 0<br>
- >>></font></p>
-
- <p>Scripts written this way are quite difficult to read, because
- there are more tracing statements than actual apdu
- transmits..</p>
-
- <p>A small improvement in visibility would be to replace the
- print instructions by functions, e.g.:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- ATRCardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.util import toHexString, toBytes<br>
- >>><br>
- >>> cardtype = ATRCardType( toBytes( "3B 16 94 20 02 01
- 00 00 0D" ) )<br>
- >>> cardrequest = CardRequest( timeout=1,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- >>><br>
- >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]<br>
- >>> DF_TELECOM = [0x7F, 0x10]<br>
- >>><br>
- >>> def trace_command(apdu):<br>
- ... print 'sending ' +
- toHexString(apdu)<br>
- ...<br>
- >>> def trace_response( response, sw1, sw2 ):<br>
- ... if None==response: response=[]<br>
- ... print 'response: ',
- toHexString(response), ' status words: ', "%x %x" % (sw1,
- sw2)<br>
- ...<br>
- >>> apdu = SELECT+DF_TELECOM<br>
- >>> trace_command(apdu)<br>
- sending A0 A4 00 00 02 7F 10<br>
- >>> response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- >>> trace_response( response, sw1, sw2 )<br>
- response: status words: 9f 1a<br>
- >>><br>
- >>> if sw1 == 0x9F:<br>
- ... GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]<br>
- ... apdu = GET_RESPONSE + [sw2]<br>
- ... trace_command(apdu)<br>
- ... response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- ... trace_response( response, sw1, sw2 )<br>
- ...<br>
- sending A0 C0 00 00 1A<br>
- response: 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00
- 83 8A 83 8A 00 01 00 00 status words: 90 0<br>
- >>></font></p>
-
- <p><a href="#top">to the top</a></p>
-
- <h3><a name="connectionobservers" id=
- "connectionobservers"></a>Using card connection observers to
- trace apdu transmission</h3>
-
- <p>The prefered solution is to implement a card connection
- observer, and register the observer with the card connection. The
- card connection will then notify the observer when card
- connection events occur (e.g. connection, disconnection, apdu
- command or apdu response). This is illustrated in the following
- script:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- AnyCardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.CardConnectionObserver import
- ConsoleCardConnectionObserver<br>
- >>><br>
- >>> GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]<br>
- >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]<br>
- >>> DF_TELECOM = [0x7F, 0x10]<br>
- >>><br>
- >>><br>
- >>> cardtype = AnyCardType()<br>
- >>> cardrequest = CardRequest( timeout=10,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> observer=ConsoleCardConnectionObserver()<br>
- >>> cardservice.connection.addObserver( observer )<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- connecting to SchlumbergerSema Reflex USB v.2 0<br>
- >>><br>
- >>> apdu = SELECT+DF_TELECOM<br>
- >>> response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- > A0 A4 00 00 02 7F 10<br>
- < [] 9F 1A<br>
- >>> if sw1 == 0x9F:<br>
- ... apdu = GET_RESPONSE + [sw2]<br>
- ... response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- ... else:<br>
- ... print 'no DF_TELECOM'<br>
- ...<br>
- > A0 C0 00 00 1A<br>
- < 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00 83 8A
- 83 8A 00 01 00 00 90 0<br>
- >>></font></p>
-
- <p>In this script, a <a href=
- "epydoc/smartcard.CardConnectionObserver.ConsoleCardConnectionObserver-class.html">
- ConsoleCardConnectionObserver</a> is attached to the card service
- connection once the watiforcard() call returns.</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>>
- observer=ConsoleCardConnectionObserver()<br>
- >>> cardservice.connection.addObserver( observer
- )<br></font></p>
-
- <p>On card connection events (connect, disconnect, transmit
- command apdu, receive response apdu), the card connection
- notifies its obersers with a <a href=
- "epydoc/smartcard.CardConnectionEvent.CardConnectionEvent-class.html">
- CarConnectionEvent</a> including the event type and the event
- data. The <a href=
- "epydoc/smartcard.CardConnectionObserver.ConsoleCardConnectionObserver-class.html">
- ConsoleCardConnectionObserver</a> is a simple observer that will
- print on the console the card connection events. The class
- definition is the following:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">class ConsoleCardConnectionObserver(
- CardConnectionObserver ):<br>
- def update( self, cardconnection, ccevent
- ):</font></p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF"> if
- 'connect'==ccevent.type:<br>
- print
- 'connecting to ' + cardconnection.getReader()</font></p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF"> elif
- 'disconnect'==ccevent.type:<br>
- print
- 'disconnecting from ' + cardconnection.getReader()</font></p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF"> elif
- 'command'==ccevent.type:<br>
- print
- '> ', toHexString( ccevent.args[0] )</font></p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF"> elif
- 'response'==ccevent.type:<br>
- if
- []==ccevent.args[0]:<br>
- print
- '< [] ', "%-2X %-2X" % tuple(ccevent.args[-2:])<br>
- else:<br>
-
- print '< ',
- toHexString(ccevent.args[0]), "%-2X %-2X" %
- tuple(ccevent.args[-2:])<br></font></p>
-
- <p>The console card connection observer is thus printing the
- connect, disconnect, command and response apdu events:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> cardservice.connection.connect()<br>
- <b>connecting to SchlumbergerSema Reflex USB v.2 0</b><br>
- >>><br>
- >>> apdu = SELECT+DF_TELECOM<br>
- >>> response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- <b>> A0 A4 00 00 02 7F 10<br>
- < [] 9F 1A<br></b> >>> if sw1 == 0x9F:<br>
- ... apdu = GET_RESPONSE + [sw2]<br>
- ... response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- ... else:<br>
- ... print 'no DF_TELECOM'<br>
- ...<br>
- <b>> A0 C0 00 00 1A<br>
- < 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00 83 8A
- 83 8A 00 01 00 00 90 0<br></b></font></p>
-
- <p>A card connection observer's update methode is called upon
- card connection event, with the connection and the connection
- event as parameters. The <a href=
- "epydoc/smartcard.CardConnectionEvent.CardConnectionEvent-class.html">
- CardConnectionEvent</a> class definition is the following:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">class CardConnectionEvent:<br>
- """Base class for card connection
- events.<br>
- <br>
- This event is notified by CardConnection
- objects.</font></p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF"> type: 'connect', 'disconnect',
- 'command', 'response'<br>
- args: None for 'connect' or 'disconnect'<br>
- command APDU byte list for 'command'<br>
- [response data, sw1, sw2] for 'response'<br>
- type: 'connect' args:"""<br>
- def __init__( self, type, args=None):<br>
- self.type=type<br>
- self.args=args<br></font></p>
-
- <p>You can write your own card connection observer, for example
- to perform fancy output in a wxWindows frame, or apdu
- interpretation. The following scripts defines a small SELECT and
- GET RESPONSE apdu interpreter:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- AnyCardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.CardConnectionObserver import
- CardConnectionObserver<br>
- >>> from smartcard.util import toHexString<br>
- >>><br>
- >>> from string import replace<br>
- >>><br>
- >>> class TracerAndSELECTInterpreter(
- CardConnectionObserver ):<br>
- ... def update( self, cardconnection,
- ccevent ):<br>
- ... if
- 'connect'==ccevent.type:<br>
- ...
- print
- 'connecting to ' + cardconnection.getReader()<br>
- ... elif
- 'disconnect'==ccevent.type:<br>
- ...
- print
- 'disconnecting from ' + cardconnection.getReader()<br>
- ... elif
- 'command'==ccevent.type:<br>
- ...
- str=toHexString(ccevent.args[0])<br>
-
- ...
- str
- = replace( str , "A0 A4 00 00 02", "SELECT" )<br>
- ...
- str
- = replace( str , "A0 C0 00 00", "GET RESPONSE" )<br>
- ...
- print
- '> ', str<br>
- ... elif
- 'response'==ccevent.type:<br>
- ...
- if
- []==ccevent.args[0]:<br>
- ...
- print
- '< [] ', "%-2X %-2X" % tuple(ccevent.args[-2:])<br>
- ...
- else:<br>
-
- ...
- print
- '< ', toHexString(ccevent.args[0]), "%-2X %-2X" %
- tuple(ccevent.args[-2:])<br>
- ...<br>
- >>><br>
- >>> GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]<br>
- >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]<br>
- >>> DF_TELECOM = [0x7F, 0x10]<br>
- >>><br>
- >>><br>
- >>> cardtype = AnyCardType()<br>
- >>> cardrequest = CardRequest( timeout=10,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> observer=TracerAndSELECTInterpreter()<br>
- >>> cardservice.connection.addObserver( observer )<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- connecting to SchlumbergerSema Reflex USB v.2 0<br>
- >>><br>
- >>> apdu = SELECT+DF_TELECOM<br>
- >>> response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- > <b>SELECT</b> 7F 10<br>
- < [] 9F 1A<br>
- >>> if sw1 == 0x9F:<br>
- ... apdu = GET_RESPONSE + [sw2]<br>
- ... response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- ... else:<br>
- ... print 'no DF_TELECOM'<br>
- ...<br>
- > <b>GET RESPONSE</b> 1A<br>
- < 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00 83 8A
- 83 8A 00 01 00 00 90 0<br>
- >>></font></p>
-
- <p><a href="#top">to the top</a></p>
-
- <h2><a name="apduerror" id="apduerror"></a>Testing for APDU
- transmission errors</h2>
-
- <p>Upon transmission and processing of an APDU, the smart card
- returns a pair of status words, SW1 and SW2, to report various
- success or error codes following the required processing. Some of
- these success or error codes are standardized in ISO7816-4,
- ISO7816-8 or ISO7816-9, for example. Other status word codes are
- standardized by standardization bodies such as Open Platform
- (e.g. javacard), 3GPP (e.g. SIM or USIM cards), or
- Eurocard-Mastercard-Visa (EMV) (e.g. banking cards). Finally, any
- smart card application developper can defined application related
- proprietary codes; for example the <a href=
- "http://www.linuxnet.com/musclecard/index.html">MUSCLE applet</a>
- defines a set of prioprietary codes related to the MUSCLE applet
- features.</p>
-
- <p>Some of these status word codes are uniques, but others have a
- different meaning depending on the card type and its supported
- standards. For example, ISO7816-4 defines the error code 0x62
- 0x82 as "File Invalidated", whereas in Open Platform 2.1 the same
- error code is defined as "Card life cycle is CARD_LOCKED". As a
- result, the list of error codes that can be returned by a smart
- card and they interpretation depend on the card type. The
- following discussion outlines possible strategies to check and
- report smart card status word errors.</p>
-
- <h3><a name="bruteforceerror" id="bruteforceerror"></a>The brute
- force for testing APDU transmission errors</h3>
-
- <p>As for APDU tracing, a straightforward way of checking for
- errors in response APDUs during the execution of scripts is to
- insert testt statements after the transmit() method calls:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- AnyCardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.CardConnectionObserver import
- ConsoleCardConnectionObserver<br>
- >>><br>
- >>> GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]<br>
- >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]<br>
- >>> DF_TELECOM = [0x7F, 0x10]<br>
- >>><br>
- >>> cardtype = AnyCardType()<br>
- >>> cardrequest = CardRequest( timeout=10,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> observer=ConsoleCardConnectionObserver()<br>
- >>> cardservice.connection.addObserver( observer )<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- connecting to Utimaco CardManUSB 0<br>
- >>><br>
- >>> apdu = SELECT+DF_TELECOM<br>
- >>> response, sw1, sw2 =
- cardservice.connection.transmit( apdu )<br>
- > A0 A4 00 00 02 7F 10<br>
- < [] 6E 0<br>
- >>><br>
- >>> if sw1 in range(0x61, 0x6f):<br>
- ... print "Error: sw1: %x sw2: %x" % (sw1, sw2)<br>
- ...<br>
- Error: sw1: 6e sw2: 0<br>
- >>> if sw1 == 0x9F:<br>
- ... apdu = GET_RESPONSE + [sw2]<br>
- ... response, sw1, sw2 = cardservice.connection.transmit( apdu
- )<br>
- ...<br>
- >>> cardservice.connection.disconnect()<br>
- disconnecting from Utimaco CardManUSB 0<br>
- >>></font></p>
-
- <p>Scripts written this way are quite difficult to read, because
- there are more error detection statements than actual apdu
- transmits.</p>
-
- <p>An improvement in visibility is to wrap the transmit
- instruction inside a function mytransmit, e.g.:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.CardType import
- AnyCardType<br>
- >>> from smartcard.CardRequest import CardRequest<br>
- >>> from smartcard.CardConnectionObserver import
- ConsoleCardConnectionObserver<br>
- >>><br>
- >>> def mytransmit( connection, apdu ):<br>
- ... response, sw1, sw2 = connection.transmit( apdu )<br>
- ... if sw1 in range(0x61, 0x6f):<br>
- ... print "Error: sw1: %x sw2: %x" % (sw1, sw2)<br>
- ... return response, sw1, sw2<br>
- ...<br>
- >>><br>
- >>> GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]<br>
- >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]<br>
- >>> DF_TELECOM = [0x7F, 0x10]<br>
- >>><br>
- >>><br>
- >>> cardtype = AnyCardType()<br>
- >>> cardrequest = CardRequest( timeout=10,
- cardType=cardtype )<br>
- >>> cardservice = cardrequest.waitforcard()<br>
- >>><br>
- >>> observer=ConsoleCardConnectionObserver()<br>
- >>> cardservice.connection.addObserver( observer )<br>
- >>><br>
- >>> cardservice.connection.connect()<br>
- connecting to Utimaco CardManUSB 0<br>
- >>><br>
- >>> apdu = SELECT+DF_TELECOM<br>
- >>> response, sw1, sw2 = mytransmit(
- cardservice.connection, apdu )<br>
- > A0 A4 00 00 02 7F 10<br>
- < [] 6E 0<br>
- Error: sw1: 6e sw2: 0<br>
- >>><br>
- >>> if sw1 == 0x9F:<br>
- ... apdu = GET_RESPONSE + [sw2]<br>
- ... response, sw1, sw2 = mytransmit( cardservice.connection, apdu
- )<br>
- ...<br>
- >>> cardservice.connection.disconnect()<br>
- disconnecting from Utimaco CardManUSB 0<br>
- >>></font></p>
-
- <p>The prefered solution is for testing errors is to use
- smarcard.sw.ErrorChecker, as described in the following
- section.</p>
-
- <p><a href="#top">to the top</a></p>
-
- <h3><a name="errorcheckingchains" id=
- "errorcheckingchains"></a>Checking APDU transmission errors with
- error checkers</h3>
-
- <p>Status word errors can occur from different sources. The
- ISO7816-4 standards defines status words for sw1 in the range
- 0x62 to 0x6F and some values of sw2, except for 0x66 which is
- reserved for security related issues. The ISO7816-8 standards
- define other status words, e.g. sw1=0x68 and sw2=0x83 or 0x84 for
- command chaining errors. Other standards, like Open Platform,
- define additional status words error, e.g. sw1=0x94 and
- sw2=0x84.</p>
-
- <p>The prefered strategy for status word error checking is based
- around individual error checkers (smartcard.sw.ErrorChecker) that
- can be chained into an error checking chain
- (smartcars.sw.ErrorCheckingChain).</p>
-
- <h4><a name="errorcheckers" id="errorcheckers"></a>Error
- checkers</h4>
-
- <p>An error checker is a class deriving from <a href=
- "epydoc/smartcard.sw.ErrorChecker.ErrorChecker-class.html">ErrorChecker</a>
- that checks for recognized sw1, sw2 error conditions when called,
- and raises an exception when finding such condition. This is
- illustrated in the following sample:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.sw.ISO7816_4ErrorChecker
- import ISO7816_4ErrorChecker<br>
- >>><br>
- >>> errorchecker=ISO7816_4ErrorChecker()<br>
- >>> errorchecker( [], 0x90, 0x00 )<br>
- >>> errorchecker( [], 0x6A, 0x80 )<br>
- Traceback (most recent call last):<br>
- File "<stdin>", line 1, in ?<br>
- File
- "D:\projects\pyscard-install\factory\python\lib\site-packages\smartcard\sw\ISO7816_4ErrorChecker.py",
- line 137, in __call__<br>
- raise exception( data, sw1, sw2, message )<br>
- smartcard.sw.SWExceptions.CheckingErrorException: 'Status word
- exception: checking error - Incorrect parameters in the data
- field!'<br>
- >>></font></p>
-
- <p>The first call to error checker does not raise an exception,
- since 90 00 does not report any error. The second calls however
- raises a CheckingErrorException.</p>
-
- <p><a href="#top">to the top</a></p>
-
- <h4><a name="errorcheckingchains2" id=
- "errorcheckingchains2"></a>Error checking chains</h4>
-
- <p>Error checkers can be chained into <a href=
- "epydoc/smartcard.sw.ErrorCheckingChain.ErrorCheckingChain-class.html">
- error checking chain</a>. Each checker in the chain is called
- until an error condition is met, in which case an exception is
- raised. This is illustrated in the following sample:</p>
-
- <p><font face="Courier New, Courier, mono" size="2" color=
- "#0033FF">>>> from smartcard.sw.ISO7816_4ErrorChecker
- import ISO7816_4ErrorChecker<br>
- >>> from smartcard.sw.ISO7816_8ErrorChecker import
- ISO7816_8ErrorChecker<br>
- >>> from smartcard.sw.ISO7816_9ErrorChecker import
- ISO7816_9ErrorChecker<br>
- >>><br>
- >>> from smartcard.sw.ErrorCheckingChain import
- ErrorCheckingChain<br>
- >>><br>
- >>> errorchain = []<br>
- >>> errorchain=[ ErrorCheckingChain( errorchain,
- ISO7816_9ErrorChecker() ),<br>
- ... ErrorCheckingChain( errorchain, ISO7816_8ErrorChecker()
- ),<br>
- ... ErrorCheckingChain( errorchain, ISO7816_4ErrorChecker() )
- ]<br>
- >>><br>
- >>> errorchain[0]( [], 0x90, 0x00 )<br>
- >>> errorchain[0]( [], 0x6A, 0x8a )<br>
- Traceback (most recent call last):<br>
- File "<stdin>", line 1, in ?<br>
- File
- "D:\projects\pyscard-install\factory\python\lib\site-packages\smartcard\sw\ErrorCheckingChain.py",
- line 60,<br>
- in __call__<br>
- self.strategy( data, sw1, sw2 )<br>
- File
- "D:\projects\pyscard-install\factory\python\lib\site-packages\smartcard\sw\ISO7816_9ErrorChecker.py",
- line 74, in __call__<br>
- raise exception( data, sw1, sw2, message )<br>
- smartcard.sw.SWExceptions.CheckingErrorException: 'Status word
- exception: checking error - DF name already exists!'<br>
- >>></font></p>
-
- <p>In this sample, an error checking chain is created that will
- check first for iso 7816-9 errors, then iso7816-8 errors, and
- finally iso7816-4 errors.</p>
-
- <p>The first call to the error chain does not raise an exception,
- since 90 00 does not report any error. The second calls however
- raises a CheckingErrorException, caused by the iso7816-9 error
- checker.</p>
-
- <p><a href="#top">to the top</a></p>
-
- <h4><a name="filteringerrors" id="filteringerrors"></a>Filtering
- exceptions</h4>
-
- <p>You can filter undesired exceptions in a chain by adding a
- filtered exception to the error checking chain:</p>
-
- <...
[truncated message content] |
|
From: <lu...@us...> - 2014-12-11 11:22:26
|
Revision: 649
http://sourceforge.net/p/pyscard/code/649
Author: ludov
Date: 2014-12-11 11:22:22 +0000 (Thu, 11 Dec 2014)
Log Message:
-----------
Add documentation in Sphinx format
Added Paths:
-----------
trunk/pyscard/src/smartcard/doc/Makefile
trunk/pyscard/src/smartcard/doc/conf.py
trunk/pyscard/src/smartcard/doc/index.rst
trunk/pyscard/src/smartcard/doc/license.rst
trunk/pyscard/src/smartcard/doc/main.rst
trunk/pyscard/src/smartcard/doc/pyscard-framework.rst
trunk/pyscard/src/smartcard/doc/pyscard-wrapper.rst
trunk/pyscard/src/smartcard/doc/user-guide.rst
Added: trunk/pyscard/src/smartcard/doc/Makefile
===================================================================
--- trunk/pyscard/src/smartcard/doc/Makefile (rev 0)
+++ trunk/pyscard/src/smartcard/doc/Makefile 2014-12-11 11:22:22 UTC (rev 649)
@@ -0,0 +1,153 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ -rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pyscard.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pyscard.qhc"
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/pyscard"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pyscard"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
Added: trunk/pyscard/src/smartcard/doc/conf.py
===================================================================
--- trunk/pyscard/src/smartcard/doc/conf.py (rev 0)
+++ trunk/pyscard/src/smartcard/doc/conf.py 2014-12-11 11:22:22 UTC (rev 649)
@@ -0,0 +1,244 @@
+# -*- coding: utf-8 -*-
+#
+# pyscard documentation build configuration file, created by
+# sphinx-quickstart on Thu Dec 4 14:38:51 2014.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+sys.path.insert(0, os.path.abspath('../..'))
+sys.path.insert(0, os.path.abspath('../../build/lib.linux-x86_64-2.7'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'pyscard'
+copyright = u'2014, Jean-Daniel Aussel, Ludovic Rousseau'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '1.6.16'
+# The full version, including alpha/beta/rc tags.
+release = '1.6.16'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+#html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'pyscarddoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+ ('index', 'pyscard.tex', u'pyscard Documentation',
+ u'Ludovic Rousseau', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ ('index', 'pyscard', u'pyscard Documentation',
+ [u'Ludovic Rousseau'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ ('index', 'pyscard', u'pyscard Documentation',
+ u'Ludovic Rousseau', 'pyscard', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
Added: trunk/pyscard/src/smartcard/doc/index.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.rst (rev 0)
+++ trunk/pyscard/src/smartcard/doc/index.rst 2014-12-11 11:22:22 UTC (rev 649)
@@ -0,0 +1,26 @@
+.. pyscard documentation master file, created by
+ sphinx-quickstart on Thu Dec 4 14:38:51 2014.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to pyscard's documentation!
+===================================
+
+Contents:
+
+.. toctree::
+ :maxdepth: 4
+
+ main
+ user-guide
+ pyscard-framework
+ pyscard-wrapper
+ license
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
Added: trunk/pyscard/src/smartcard/doc/license.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/license.rst (rev 0)
+++ trunk/pyscard/src/smartcard/doc/license.rst 2014-12-11 11:22:22 UTC (rev 649)
@@ -0,0 +1,18 @@
+License
+#######
+
+pyscard is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+pyscard is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with pyscard; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+.. literalinclude:: ../LICENSE
Added: trunk/pyscard/src/smartcard/doc/main.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/main.rst (rev 0)
+++ trunk/pyscard/src/smartcard/doc/main.rst 2014-12-11 11:22:22 UTC (rev 649)
@@ -0,0 +1,42 @@
+pyscard - python for smart cards
+################################
+
+pyscard - python smart card library - is a python module adding smart
+cards support to `python <http://www.python.org/>`_.
+
+`download <http://sourceforge.net/projects/pyscard/>`_ pyscard from sourceforge.net.
+
+Report bugs, patches and feature requests using the `sourceforge pyscard
+bug tracking system <https://sourceforge.net/p/pyscard/_list/tickets>`_.
+
+Pyscard consists of:
+
+* `smartcard.scard
+ <http://pyscard.sourceforge.net/epydoc/smartcard.scard.scard-module.html>`_,
+ an extension module wrapping the WinSCard API (smart card base
+ components) also known as PC/SC, and
+
+* `smartcard <http://pyscard.sourceforge.net/epydoc/index.html>`_, a
+ higher level python framework built on top of the raw PC/SC API.
+
+.. image:: ../doc/images/pyscard.jpg
+ :align: center
+
+Documentation Index
+*******************
+
+ :ref:`pyscard_user_guide`
+
+ `smartcard reference (python smart card library)
+ <http://pyscard.sourceforge.net/epydoc/index.html>`_
+
+ `scard reference (python PCSC wrapper)
+ <http://pyscard.sourceforge.net/epydoc/smartcard.scard.scard-module.html>`_,
+ the python wrapper around PCSC
+
+Samples
+*******
+
+ High level API samples: See :ref:`framework_samples`
+
+ Low level API samples: See :ref:`wrapper_samples`
Added: trunk/pyscard/src/smartcard/doc/pyscard-framework.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/pyscard-framework.rst (rev 0)
+++ trunk/pyscard/src/smartcard/doc/pyscard-framework.rst 2014-12-11 11:22:22 UTC (rev 649)
@@ -0,0 +1,76 @@
+.. _framework_samples:
+
+pyscard smartcard framework samples
+===================================
+
+pyscard is a python module adding smart cards support to python.
+
+It consists of smartcard.scard, an extension module wrapping Windows
+smart card base components (also known as PCSC), and smartcard, a python
+framework library hiding PCSC complexity.
+
+Display the ATR of inserted cards
+"""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/simple/getATR.py
+
+
+Selecting the DF_TELECOM of a card
+""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/simple/selectDF_TELECOM.py
+
+
+A simple apdu tracer and interpreter
+""""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/framework/sample_apduTracerInterpreter.py
+
+
+Tracing connection events
+"""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/framework/sample_ConsoleConnectionTracer.py
+
+
+Decorating Card Connections to add custom behavior
+""""""""""""""""""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/framework/sample_CardConnectionDecorator.py
+
+
+Detecting response apdu errors
+""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/framework/sample_ErrorChecking.py
+
+
+Implementing a custom ErrorChecker
+""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/framework/sample_CustomErrorChecker.py
+
+
+Implementing a custom card type
+"""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/framework/sample_CustomCardType.py
+
+
+Monitoring smartcard readers
+""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/framework/sample_MonitorReaders.py
+
+
+Monitoring smartcard insertion/removal
+""""""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/framework/sample_MonitorCards.py
+
+
+APDU/ATR byte to string utilities
+"""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/framework/sample_toHexString.py
+
Added: trunk/pyscard/src/smartcard/doc/pyscard-wrapper.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/pyscard-wrapper.rst (rev 0)
+++ trunk/pyscard/src/smartcard/doc/pyscard-wrapper.rst 2014-12-11 11:22:22 UTC (rev 649)
@@ -0,0 +1,80 @@
+.. _wrapper_samples:
+
+PCSC wrapper samples
+====================
+
+Using the smartcard framework is the preferred way to write python smart
+card application. You can however use the smartcard.scard library to
+write your python smart card application if you want to write your own
+python framework, or if you want to access some features of the SCardXXX
+C API not available in the smartcard framework.
+
+The smartcard.scard module is a native extension module wrapping Windows
+smart card base components (also known as PCSC) on Windows, and
+pcsc-lite on linux and Mac OS X, whereas the smartcard framework is a
+pure python framework hiding scard complexity and PCSC.
+
+send a Control Code to a card or reader
+"""""""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_control.py
+
+
+get the ATR of a card
+"""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_getATR.py
+
+
+get the attributes of a card
+""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_getAttrib.py
+
+
+wait for card insertion/removal
+"""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_getStatusChange.py
+
+
+list the cards introduced in the system
+"""""""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_listCards.py
+
+
+list the interfaces supported by a card
+"""""""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_listInterfaces.py
+
+
+locate cards in the system
+""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_locateCards.py
+
+
+manage readers and reader groups
+""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_readerGroups.py
+
+
+list smart card readers
+"""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_readers.py
+
+
+select the DF_TELECOM of a SIM card
+"""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_selectDFTelecom.py
+
+
+perform a simple smart card transaction
+"""""""""""""""""""""""""""""""""""""""
+
+.. literalinclude:: ../Examples/scard-api/sample_transaction.py
Added: trunk/pyscard/src/smartcard/doc/user-guide.rst
===================================================================
--- trunk/pyscard/src/smartcard/doc/user-guide.rst (rev 0)
+++ trunk/pyscard/src/smartcard/doc/user-guide.rst 2014-12-11 11:22:22 UTC (rev 649)
@@ -0,0 +1,1637 @@
+.. _pyscard_user_guide:
+
+pyscard user's guide
+####################
+
+Copyright
+*********
+
+| Copyright 2001-2009 `Gemalto <http://www.gemalto.com/>`_
+| Author: Jean-Daniel Aussel, mailto:jea...@ge...
+
+This file is part of pyscard.
+
+pyscard is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the
+Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+pyscard is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with pyscard; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Introduction
+************
+
+The pyscard smartcard library is a framework for building smart card
+aware applications in Python. The smartcard module is built on top of
+the PCSC API Python wrapper module.
+
+pyscard supports Windows 2000 and XP by using the `Microsoft Smart Card
+Base <http://msdn2.microsoft.com/en-us/library/aa374731.aspx#smart_card_functions>`_ components, and linux and Mac OS X by using `PCSC-lite <http://pcsclite.alioth.debian.org/>`_.
+
+
+Smart Cards
+***********
+
+Smart cards are plastic cards having generally the size of a credit card
+and embedding a microprocessor. Smart cards communicate with the outside
+world thru a serial port interface and an half-duplex protocol.
+Smartcards usually interface with a dedicated terminal, such as a
+point-of-sale terminal or a mobile phone. Sometime, smart cards have to
+be interfaced with personal computers. This is the case for some
+applications such as secure login, mail cyphering or digital signature,
+but also for some PC based smart card tools used to personnalize or edit
+the content of smart cards. Smart cards are interfaced with a personnal
+computer using a smart card reader. The smart card reader connects on
+one side to the serial port of the smart card, and on the other side to
+the PC, often nowadays thru a USB port.
+
+The PCSC workgroup has defined a standard API to interface smart card
+and smart card readers to a PC. The resulting reference implementation
+on linux and Mac OS X operating systems is `PC/SC-lite
+<http://pcsclite.alioth.debian.org/>`_. All windows operating systems
+also include out of the box smart card support, usually called `PCSC
+<http://msdn2.microsoft.com/en-us/library/aa374731.aspx#smart_card_functions>`_.
+
+The PCSC API is implemented in C language, and several bridges are
+provided to access the PCSC API from different languages such as java or
+visual basic. pyscard is a python framework to develop smart card PC
+applications on linux, Mac OS X and windows. pyscard lower layers
+interface to the PCSC API to access the smart cards and smart card
+readers.
+
+
+Quick-start
+***********
+
+We will see in this section some variations on how to send APDU commands
+to a smart card.
+
+
+The reader-centric approach
+===========================
+
+A PC application interacts with a card by sending list of bytes, known
+as Application Protocol Data Units (APDU). The format of these APDUs is
+defined in the ISO7816-4 standard. To send APDUs to a card, the
+application needs first to connect to a card thru a smart card reader.
+Smart card aware applications that first select a smart card reader,
+then connect to the card inserted in the smart card reader use the
+reader-centric approach.
+
+In the reader-centric approach, we open a connection with a card thru a
+smart card reader, and send APDU commands to the card using the
+connection:
+
+.. sourcecode:: python
+
+ >>> from smartcard.System import readers
+ >>> from smartcard.util import toHexString
+ >>>
+ >>> r=readers()
+ >>> print r
+ ['SchlumbergerSema Reflex USB v.2 0', 'Utimaco CardManUSB 0']
+ >>> connection = r[0].createConnection()
+ >>> connection.connect()
+ >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ >>> DF_TELECOM = [0x7F, 0x10]
+ >>> data, sw1, sw2 = connection.transmit( SELECT + DF_TELECOM )
+ >>> print "%x %x" % (sw1, sw2)
+ 9f 1a
+ >>>
+
+The list of available readers is retrieved with the readers() function.
+We create a connection with the first reader (index 0 for reader 1, 1
+for reader 2, ...) with the r[0].createConnection() call and connect to
+the card with the connect() method of the connection. We can then send
+APDU commands to the card with the transmit() method.
+
+Scripts written with the reader centric approach however have the
+following drawbacks:
+
+* the reader index or reader name is hardcoded in the scripts; the
+ scripts must be edited to match each user configuration; for example
+ in the previous script, we would have to edit the script and change
+ r[0] to r[1] for using the second reader
+
+* there is no a-priori knowledge that the card is in the reader; to
+ detect card insertion, we would have to execute the script and
+ eventually catch a CardConnectionException that would indicate that
+ there is no card in the reader.
+
+* there is no built-in check that the card in the reader is of the card
+ type we expect; in the previous example, we might try to select the
+ DF_TELECOM of an EMV card.
+
+Most of these issues are solved with the card-centric approach, based on
+card type detection techniques, such as using the Answer To Reset (ATR)
+of the card.
+
+
+The Answer To Reset (ATR)
+=========================
+
+The first answer of a smart card inserted in a smart card reader is call
+the ATR. The purpose of the ATR is to describe the supported
+communication parameters. The smart card reader, smart card reader
+driver, and operating system will use these parameters to establish a
+communication with the card. The ATR is described in the ISO7816-3
+standard. The first bytes of the ATR describe the voltage convention
+(direct or inverse), followed by bytes describing the available
+communication interfaces and their respective parameters. These
+interface bytes are then followed by Historical Bytes which are not
+standardized, and are useful for transmitting proprietary informations
+such as the card type, the version of the embedded software, or the card
+state. Finally these historical bytes are eventually followd by a
+checksum byte.
+
+The class `smartcard.ATR
+<http://pyscard.sourceforge.net/epydoc/smartcard.ATR.ATR-class.html>`_
+is a pyscard utility class that can interpret the content of an ATR:
+
+.. sourcecode:: python
+
+ #! /usr/bin/env python
+ from smartcard.ATR import ATR
+ from smartcard.util import toHexString
+
+ atr = ATR([0x3B, 0x9E, 0x95, 0x80, 0x1F, 0xC3, 0x80, 0x31, 0xA0,
+ 0x73, 0xBE, 0x21, 0x13, 0x67, 0x29, 0x02, 0x01, 0x01, 0x81,0xCD,0xB9] )
+ print atr
+ print 'historical bytes: ', toHexString( atr.getHistoricalBytes() )
+ print 'checksum:', "0x%X" % atr.getChecksum()
+ print 'checksum OK:', atr.checksumOK
+ print 'T0 supported:', atr.isT0Supported()
+ print 'T1 supported:', atr.isT1Supported()
+ print 'T15 supported:', atr.isT15Supported()
+
+Which results in the following output::
+
+ 3B 9E 95 80 1F C3 80 31 A0 73 BE 21 13 67 29 02 01 01 81 CD B9
+ historical bytes: 80 31 A0 73 BE 21 13 67 29 02 01 01 81 CD
+ checksum: 0xB9
+ checksum OK: True
+ T0 supported: True
+ T1 supported: False
+ T15 supported: True
+
+In practice, the ATR can be used to detect a particular card, either by
+trying to match a card with a complete ATR, or by matching a card with
+some data in the historical bytes. Smart card aware PC applications that
+detects smart cards based on the content of the ATR use the card-centric
+approach, independently on the smart card reader in which the card is
+inserted..
+
+
+The card-centric approach
+=========================
+
+In the card-centric approach, we create a request for a specific type of
+card and wait until a card matching the request is inserted. Once a
+matching card is introduced, a connection to the card is automatically
+created and we can send APDU commands to the card using this connection.
+
+Requesting a card by ATR
+------------------------
+
+The following scripts requests a card with a known ATR::
+
+ >>> from smartcard.CardType import ATRCardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.util import toHexString, toBytes
+ >>>
+ >>> cardtype = ATRCardType( toBytes( "3B 16 94 20 02 01 00 00 0D" ) )
+ >>> cardrequest = CardRequest( timeout=1, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> cardservice.connection.connect()
+ >>> print toHexString( cardservice.connection.getATR() )
+ 3B 16 94 20 02 01 00 00 0D
+ >>>
+ >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ >>> DF_TELECOM = [0x7F, 0x10]
+ >>> data, sw1, sw2 = cardservice.connection.transmit( SELECT + DF_TELECOM )
+ >>> print "%x %x" % (sw1, sw2)
+ 9f 1a
+ >>>
+
+To request a card with a know ATR, you must first create an `ATRCardType
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardType.ATRCardType-class.html>`_
+object with the desired ATR::
+
+ >>> cardtype = ATRCardType( toBytes( "3B 16 94 20 02 01 00 00 0D" ) )
+
+And then create a `CardRequest
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardRequest.CardRequest-class.html>`_
+for this card type. In the sample, we request a time-out of 1 second.
+
+ >>> cardrequest = CardRequest( timeout=1, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+
+The waitforcard() will either return with a card service or a time-out.
+The card service connection attribute can be used thereafter to transmit
+APDU commands to the card, as with the reader centric approach.
+
+ >>> cardservice.connection.connect()
+ >>> print toHexString( cardservice.connection.getATR() )
+
+If necessary, the reader used for the connection can be accessed thru
+the `CardConnection
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardConnection.CardConnection-class.html>`_
+object:
+
+ >>> print cardservice.connection.getReader()
+ SchlumbergerSema Reflex USB v.2 0
+
+The `ATRCardType
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardType.ATRCardType-class.html>`_
+also supports masks:
+
+ >>> from smartcard.CardType import ATRCardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.util import toHexString, toBytes
+ >>>
+ >>> cardtype = ATRCardType( toBytes( "3B 15 94 20 02 01 00 00 0F" ), toBytes( "00 00 FF FF FF FF FF FF 00" ) )
+ >>> cardrequest = CardRequest( timeout=1, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> cardservice.connection.connect()
+ >>> print toHexString( cardservice.connection.getATR() )
+ 3B 16 94 20 02 01 00 00 0D
+
+Other CardTypes are available, and new CardTypes can be created, as
+described below.
+
+Requesting any card
+-------------------
+
+The `AnyCardType
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardType.AnyCardType-class.html>`_
+is useful for requesting any card in any reader:
+
+ >>> from smartcard.CardType import AnyCardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.util import toHexString
+ >>>
+ >>> cardtype = AnyCardType()
+ >>> cardrequest = CardRequest( timeout=1, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> cardservice.connection.connect()
+ >>> print toHexString( cardservice.connection.getATR() )
+ 3B 16 94 20 02 01 00 00 0D
+ >>> print cardservice.connection.getReader()
+ SchlumbergerSema Reflex USB v.2 0
+
+Custom CardTypes
+----------------
+
+Custom CardTypes can be created, e.g. a card type that checks the ATR
+and the historical bytes of the card. To create a custom CardType,
+deriver your CardType class from the `CardType
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardType.CardType-class.html>`_
+base class (or any other CardType) and override the matches() method.
+For exemple to create a DCCardType that will match cards with the direct
+convention (first byte of ATR to 0x3b):
+
+ >>> from smartcard.CardType import CardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.util import toHexString
+ >>>
+ >>> class DCCardType(CardType):
+ ... def matches( self, atr, reader=None ):
+ ... return atr[0]==0x3B
+ ...
+ >>> cardtype = DCCardType()
+ >>> cardrequest = CardRequest( timeout=1, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> cardservice.connection.connect()
+ >>> print toHexString( cardservice.connection.getATR() )
+ 3B 16 94 20 02 01 00 00 0D
+ >>> print cardservice.connection.getReader()
+ SchlumbergerSema Reflex USB v.2 0
+ >>>
+
+Scripts written with the card-centric approach fixes the problems of the
+reader-centric approach:
+
+* there is no assumption concerning the reader index or reader name; the
+ desired card will be located in any reader
+
+* the request will block or time-out if the desired card type is not
+ inserted since we request the desired card type, the script is not
+ played on an unknown or uncompatible card
+
+Scripts written with the card-centric approach have however the
+following drawbacks:
+
+* the script is limited to a specific card type; we have to modify the
+ script if we want to execute the script on another card type. For
+ exemple, we have to modify the ATR of the card if we are using the
+ ATRCardType. This can be partially solved by having a custom CardType
+ that matches several ATRs, though.
+
+Selecting the card communication protocol
+-----------------------------------------
+
+Communication parameters are mostly important for the protocol
+negociation between the smart card reader and the card. The main
+smartcard protocols are the T=0 protocol and the T=1 protocol, for byte
+or block transmission, respectively. The required protocol can be
+specified at card connection or card transmission.
+
+By defaults, the connect() method of the CardConnection object.will try
+to connect using either the T=0 or T=1 protocol. To force a connection
+protocol, you can pass the required protocol to the connect() method.
+
+ >>> from smartcard.CardType import AnyCardType
+ >>> from smartcard.CardConnection import CardConnection
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.util import toHexString
+ >>>
+ >>> cardtype = AnyCardType()
+ >>> cardrequest = CardRequest( timeout=1, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> cardservice.connection.connect( CardConnection.T1_protocol )
+ >>> print toHexString( cardservice.connection.getATR() )
+ 3B 16 94 20 02 01 00 00 0D
+ >>> print cardservice.connection.getReader()
+ SchlumbergerSema Reflex USB v.2 0
+
+Alternatively, you can specify the required protocol in the
+CardConnection transmit() method:
+
+ >>> from smartcard.CardType import AnyCardType
+ >>> from smartcard.CardConnection import CardConnection
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.util import toHexString, toBytes
+ >>>
+ >>> cardtype = AnyCardType()
+ >>> cardrequest = CardRequest( timeout=1, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> cardservice.connection.connect()
+ >>>
+ >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ >>> DF_TELECOM = [0x7F, 0x10]
+ >>>
+ >>> apdu = SELECT+DF_TELECOM
+ >>> print 'sending ' + toHexString(apdu)
+ sending A0 A4 00 00 02 7F 10
+ >>> response, sw1, sw2 = cardservice.connection.transmit( apdu, CardConnection.T1_protocol )
+ >>> print 'response: ', response, ' status words: ', "%x %x" % (sw1, sw2)
+ response: [] status words: 9f 1a
+ >>>
+ >>> if sw1 == 0x9F:
+ ... GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]
+ ... apdu = GET_RESPONSE + [sw2]
+ ... print 'sending ' + toHexString(apdu)
+ ... response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ ... print 'response: ', toHexString(response), ' status words: ', "%x %x" % (sw1, sw2)
+ ...
+ sending A0 C0 00 00 1A
+ response: 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00 83 8A 83 8A 00 01 00 00 status words: 90 0
+ >>>
+
+The object-centric approach
+===========================
+
+In the object-centric approach, we associate a high-level object with a
+set of smart cards supported by the object. For example we associate a
+javacard loader class with a set of javacard smart cards. We create a
+request for the specific object, and wait until a card supported by the
+object is inserted. Once a card supported by the object is inserted, we
+perform the required function by calling the objec methods.
+
+To be written...
+
+Tracing APDUs
+*************
+
+The brute force
+===============
+
+A straightforward way of tracing command and response APDUs is to insert
+print statements around the transmit() method calls:
+
+ >>> from smartcard.CardType import ATRCardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.util import toHexString, toBytes
+ >>>
+ >>> cardtype = ATRCardType( toBytes( "3B 16 94 20 02 01 00 00 0D" ) )
+ >>> cardrequest = CardRequest( timeout=1, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> cardservice.connection.connect()
+ >>>
+ >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ >>> DF_TELECOM = [0x7F, 0x10]
+ >>>
+ >>> apdu = SELECT+DF_TELECOM
+ >>> print 'sending ' + toHexString(apdu)
+ sending A0 A4 00 00 02 7F 10
+ >>> response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ >>> print 'response: ', response, ' status words: ', "%x %x" % (sw1, sw2)
+ response: [] status words: 9f 1a
+ >>>
+ >>> if sw1 == 0x9F:
+ ... GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]
+ ... apdu = GET_RESPONSE + [sw2]
+ ... print 'sending ' + toHexString(apdu)
+ ... response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ ... print 'response: ', toHexString(response), ' status words: ', "%x %x" % (sw1, sw2)
+ ...
+ sending A0 C0 00 00 1A
+ response: 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00 83 8A 83 8A 00 01 00 00 status words: 90 0
+ >>>
+
+Scripts written this way are quite difficult to read, because there are
+more tracing statements than actual apdu transmits..
+
+A small improvement in visibility would be to replace the print
+instructions by functions, e.g.:
+
+ >>> from smartcard.CardType import ATRCardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.util import toHexString, toBytes
+ >>>
+ >>> cardtype = ATRCardType( toBytes( "3B 16 94 20 02 01 00 00 0D" ) )
+ >>> cardrequest = CardRequest( timeout=1, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> cardservice.connection.connect()
+ >>>
+ >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ >>> DF_TELECOM = [0x7F, 0x10]
+ >>>
+ >>> def trace_command(apdu):
+ ... print 'sending ' + toHexString(apdu)
+ ...
+ >>> def trace_response( response, sw1, sw2 ):
+ ... if None==response: response=[]
+ ... print 'response: ', toHexString(response), ' status words: ', "%x %x" % (sw1, sw2)
+ ...
+ >>> apdu = SELECT+DF_TELECOM
+ >>> trace_command(apdu)
+ sending A0 A4 00 00 02 7F 10
+ >>> response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ >>> trace_response( response, sw1, sw2 )
+ response: status words: 9f 1a
+ >>>
+ >>> if sw1 == 0x9F:
+ ... GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]
+ ... apdu = GET_RESPONSE + [sw2]
+ ... trace_command(apdu)
+ ... response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ ... trace_response( response, sw1, sw2 )
+ ...
+ sending A0 C0 00 00 1A
+ response: 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00 83 8A 83 8A 00 01 00 00 status words: 90 0
+ >>>
+
+Using card connection observers to trace apdu transmission
+==========================================================
+
+The prefered solution is to implement a card connection observer, and
+register the observer with the card connection. The card connection will
+then notify the observer when card connection events occur (e.g.
+connection, disconnection, apdu command or apdu response). This is
+illustrated in the following script:
+
+ >>> from smartcard.CardType import AnyCardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.CardConnectionObserver import ConsoleCardConnectionObserver
+ >>>
+ >>> GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]
+ >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ >>> DF_TELECOM = [0x7F, 0x10]
+ >>>
+ >>>
+ >>> cardtype = AnyCardType()
+ >>> cardrequest = CardRequest( timeout=10, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> observer=ConsoleCardConnectionObserver()
+ >>> cardservice.connection.addObserver( observer )
+ >>>
+ >>> cardservice.connection.connect()
+ connecting to SchlumbergerSema Reflex USB v.2 0
+ >>>
+ >>> apdu = SELECT+DF_TELECOM
+ >>> response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ > A0 A4 00 00 02 7F 10
+ < [] 9F 1A
+ >>> if sw1 == 0x9F:
+ ... apdu = GET_RESPONSE + [sw2]
+ ... response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ ... else:
+ ... print 'no DF_TELECOM'
+ ...
+ > A0 C0 00 00 1A
+ < 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00 83 8A 83 8A 00 01 00 00 90 0
+ >>>
+
+In this script, a `ConsoleCardConnectionObserver
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardConnectionObserver.ConsoleCardConnectionObserver-class.html>`_
+is attached to the card service connection once the watiforcard() call
+returns.
+
+ >>> observer=ConsoleCardConnectionObserver()
+ >>> cardservice.connection.addObserver( observer )
+
+On card connection events (connect, disconnect, transmit command apdu,
+receive response apdu), the card connection notifies its obersers with a
+`CarConnectionEvent
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardConnectionEvent.CardConnectionEvent-class.html>`_
+including the event type and the event data. The
+`ConsoleCardConnectionObserver
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardConnectionObserver.ConsoleCardConnectionObserver-class.html>`_
+is a simple observer that will print on the console the card connection
+events. The class definition is the following:
+
+.. sourcecode:: python
+
+ class ConsoleCardConnectionObserver( CardConnectionObserver ):
+ def update( self, cardconnection, ccevent ):
+
+ if 'connect'==ccevent.type:
+ print 'connecting to ' + cardconnection.getReader()
+
+ elif 'disconnect'==ccevent.type:
+ print 'disconnecting from ' + cardconnection.getReader()
+
+ elif 'command'==ccevent.type:
+ print '> ', toHexString( ccevent.args[0] )
+
+ elif 'response'==ccevent.type:
+ if []==ccevent.args[0]:
+ print '< [] ', "%-2X %-2X" % tuple(ccevent.args[-2:])
+ else:
+ print '< ', toHexString(ccevent.args[0]), "%-2X %-2X" % tuple(ccevent.args[-2:])
+
+The console card connection observer is thus printing the connect,
+disconnect, command and response apdu events:
+
+ >>> cardservice.connection.connect()
+ connecting to SchlumbergerSema Reflex USB v.2 0
+ >>>
+ >>> apdu = SELECT+DF_TELECOM
+ >>> response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ > A0 A4 00 00 02 7F 10
+ < [] 9F 1A
+ >>> if sw1 == 0x9F:
+ ... apdu = GET_RESPONSE + [sw2]
+ ... response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ ... else:
+ ... print 'no DF_TELECOM'
+ ...
+ > A0 C0 00 00 1A
+ < 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00 83 8A 83 8A 00 01 00 00 90 0
+
+A card connection observer's update methode is called upon card
+connection event, with the connection and the connection event as
+parameters. The `CardConnectionEvent
+<http://pyscard.sourceforge.net/epydoc/smartcard.CardConnectionEvent.CardConnectionEvent-class.html>`_
+class definition is the following:
+
+.. sourcecode:: python
+
+ class CardConnectionEvent:
+ """Base class for card connection events.
+
+ This event is notified by CardConnection objects.
+
+ type: 'connect', 'disconnect', 'command', 'response'
+ args: None for 'connect' or 'disconnect'
+ command APDU byte list for 'command'
+ [response data, sw1, sw2] for 'response'
+ type: 'connect' args:"""
+ def __init__( self, type, args=None):
+ self.type=type
+ self.args=args
+
+You can write your own card connection observer, for example to perform
+fancy output in a wxWindows frame, or apdu interpretation. The following
+scripts defines a small SELECT and GET RESPONSE apdu interpreter:
+
+ >>> from smartcard.CardType import AnyCardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.CardConnectionObserver import CardConnectionObserver
+ >>> from smartcard.util import toHexString
+ >>>
+ >>> from string import replace
+ >>>
+ >>> class TracerAndSELECTInterpreter( CardConnectionObserver ):
+ ... def update( self, cardconnection, ccevent ):
+ ... if 'connect'==ccevent.type:
+ ... print 'connecting to ' + cardconnection.getReader()
+ ... elif 'disconnect'==ccevent.type:
+ ... print 'disconnecting from ' + cardconnection.getReader()
+ ... elif 'command'==ccevent.type:
+ ... str=toHexString(ccevent.args[0])
+ ... str = replace( str , "A0 A4 00 00 02", "SELECT" )
+ ... str = replace( str , "A0 C0 00 00", "GET RESPONSE" )
+ ... print '> ', str
+ ... elif 'response'==ccevent.type:
+ ... if []==ccevent.args[0]:
+ ... print '< [] ', "%-2X %-2X" % tuple(ccevent.args[-2:])
+ ... else:
+ ... print '< ', toHexString(ccevent.args[0]), "%-2X %-2X" % tuple(ccevent.args[-2:])
+ ...
+ >>>
+ >>> GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]
+ >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ >>> DF_TELECOM = [0x7F, 0x10]
+ >>>
+ >>>
+ >>> cardtype = AnyCardType()
+ >>> cardrequest = CardRequest( timeout=10, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> observer=TracerAndSELECTInterpreter()
+ >>> cardservice.connection.addObserver( observer )
+ >>>
+ >>> cardservice.connection.connect()
+ connecting to SchlumbergerSema Reflex USB v.2 0
+ >>>
+ >>> apdu = SELECT+DF_TELECOM
+ >>> response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ > SELECT 7F 10
+ < [] 9F 1A
+ >>> if sw1 == 0x9F:
+ ... apdu = GET_RESPONSE + [sw2]
+ ... response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ ... else:
+ ... print 'no DF_TELECOM'
+ ...
+ > GET RESPONSE 1A
+ < 00 00 00 00 7F 10 02 00 00 00 00 00 0D 13 00 0A 04 00 83 8A 83 8A 00 01 00 00 90 0
+ >>>
+
+Testing for APDU transmission errors
+************************************
+
+Upon transmission and processing of an APDU, the smart card returns a
+pair of status words, SW1 and SW2, to report various success or error
+codes following the required processing. Some of these success or error
+codes are standardized in ISO7816-4, ISO7816-8 or ISO7816-9, for
+example. Other status word codes are standardized by standardization
+bodies such as Open Platform (e.g. javacard), 3GPP (e.g. SIM or USIM
+cards), or Eurocard-Mastercard-Visa (EMV) (e.g. banking cards). Finally,
+any smart card application developper can defined application related
+proprietary codes; for example the MUSCLE applet defines a set of
+prioprietary codes related to the MUSCLE applet features.
+
+Some of these status word codes are uniques, but others have a different
+meaning depending on the card type and its supported standards. For
+example, ISO7816-4 defines the error code 0x62 0x82 as "File
+Invalidated", whereas in Open Platform 2.1 the same error code is
+defined as "Card life cycle is CARD_LOCKED". As a result, the list of
+error codes that can be returned by a smart card and they interpretation
+depend on the card type. The following discussion outlines possible
+strategies to check and report smart card status word errors.
+
+The brute force for testing APDU transmission errors
+====================================================
+
+As for APDU tracing, a straightforward way of checking for errors in response APDUs during the execution of scripts is to insert testt statements after the transmit() method calls:
+
+ >>> from smartcard.CardType import AnyCardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.CardConnectionObserver import ConsoleCardConnectionObserver
+ >>>
+ >>> GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]
+ >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ >>> DF_TELECOM = [0x7F, 0x10]
+ >>>
+ >>> cardtype = AnyCardType()
+ >>> cardrequest = CardRequest( timeout=10, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> observer=ConsoleCardConnectionObserver()
+ >>> cardservice.connection.addObserver( observer )
+ >>>
+ >>> cardservice.connection.connect()
+ connecting to Utimaco CardManUSB 0
+ >>>
+ >>> apdu = SELECT+DF_TELECOM
+ >>> response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ > A0 A4 00 00 02 7F 10
+ < [] 6E 0
+ >>>
+ >>> if sw1 in range(0x61, 0x6f):
+ ... print "Error: sw1: %x sw2: %x" % (sw1, sw2)
+ ...
+ Error: sw1: 6e sw2: 0
+ >>> if sw1 == 0x9F:
+ ... apdu = GET_RESPONSE + [sw2]
+ ... response, sw1, sw2 = cardservice.connection.transmit( apdu )
+ ...
+ >>> cardservice.connection.disconnect()
+ disconnecting from Utimaco CardManUSB 0
+ >>>
+
+Scripts written this way are quite difficult to read, because there are
+more error detection statements than actual apdu transmits.
+
+An improvement in visibility is to wrap the transmit instruction inside
+a function mytransmit, e.g.:
+
+ >>> from smartcard.CardType import AnyCardType
+ >>> from smartcard.CardRequest import CardRequest
+ >>> from smartcard.CardConnectionObserver import ConsoleCardConnectionObserver
+ >>>
+ >>> def mytransmit( connection, apdu ):
+ ... response, sw1, sw2 = connection.transmit( apdu )
+ ... if sw1 in range(0x61, 0x6f):
+ ... print "Error: sw1: %x sw2: %x" % (sw1, sw2)
+ ... return response, sw1, sw2
+ ...
+ >>>
+ >>> GET_RESPONSE = [0XA0, 0XC0, 00, 00 ]
+ >>> SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
+ >>> DF_TELECOM = [0x7F, 0x10]
+ >>>
+ >>>
+ >>> cardtype = AnyCardType()
+ >>> cardrequest = CardRequest( timeout=10, cardType=cardtype )
+ >>> cardservice = cardrequest.waitforcard()
+ >>>
+ >>> observer=ConsoleCardConnectionObserver()
+ >>> cardservice.connection.addObserver( observer )
+ >>>
+ >>> cardservice.connection.connect()
+ connecting to Utimaco CardManUSB 0
+ >>>
+ >>> apdu = SELECT+DF_TELECOM
+ >>> response, sw1, sw2 = mytransmit( cardservice.connection, apdu )
+ > A0 A4 00 00 02 7F 10
+ < [] 6E 0
+ Error: sw1: 6e sw2: 0
+ >>>
+ >>> if sw1 == 0x9F:
+ ... apdu = GET_RESPONSE + [sw2]
+ ... response, sw1, sw2 = mytransmit( cardservice.connection, apdu )
+ ...
+ >>> cardservice.connection.disconnect()
+ disconnecting from Utimaco CardManUSB 0
+ >>>
+
+The prefered solution is for testing errors is to use
+smarcard.sw.ErrorChecker, as described in the following section.
+
+Checking APDU transmission errors with error checkers
+=====================================================
+
+Status word errors can occur from different sources. The ISO7816-4
+standards defines status words for sw1 in the range 0x62 to 0x6F and
+some values of sw2, except for 0x66 which is reserved for security
+related issues. The ISO7816-8 standards define other status words, e.g.
+sw1=0x68 and sw2=0x83 or 0x84 for command chaining errors. Other
+standards, like Open Platform, define additional status words error,
+e.g. sw1=0x94 and sw2=0x84.
+
+The prefered strategy for status word error checking is based around
+individual error checkers (smartcard.sw.ErrorChecker) that can be
+chained into an error checking chain (smartcars.sw.ErrorCheckingChain).
+
+Error checkers
+--------------
+
+An error checker is a class deriving from `ErrorChecker
+<http://pyscard.sourceforge.net/epydoc/smartcard.sw.ErrorChecker.ErrorChecker-class.html>`_
+that checks for recognized sw1, sw2 error conditions when called, and
+raises an exception when finding such condition. This is illustrated in
+the following sample:
+
+ >>> from smartcard.sw.ISO7816_4ErrorChecker import ISO7816_4ErrorChecker
+ >>>
+ >>> errorchecker=ISO7816_4ErrorChecker()
+ >>> errorchecker( [], 0x90, 0x00 )
+ >>> errorchecker( [], 0x6A, 0x80 )
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in ?
+ File "D:\projects\pyscard-install\factory\python\lib\site-packages\smartcard\sw\ISO7816_4ErrorChecker.py", line 137, in __call__
+ raise exception( data, sw1, sw2, message )
+ smartcard.sw.SWExceptions.CheckingErrorException: 'Status word exception: checking error - Incorrect parameters in the data field!'
+ >>>
+
+The first call to error checker does not raise an exception, since 90 00
+does not report any error. The second calls however raises a
+CheckingErrorException.
+
+Error checking chains
+---------------------
+
+Error checkers can be chained into `error checking chain
+<http://pyscard.sourceforge.net/epydoc/smartcard.sw.ErrorCheckingChain.ErrorCheckingChain-class.html>`_.
+Each checker in the chain is called until an error condition is met, in
+which case an exception is raised. This is illustrated in the following
+sample:
+
+ >>> from smartcard.sw.ISO7816_4ErrorChecker import ISO7816_4ErrorChecker
+ >>> from smartcard.sw.ISO7816_8ErrorChecker import ISO7816_8ErrorChecker
+ >>> from smartcard.sw.ISO7816_9ErrorChecker import ISO7816_9ErrorChecker
+ >>>
+ >>> from smartcard.sw.ErrorCheckingChain import ErrorCheckingChain
+ >>>
+ >>> errorchain = []
+ >>> errorchain=[ ErrorCheckingChain( errorchain, ISO7816_9ErrorChecker() ),
+ ... ErrorCheckingChain( errorchain, ISO7816_8ErrorChecker() ),
+ ... ErrorCheckingChain( errorchain, ISO7816_4ErrorChecker() ) ]
+ >>>
+ >>> errorchain[0]( [], 0x90, 0x00 )
+ >>> errorchain[0]( [], 0x6A, 0x8a )
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in ?
+ File "D:\projects\pyscard-install\factory\python\lib\site-packages\smartcard\sw\ErrorCheckingChain.py", line 60,
+ in __call__
+ self.strategy( data, sw1, sw2 )
+ File "D:\projects\pyscard-install\factory\python\lib\site-packages\smartcard\sw\ISO7816_9ErrorChecker.py", line 74, in __call__
+ raise exception( data, sw1, sw2, message )
+ smartcard.sw.SWExceptions.CheckingErrorException: 'Status word exception: checking error - DF name already exists!'
+ >>>
+
+In this sample, an error checking chain is created that will check first
+for iso 7816-9 errors, then iso7816-8 errors, and finally iso7816-4
+errors.
+
+The first call to the error chain does not raise an exception, since 90
+00 does not report any error. The second calls however raises a
+CheckingErrorException, caused by the iso7816-9 error checker.
+
+Filtering exceptions
+--------------------
+
+You can filter undesired exceptions in a chain by adding a filtered
+exception to the error checking chain::
+
+ >>> from smartcard.sw.ISO7816_4ErrorChecker import ISO7816_4ErrorChecker
+ >>> from smartcard.sw.ISO7816_8ErrorChecker import ISO7816_8ErrorChecker
+ >>> from smartcard.sw.ISO7816_9ErrorChecker import ISO7816_9ErrorChecker
+ >>>
+ >>> from smartcard.sw.ErrorCheckingChain import ErrorCheckingChain
+ >>>
+ >>> errorchain = []
+ >>> errorchain=[ ErrorCheckingChain( errorchain, ISO7816_9ErrorChecker() ),
+ ... ErrorCheckingChain( errorchain, ISO7816_8ErrorChecker() ),
+ ... ErrorCheckingChain( errorchain, ISO7816_4ErrorChecker() ) ]
+ >>>
+ >>>
+ >>> errorchain[0]( [], 0x90, 0x00 )
+ >>> errorchain[0]( ...
[truncated message content] |
|
From: <lu...@us...> - 2014-11-11 20:25:36
|
Revision: 648
http://sourceforge.net/p/pyscard/code/648
Author: ludov
Date: 2014-11-11 20:25:33 +0000 (Tue, 11 Nov 2014)
Log Message:
-----------
Fix project bug tracking URL
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/index.html
Modified: trunk/pyscard/src/smartcard/doc/index.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.html 2014-11-11 20:24:35 UTC (rev 647)
+++ trunk/pyscard/src/smartcard/doc/index.html 2014-11-11 20:25:33 UTC (rev 648)
@@ -29,7 +29,7 @@
<p>Report bugs, patches and feature requests using the
sourceforge <a href=
- "http://sourceforge.net/tracker/?group_id=196342">pyscard bug
+ "https://sourceforge.net/p/pyscard/_list/tickets">pyscard bug
tracking system</a>.</p>
<p>Pyscard consists of <a href=
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-11-11 20:24:39
|
Revision: 647
http://sourceforge.net/p/pyscard/code/647
Author: ludov
Date: 2014-11-11 20:24:35 +0000 (Tue, 11 Nov 2014)
Log Message:
-----------
Every Mac OS X version after Tiger are supported
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/index.html
Modified: trunk/pyscard/src/smartcard/doc/index.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.html 2014-11-11 20:19:11 UTC (rev 646)
+++ trunk/pyscard/src/smartcard/doc/index.html 2014-11-11 20:24:35 UTC (rev 647)
@@ -36,7 +36,7 @@
"epydoc/smartcard.scard.scard-module.html">smartcard.scard</a>,
an extension module wrapping Windows smart card base components
(also known as PCSC) on Windows and PCSC lite on linux and Mac OS
- X Tiger and Leopard, and <a href=
+ X Tiger and later versions, and <a href=
"epydoc/index.html">smartcard</a>, a higher level python
framework built on top of the raw PCSC API.</p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-11-11 20:19:24
|
Revision: 646
http://sourceforge.net/p/pyscard/code/646
Author: ludov
Date: 2014-11-11 20:19:11 +0000 (Tue, 11 Nov 2014)
Log Message:
-----------
Cleanup code
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/framework-samples.html
trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html
Modified: trunk/pyscard/src/smartcard/doc/framework-samples.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-11-11 20:17:06 UTC (rev 645)
+++ trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-11-11 20:19:11 UTC (rev 646)
@@ -32,8 +32,6 @@
<p align="center"><img src="images/pyscard.jpg" width="396"
height="540" align="middle" alt="pyscard"></p>
- <h2> </h2>
-
<h2>Smartcard python framework samples</h2>
<table summary="samples" border>
Modified: trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html 2014-11-11 20:17:06 UTC (rev 645)
+++ trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html 2014-11-11 20:19:11 UTC (rev 646)
@@ -243,7 +243,6 @@
pyscard lower layers interface to the PCSC API to access the
smart cards and smart card readers.</p>
- <p> </p>
<hr>
<h2><a name="quickstart" id="quickstart"></a>Quick-start</h2>
@@ -1795,7 +1794,6 @@
named transmitobserver, that connects to inserted cards and
transmit an APDU, in our case SELECT DF_TELECOM:</p>
- <p> </p>
<pre>
<font face="Courier New, Courier, mono" size="3" color="#0033FF">
# a card observer that connects to new cards and performs a transaction, e.g. SELECT DF_TELECOM
@@ -1892,7 +1890,6 @@
object, use the createConnection() method of the desired
card:</p>
- <p> </p>
<pre>
<font face="Courier New, Courier, mono" size="3" color="#0033FF">
class myobserver( CardObserver ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-11-11 20:17:14
|
Revision: 645
http://sourceforge.net/p/pyscard/code/645
Author: ludov
Date: 2014-11-11 20:17:06 +0000 (Tue, 11 Nov 2014)
Log Message:
-----------
Cleanup code
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/framework-samples.html
Modified: trunk/pyscard/src/smartcard/doc/framework-samples.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-11-11 20:15:12 UTC (rev 644)
+++ trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-11-11 20:17:06 UTC (rev 645)
@@ -16,8 +16,7 @@
"Get pyscard at SourceForge.net. Fast, secure and Free Open Source software downloads"></a>
<hr>
- <h1 align="center"> </h1>Last update : pyscard 1.6.16
- (Decembre 2012)
+ Last update : pyscard 1.6.16 (Decembre 2012)
<p><a href="pyscard-usersguide.html">pyscard</a> is a python
module adding smart cards support to <a href=
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-11-11 20:15:23
|
Revision: 644
http://sourceforge.net/p/pyscard/code/644
Author: ludov
Date: 2014-11-11 20:15:12 +0000 (Tue, 11 Nov 2014)
Log Message:
-----------
Remove piwik code
sourceforge.net removed support from hosted apps in 2014-06-19
https://sourceforge.net/p/forge/community-docs/Hosted Apps Retirement/
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/framework-samples.html
trunk/pyscard/src/smartcard/doc/index.html
trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html
trunk/pyscard/src/smartcard/doc/scard-samples.html
Modified: trunk/pyscard/src/smartcard/doc/framework-samples.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-11-11 20:11:00 UTC (rev 643)
+++ trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-11-11 20:15:12 UTC (rev 644)
@@ -143,20 +143,6 @@
<p>You should have received a copy of the GNU Lesser General
Public License along with pyscard; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA</p><!-- Piwik -->
- <script type="text/javascript">
-var pkBaseURL = (("https:" == document.location.protocol) ? "https://sourceforge.net/apps/piwik/pyscard/" : "http://sourceforge.net/apps/piwik/pyscard/");
- document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
- </script><script type="text/javascript">
-piwik_action_name = '';
- piwik_idsite = 1;
- piwik_url = pkBaseURL + "piwik.php";
- piwik_log(piwik_action_name, piwik_idsite, piwik_url);
- </script><object>
- <noscript>
- <p><img src=
- "http://sourceforge.net/apps/piwik/pyscard/piwik.php?idsite=1"
- alt="piwik"></p></noscript>
- </object> <!-- End Piwik Tag -->
+ MA 02110-1301 USA</p>
</body>
</html>
Modified: trunk/pyscard/src/smartcard/doc/index.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/index.html 2014-11-11 20:11:00 UTC (rev 643)
+++ trunk/pyscard/src/smartcard/doc/index.html 2014-11-11 20:15:12 UTC (rev 644)
@@ -83,20 +83,6 @@
<p>You should have received a copy of the GNU Lesser General
Public License along with pyscard; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA</p><!-- Piwik -->
- <script type="text/javascript">
-var pkBaseURL = (("https:" == document.location.protocol) ? "https://sourceforge.net/apps/piwik/pyscard/" : "http://sourceforge.net/apps/piwik/pyscard/");
- document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
- </script><script type="text/javascript">
-piwik_action_name = '';
- piwik_idsite = 1;
- piwik_url = pkBaseURL + "piwik.php";
- piwik_log(piwik_action_name, piwik_idsite, piwik_url);
- </script><object>
- <noscript>
- <p><img src=
- "http://sourceforge.net/apps/piwik/pyscard/piwik.php?idsite=1"
- alt="piwik"></p></noscript>
- </object> <!-- End Piwik Tag -->
+ MA 02110-1301 USA</p>
</body>
</html>
Modified: trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html 2014-11-11 20:11:00 UTC (rev 643)
+++ trunk/pyscard/src/smartcard/doc/pyscard-usersguide.html 2014-11-11 20:15:12 UTC (rev 644)
@@ -2674,20 +2674,5 @@
ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
<hr>
- <!-- Piwik -->
- <script type="text/javascript">
-var pkBaseURL = (("https:" == document.location.protocol) ? "https://sourceforge.net/apps/piwik/pyscard/" : "http://sourceforge.net/apps/piwik/pyscard/");
- document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
- </script><script type="text/javascript">
-piwik_action_name = '';
- piwik_idsite = 1;
- piwik_url = pkBaseURL + "piwik.php";
- piwik_log(piwik_action_name, piwik_idsite, piwik_url);
- </script><object>
- <noscript>
- <p><img src=
- "http://sourceforge.net/apps/piwik/pyscard/piwik.php?idsite=1"
- alt="piwik"></p></noscript>
- </object> <!-- End Piwik Tag -->
</body>
</html>
Modified: trunk/pyscard/src/smartcard/doc/scard-samples.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/scard-samples.html 2014-11-11 20:11:00 UTC (rev 643)
+++ trunk/pyscard/src/smartcard/doc/scard-samples.html 2014-11-11 20:15:12 UTC (rev 644)
@@ -140,20 +140,6 @@
<p>You should have received a copy of the GNU Lesser General
Public License along with pyscard; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- MA 02110-1301 USA</p><!-- Piwik -->
- <script type="text/javascript">
-var pkBaseURL = (("https:" == document.location.protocol) ? "https://sourceforge.net/apps/piwik/pyscard/" : "http://sourceforge.net/apps/piwik/pyscard/");
- document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
- </script><script type="text/javascript">
-piwik_action_name = '';
- piwik_idsite = 1;
- piwik_url = pkBaseURL + "piwik.php";
- piwik_log(piwik_action_name, piwik_idsite, piwik_url);
- </script><object>
- <noscript>
- <p><img src=
- "http://sourceforge.net/apps/piwik/pyscard/piwik.php?idsite=1"
- alt="piwik"></p></noscript>
- </object> <!-- End Piwik Tag -->
+ MA 02110-1301 USA</p>
</body>
</html>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lu...@us...> - 2014-11-11 20:11:18
|
Revision: 643
http://sourceforge.net/p/pyscard/code/643
Author: ludov
Date: 2014-11-11 20:11:00 +0000 (Tue, 11 Nov 2014)
Log Message:
-----------
Reformat
run "tidy -im"
Modified Paths:
--------------
trunk/pyscard/src/smartcard/doc/framework-samples.html
Modified: trunk/pyscard/src/smartcard/doc/framework-samples.html
===================================================================
--- trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-11-11 20:09:28 UTC (rev 642)
+++ trunk/pyscard/src/smartcard/doc/framework-samples.html 2014-11-11 20:11:00 UTC (rev 643)
@@ -1,113 +1,162 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
<html>
+<head>
+ <meta name="generator" content=
+ "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
-<head>
-<title>smartcard python framework samples</title>
+ <title>smartcard python framework samples</title>
</head>
-<body bgcolor="#ffffff">
-<H1 align="center">pyscard library samples</h1>
-<a href="http://sourceforge.net/projects/pyscard"><img
-src="http://sflogo.sourceforge.net/sflogo.php?group_id=196342&type=11"
-width="120" height="30" align="right" alt="Get pyscard at SourceForge.net. Fast,
-secure and Free Open
-Source software downloads" /></a> <hr>
-<H1 align="center"> </h1>
-Last update : pyscard 1.6.16 (Decembre 2012)
-<p> <a href="pyscard-usersguide.html">pyscard</a> is a python module
- adding smart cards support to <a href="http://www.python.org">python</a>.
-<p>It consists of <a
- href="epydoc/smartcard.scard.scard-module.html">smartcard.scard</a>, an
- extension module wrapping Windows smart card base components (also known as
- PCSC), and <a href="epydoc/index.html">smartcard</a>, a python framework
- library hiding PCSC complexity.
-<p align="center"><img src="images/pyscard.jpg" width="396" height="540"
- align="middle" alt="pyscard">
-<h2> </h2>
-<H2>Smartcard python framework samples</H2>
-<table summary="samples" border>
- <tr>
- <td width="327">Display the ATR of inserted cards</td>
- <td width="76"><a href="Examples/simple/getATR.py" >view source</a></td>
- </tr>
- <tr>
- <td width="327">Selecting the DF_TELECOM of a card</td>
- <td width="76"><a href="Examples/simple/selectDF_TELECOM.py" >view source</a></td>
- </tr>
- <tr>
- <td width="327">A simple apdu tracer and interpreter</td>
- <td width="76"><a
- href="Examples/framework/sample_apduTracerInterpreter.py" >view source</a></td>
- </tr>
- <tr>
- <td width="327">Tracing connection events</td>
- <td width="76"><a
- href="Examples/framework/sample_ConsoleConnectionTracer.py" >view source</a></td>
- </tr>
- <tr>
- <td width="327">Decorating Card Connections to add custom behavior</td>
- <td width="76"><a
- href="Examples/framework/sample_CardConnectionDecorator.py" >view source</a></td>
- </tr>
- <tr>
- <td width="327">Detecting response apdu errors</td>
- <td width="76"><a href="Examples/framework/sample_ErrorChecking.py" >view
+
+<body bgcolor="#FFFFFF">
+ <h1 align="center">pyscard library samples</h1><a href=
+ "http://sourceforge.net/projects/pyscard"><img src=
+ "http://sflogo.sourceforge.net/sflogo.php?group_id=196342&type=11"
+ width="120" height="30" align="right" alt=
+ "Get pyscard at SourceForge.net. Fast, secure and Free Open Source software downloads"></a>
+ <hr>
+
+ <h1 align="center"> </h1>Last update : pyscard 1.6.16
+ (Decembre 2012)
+
+ <p><a href="pyscard-usersguide.html">pyscard</a> is a python
+ module adding smart cards support to <a href=
+ "http://www.python.org">python</a>.</p>
+
+ <p>It consists of <a href=
+ "epydoc/smartcard.scard.scard-module.html">smartcard.scard</a>,
+ an extension module wrapping Windows smart card base components
+ (also known as PCSC), and <a href=
+ "epydoc/index.html">smartcard</a>, a python framework library
+ hiding PCSC complexity.</p>
+
+ <p align="center"><img src="images/pyscard.jpg" width="396"
+ height="540" align="middle" alt="pyscard"></p>
+
+ <h2> </h2>
+
+ <h2>Smartcard python framework samples</h2>
+
+ <table summary="samples" border>
+ <tr>
+ <td width="327">Display the ATR of inserted cards</td>
+
+ <td width="76"><a href="Examples/simple/getATR.py">view
source</a></td>
- </tr>
- <tr>
- <td width="327">Implementing a custom ErrorChecker</td>
- <td width="76"><a href="Examples/framework/sample_CustomErrorChecker.py"
- >view source</a></td>
- </tr>
- <tr>
- <td width="327">Implementing a custom card type</td>
- <td width="76"><a href="Examples/framework/sample_CustomCardType.py" >view
+ </tr>
+
+ <tr>
+ <td width="327">Selecting the DF_TELECOM of a card</td>
+
+ <td width="76"><a href=
+ "Examples/simple/selectDF_TELECOM.py">view source</a></td>
+ </tr>
+
+ <tr>
+ <td width="327">A simple apdu tracer and interpreter</td>
+
+ <td width="76"><a href=
+ "Examples/framework/sample_apduTracerInterpreter.py">view
source</a></td>
- </tr>
- <tr>
- <td width="327">Monitoring smartcard readers</td>
- <td width="76"><a href="Examples/framework/sample_MonitorReaders.py" >view
+ </tr>
+
+ <tr>
+ <td width="327">Tracing connection events</td>
+
+ <td width="76"><a href=
+ "Examples/framework/sample_ConsoleConnectionTracer.py">view
source</a></td>
- </tr>
- <tr>
- <td width="327">Monitoring smartcard insertion/removal</td>
- <td width="76"><a href="Examples/framework/sample_MonitorCards.py" >view source</a></td>
- </tr>
- <tr>
- <td width="327">APDU/ATR byte to string utilities</td>
- <td width="76"><a href="Examples/framework/sample_toHexString.py" >view source</a></td>
- </tr>
-</table>
+ </tr>
-<hr>
-<p>This file is part of pyscard.</p>
-<p>pyscard is free software; you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 2.1 of the License, or (at your option)
- any later version.</p>
-<p>pyscard is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- details.</p>
-<p>You should have received a copy of the GNU Lesser General Public License along
- with pyscard; if not, write to the Free Software Foundation, Inc., 51 Franklin
- St, Fifth Floor, Boston, MA 02110-1301 USA</p>
-</body>
-<!-- Piwik -->
-<script type="text/javascript">
-var pkBaseURL = (("https:" == document.location.protocol) ? "https://sourceforge.net/apps/piwik/pyscard/" : "http://sourceforge.net/apps/piwik/pyscard/");
-document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
-</script><script type="text/javascript">
-piwik_action_name = '';
-piwik_idsite = 1;
-piwik_url = pkBaseURL + "piwik.php";
-piwik_log(piwik_action_name, piwik_idsite, piwik_url);
-</script>
-<object><noscript><p><img src="http://sourceforge.net/apps/piwik/pyscard/piwik.php?idsite=1" alt="piwik"/></p></noscript></object>
-<!-- End Piwik Tag -->
- </html>
+ <tr>
+ <td width="327">Decorating Card Connections to add custom
+ behavior</td>
+ <td width="76"><a href=
+ "Examples/framework/sample_CardConnectionDecorator.py">view
+ source</a></td>
+ </tr>
+ <tr>
+ <td width="327">Detecting response apdu errors</td>
+ <td width="76"><a href=
+ "Examples/framework/sample_ErrorChecking.py">view
+ source</a></td>
+ </tr>
+ <tr>
+ <td width="327">Implementing a custom ErrorChecker</td>
+ <td width="76"><a href=
+ "Examples/framework/sample_CustomErrorChecker.py">view
+ source</a></td>
+ </tr>
+ <tr>
+ <td width="327">Implementing a custom card type</td>
+
+ <td width="76"><a href=
+ "Examples/framework/sample_CustomCardType.py">view
+ source</a></td>
+ </tr>
+
+ <tr>
+ <td width="327">Monitoring smartcard readers</td>
+
+ <td width="76"><a href=
+ "Examples/framework/sample_MonitorReaders.py">view
+ source</a></td>
+ </tr>
+
+ <tr>
+ <td width="327">Monitoring smartcard insertion/removal</td>
+
+ <td width="76"><a href=
+ "Examples/framework/sample_MonitorCards.py">view
+ source</a></td>
+ </tr>
+
+ <tr>
+ <td width="327">APDU/ATR byte to string utilities</td>
+
+ <td width="76"><a href=
+ "Examples/framework/sample_toHexString.py">view
+ source</a></td>
+ </tr>
+ </table>
+ <hr>
+
+ <p>This file is part of pyscard.</p>
+
+ <p>pyscard is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later
+ version.</p>
+
+ <p>pyscard is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.</p>
+
+ <p>You should have received a copy of the GNU Lesser General
+ Public License along with pyscard; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ MA 02110-1301 USA</p><!-- Piwik -->
+ <script type="text/javascript">
+var pkBaseURL = (("https:" == document.location.protocol) ? "https://sourceforge.net/apps/piwik/pyscard/" : "http://sourceforge.net/apps/piwik/pyscard/");
+ document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
+ </script><script type="text/javascript">
+piwik_action_name = '';
+ piwik_idsite = 1;
+ piwik_url = pkBaseURL + "piwik.php";
+ piwik_log(piwik_action_name, piwik_idsite, piwik_url);
+ </script><object>
+ <noscript>
+ <p><img src=
+ "http://sourceforge.net/apps/piwik/pyscard/piwik.php?idsite=1"
+ alt="piwik"></p></noscript>
+ </object> <!-- End Piwik Tag -->
+</body>
+</html>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|