rebuilt documentation

This commit is contained in:
Frank Morgner
2016-10-10 12:25:54 +02:00
parent 83bd6659dc
commit 5bc798fd31
196 changed files with 53200 additions and 0 deletions

View File

@@ -0,0 +1,745 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Virtual Smart Card &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../index.html" />
<link rel="next" title="Remote Smart Card Reader" href="../remote-reader/README.html" />
<link rel="prev" title="Welcome to the Virtual Smart Card Architecture documentation!" href="../index.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">Virtual Smart Card</a><ul>
<li><a class="reference internal" href="#download">Download</a></li>
<li><a class="reference internal" href="#installation">Installation</a><ul>
<li><a class="reference internal" href="#installation-on-linux-unix-and-similar">Installation on Linux, Unix and similar</a></li>
<li><a class="reference internal" href="#building-and-installing-vpcd-on-mac-os-x">Building and installing <abbr title="virtual smart card reader">vpcd</abbr> on Mac OS X</a></li>
<li><a class="reference internal" href="#building-and-installing-vpcd-on-windows">Building and installing <abbr title="virtual smart card reader">vpcd</abbr> on Windows</a></li>
</ul>
</li>
<li><a class="reference internal" href="#using-the-virtual-smart-card">Using the Virtual Smart Card</a><ul>
<li><a class="reference internal" href="#configuring-vpcd-on-unix">Configuring <abbr title="virtual smart card reader">vpcd</abbr> on Unix</a></li>
<li><a class="reference internal" href="#configuring-vpcd-on-mac-os-x">Configuring <abbr title="virtual smart card reader">vpcd</abbr> on Mac OS X</a></li>
<li><a class="reference internal" href="#configuring-vpcd-on-windows">Configuring <abbr title="virtual smart card reader">vpcd</abbr> on Windows</a></li>
<li><a class="reference internal" href="#running-vpicc">Running <abbr title="virtual smart card">vpicc</abbr></a></li>
</ul>
</li>
<li><a class="reference internal" href="#question">Question</a></li>
<li><a class="reference internal" href="#notes-and-references">Notes and References</a></li>
</ul>
</li>
</ul>
</ul>
</li>
<li>
<a href="../index.html" title="Previous Chapter: Welcome to the Virtual Smart Card Architecture documentation!"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; Welcome to the V...</span>
</a>
</li>
<li>
<a href="../remote-reader/README.html" title="Next Chapter: Remote Smart Card Reader"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">Remote Smart Car... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="virtual-smart-card">
<span id="vicc"></span><h1>Virtual Smart Card<a class="headerlink" href="#virtual-smart-card" title="Permalink to this headline"></a></h1>
<div class="sidebar">
<p class="first sidebar-title">Summary</p>
<blockquote>
<div>Smart card emulator written in Python</div></blockquote>
<table class="last docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Authors:</th><td class="field-body"><ul class="first simple">
<li><a class="reference external" href="mailto:frankmorgner&#37;&#52;&#48;gmail&#46;com">Frank Morgner</a></li>
<li><a class="reference external" href="mailto:oepen&#37;&#52;&#48;informatik&#46;hu-berlin&#46;de">Dominik Oepen</a></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">License:</th><td class="field-body"><p class="first">GPL version 3</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name" colspan="2">Tested Platforms:</th></tr>
<tr class="field-odd field"><td>&nbsp;</td><td class="field-body"><ul class="first last simple">
<li>Windows</li>
<li>Mac OS X</li>
<li>Linux (Debian, Ubuntu, OpenMoko)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<p>Virtual Smart Card emulates a smart card and makes it accessible through PC/SC.
Currently the Virtual Smart Card supports the following types of smart cards:</p>
<ul class="simple">
<li>Generic ISO-7816 smart card including secure messaging</li>
<li>German electronic identity card (nPA) with complete support for <abbr title="Extended Access Control">EAC</abbr>
(<abbr title="Password Authenticated Connection Establishment">PACE</abbr>, <abbr title="Terminal Authenticatation">TA</abbr>, <abbr title="Chip Authentication">CA</abbr>)</li>
<li>Electronic passport (ePass/MRTD) with support for <abbr title="Basic Access Control">BAC</abbr></li>
<li>Cryptoflex smart card (incomplete)</li>
</ul>
<p>The <abbr title="virtual smart card reader">vpcd</abbr> is a smart card reader driver for <a class="reference external" href="http://pcsclite.alioth.debian.org/">PCSC-Lite</a> <a class="footnote-reference" href="#id5" id="id6">[4]</a> and the windows smart
card service. It allows smart card applications to access the <abbr title="virtual smart card">vpicc</abbr> through
the PC/SC API. By default <abbr title="virtual smart card reader">vpcd</abbr> opens slots for communication with multiple
<abbr title="virtual smart card">vpicc</abbr>&#8216;s on localhost on port 35963 and port 35964. But the <abbr title="virtual smart card">vpicc</abbr> does not
need to run on the same machine as the <abbr title="virtual smart card reader">vpcd</abbr>, they can connect over the
internet for example.</p>
<p>Although the Virtual Smart Card is a software emulator, you can use
<a class="reference internal" href="../pcsc-relay/README.html#pcsc-relay"><span>PC/SC Relay</span></a> to make it accessible to an external contact-less smart card
reader.</p>
<p>The file <code class="file docutils literal"><span class="pre">utils.py</span></code> was taken from Henryk Plötz&#8217;s <a class="reference external" href="https://github.com/henryk/cyberflex-shell">cyberflex-shell</a> <a class="footnote-reference" href="#id3" id="id4">[3]</a>.</p>
<div class="figure">
<p><img src="../_images/tikz-c2b6e0c4be766388efb50a965bcb6f691308c688.png" alt="\input{%(wd)s/bilder/tikzstyles.tex}
\node (pcsclite)
[klein, aktivbox, inner xsep=.7cm, text width=3cm]
{PC/SC Framework\\\
(\texttt{pcscd} or \texttt{SCardSvr})
};
\node (sca) [aktivbox, klein, left=of pcsclite] {Smart Card\\Application};
\node (vpcd) [box, at=(pcsclite.east), xshift=-.3cm] {\texttt{vpcd}};
\node (vicc) [aktivbox, right=2cm of pcsclite] {\texttt{vicc}};
\begin{pgfonlayer}{background}
\path[linie]
(sca) edge (pcsclite)
(vpcd) edge node {\includegraphics[width=1.2cm]{%(wd)s/bilder/simplecloud.pdf}} (vicc)
;
\end{pgfonlayer}" /></p>
<p class="caption">Virtual Smart Card used with PCSC-Lite or WinSCard</p></div><div class="versionadded">
<p><span class="versionmodified">New in version 0.7: </span>The Virtual Smart Card optionally brings its own standalone implementation of
PC/SC. This allows accessing <abbr title="virtual smart card">vpicc</abbr> without PCSC-Lite. Our PC/SC
implementation acts as replacement for <code class="docutils literal"><span class="pre">libpcsclite</span></code> which can lead to
problems when used in parallel with PCSC-Lite.</p>
</div>
<div class="figure">
<p><img src="../_images/tikz-e85c075dfcf44812d62f226411c87c9477920e37.png" alt="\input{%(wd)s/bilder/tikzstyles.tex}
\node (pcsclite)
[klein, box, text width=4cm]
{Virtual Smart Card's\\
PC/SC Framework
};
\node (sca) [aktivbox, klein, left=of pcsclite] {Smart Card\\Application};
\node (vicc) [aktivbox, right=2cm of pcsclite] {\texttt{vicc}};
\begin{pgfonlayer}{background}
\path[linie]
(sca) edge (pcsclite)
(pcsclite) edge node {\includegraphics[width=1.5cm]{%(wd)s/bilder/simplecloud.pdf}} (vicc)
;
\end{pgfonlayer}" /></p>
<p class="caption">Virtual Smart Card used with its own PC/SC implementation</p></div><p>On Android, where a traditional PC/SC framework is not available, you can use
our framework to make your real contact-less smart accessible through PKCS#11.
For example, an email signing application can use the PKCS#11 interface of
OpenSC, which is linked against our PC/SC implementation. Then an Android App
(e.g. <a class="reference internal" href="../remote-reader/README.html#remote-reader"><span>Remote Smart Card Reader</span></a>) can connect as <abbr title="virtual smart card">vpicc</abbr> delegating all requests and
responses via NFC to a contact-less smart card that signs the mail.</p>
<p>Depending on your usage of the <abbr title="virtual smart card">vpicc</abbr> you may need to install the following:</p>
<ul class="simple">
<li><a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference" href="#id7" id="id8">[5]</a></li>
<li><a class="reference external" href="http://pyscard.sourceforge.net/">pyscard</a> <a class="footnote-reference" href="#id9" id="id10">[6]</a> (relaying a local smart card with <code class="xref std std-option docutils literal"><span class="pre">--type=relay</span></code>)</li>
<li><a class="reference external" href="http://pycrypto.org/">PyCrypto</a> <a class="footnote-reference" href="#id11" id="id12">[7]</a>, <a class="reference external" href="https://www.dlitz.net/software/python-pbkdf2/">PBKDF2</a> <a class="footnote-reference" href="#id13" id="id14">[8]</a>, <a class="reference external" href="http://www.pythonware.com/products/pil/">PIL</a> <a class="footnote-reference" href="#id19" id="id20">[11]</a>, <a class="reference external" href="https://docs.python.org/3.3/library/readline.html">readline</a> <a class="footnote-reference" href="#id15" id="id16">[9]</a> or <a class="reference external" href="https://pypi.python.org/pypi/pyreadline">PyReadline</a> <a class="footnote-reference" href="#id17" id="id18">[10]</a> (emulation of electronic
passport with <code class="xref std std-option docutils literal"><span class="pre">--type=ePass</span></code>)</li>
<li><a class="reference external" href="https://github.com/frankmorgner/openpace">OpenPACE</a> <a class="footnote-reference" href="#id21" id="id22">[12]</a> (emulation of German identity card with <code class="xref std std-option docutils literal"><span class="pre">--type=nPA</span></code>)</li>
<li><a class="reference external" href="https://fukuchi.org/works/qrencode/">libqrencode</a> <a class="footnote-reference" href="#id23" id="id24">[13]</a> (to print a QR code on the command line for <cite>vpcd-config</cite>; an
URL will be printed if libqrencode is not available)</li>
</ul>
<div class="section" id="download">
<h2>Download<a class="headerlink" href="#download" title="Permalink to this headline"></a></h2>
<p>You can find the latest release of Virtual Smart Card on <a class="reference external" href="https://github.com/frankmorgner/vsmartcard/releases">Github</a>. Older releases are
still available on <a class="reference external" href="http://sourceforge.net/projects/vsmartcard/files">Sourceforge</a>.</p>
<p>Alternatively, you can clone our git repository:</p>
<div class="highlight-sh"><div class="highlight"><pre>git clone https://github.com/frankmorgner/vsmartcard.git
</pre></div>
</div>
</div>
<div class="section" id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h2>
<div class="section" id="installation-on-linux-unix-and-similar">
<h3>Installation on Linux, Unix and similar<a class="headerlink" href="#installation-on-linux-unix-and-similar" title="Permalink to this headline"></a></h3>
<p>The Virtual Smart Card uses the GNU Build System to compile and install. If you are
unfamiliar with it, please have a look at <code class="file docutils literal"><span class="pre">INSTALL</span></code>. If you can not find
it, you are probably working bleeding edge in the repository. Run the
following command in <code class="file docutils literal"><span class="pre">virtualsmartcard</span></code> to get the missing standard
auxiliary files:</p>
<div class="highlight-sh"><div class="highlight"><pre>autoreconf --verbose --install
</pre></div>
</div>
<p>To configure (<strong class="command">configure --help</strong> lists possible options), build and
install the Virtual Smart Card now do the following:</p>
<div class="highlight-sh"><div class="highlight"><pre>./configure --sysconfdir<span class="o">=</span>/etc
make
make install
</pre></div>
</div>
</div>
<div class="section" id="building-and-installing-vpcd-on-mac-os-x">
<h3>Building and installing <abbr title="virtual smart card reader">vpcd</abbr> on Mac OS X<a class="headerlink" href="#building-and-installing-vpcd-on-mac-os-x" title="Permalink to this headline"></a></h3>
<p>Mac OS X 10.9 and earlier is using PCSC-Lite as smart card service which allows
using the standard routine for <a class="reference internal" href="#vicc-install"><span>installation on Unix</span></a>.</p>
<p>Mac OS X 10.10 (and later) ships with a proprietary implementation of the PC/SC
layer instead of with PCSC-Lite. As far as we know, this means that smart card
readers must be USB devices instead of directly allowing a more generic type of
reader. To make <abbr title="virtual smart card reader">vpcd</abbr> work we simply configure it to pretend being a USB smart
card reader with an <code class="file docutils literal"><span class="pre">Ìnfo.plist</span></code>:</p>
<div class="highlight-sh"><div class="highlight"><pre>./configure --prefix<span class="o">=</span>/ --enable-infoplist
make
make install
</pre></div>
</div>
</div>
<div class="section" id="building-and-installing-vpcd-on-windows">
<h3>Building and installing <abbr title="virtual smart card reader">vpcd</abbr> on Windows<a class="headerlink" href="#building-and-installing-vpcd-on-windows" title="Permalink to this headline"></a></h3>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7: </span>We implemented <abbr title="virtual smart card reader">vpcd</abbr> as user mode device driver for Windows so that
<abbr title="virtual smart card">vpicc</abbr> can directly be used in Windows&#8217; smart card applications that use
PC/SC.</p>
</div>
<p>For the Windows integration we extended <a class="reference external" href="http://www.codeproject.com/Articles/134010/An-UMDF-Driver-for-a-Virtual-Smart-Card-Reader">Fabio Ottavi&#8217;s UMDF Driver for a
Virtual Smart Card Reader</a> <a class="footnote-reference" href="#id25" id="id26">[14]</a> with a <abbr title="virtual smart card reader">vpcd</abbr> interface. To build <abbr title="virtual smart card reader">vpcd</abbr> for
Windows we use <a class="reference external" href="http://msdn.microsoft.com/en-us/windows/hardware/hh852365.aspx">Windows Driver Kit 8.1 and Visual Studio 2013</a> <a class="footnote-reference" href="#id28" id="id29">[15]</a>. If you choose
to download the <a class="reference external" href="https://github.com/frankmorgner/vsmartcard/releases/download/virtualsmartcard-0.7/virtualsmartcard-0.7_win32.zip">Windows binaries</a> <a class="footnote-reference" href="#id34" id="id35">[18]</a>, you may directly jump to step 3.</p>
<ol class="arabic">
<li><p class="first">In Visual Studio select <span class="menuselection">File ‣ Open ‣ Convert
Sources/Dirs...</span> and choose the vpcd&#8217;s <code class="file docutils literal"><span class="pre">sources</span></code> either in the
<code class="file docutils literal"><span class="pre">WinXP</span></code> <a class="footnote-reference" href="#footnote1" id="id1">[1]</a> or <code class="file docutils literal"><span class="pre">Win7</span></code> folder.</p>
<p>When successfully imported, ensure with the configuration manager, that both
of the created projects are built for the same platform (x64 or Win32).</p>
</li>
<li><p class="first">If you can successfully <span class="guilabel">Build the solution</span>, you can find the
install package in <code class="file docutils literal"><span class="pre">BixVReader-package</span></code>. It contains <cite>BixVReader.inf</cite>
and the required libraries, especially <cite>BixVReader.dll</cite> and
<cite>WudfUpdate_01009.dll</cite> <a class="footnote-reference" href="#footnote2" id="id2">[2]</a>.</p>
</li>
<li><p class="first">Copy <code class="file docutils literal"><span class="pre">win32\BixVReader\BixVReader.ini</span></code> into the <span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal"><span class="pre">%SystemRoot%</span></code>
directory.</p>
</li>
<li><p class="first">In a console with administrator rights go to <code class="file docutils literal"><span class="pre">BixVReader-package</span></code> and
install the driver:</p>
<div class="highlight-sh"><div class="highlight"><pre><span class="s2">&quot;C:\Program Files\Windows Kits\8.1\Tools\x86\devcon.exe&quot;</span> install BixVReader.inf root<span class="se">\B</span>ixVirtualReader
</pre></div>
</div>
<p>You can adjust the path to <code class="docutils literal"><span class="pre">devcon.exe</span></code> with your version of the WDK and
your target architecture (e.g., use <code class="docutils literal"><span class="pre">...\x64\devcon.exe</span></code> for a 64 bit
driver). You can also download <a class="reference external" href="https://github.com/Microsoft/Windows-driver-samples/tree/master/setup/devcon">DevCon&#8217;s source code</a> <a class="footnote-reference" href="#id30" id="id31">[16]</a> and compile it
yourself.</p>
<p>For Win7 and older, code signing is optional and will yield a warning during
installation when missing. Simply click continue to install the driver anyway.</p>
<p>To activate the WDK test signing, use VS build-in Driver Signing settings.
Right click <span class="guilabel">BixVReader-package</span> <span class="menuselection">Properties ‣
Driver Signing ‣ Sign Mode ‣ Test Sign</span>. Import the WDKTestCert
certificate <code class="file docutils literal"><span class="pre">BixVReader-package.cer</span></code> into your windows keystore (e.g.
on local computer) and then install the driver. See
<a class="reference external" href="http://msdn.microsoft.com/en-us/library/windows/hardware/dn653569%28v=vs.85%29.aspx">Microsoft&#8217;s Kernel-Mode Code Signing Walkthrough</a> <a class="footnote-reference" href="#id32" id="id33">[17]</a> for
details.</p>
</li>
</ol>
<p>For debugging <abbr title="virtual smart card reader">vpcd</abbr> and building the driver with an older version of Visual
Studio or WDK please see <a class="reference external" href="http://www.codeproject.com/Articles/134010/An-UMDF-Driver-for-a-Virtual-Smart-Card-Reader">Fabio Ottavi&#8217;s UMDF Driver for a Virtual Smart Card
Reader</a> <a class="footnote-reference" href="#id25" id="id27">[14]</a> for details. All of Fabio&#8217;s card connectors (pipe reader/TCP/IP
reader) are still active by default.</p>
</div>
</div>
<div class="section" id="using-the-virtual-smart-card">
<h2>Using the Virtual Smart Card<a class="headerlink" href="#using-the-virtual-smart-card" title="Permalink to this headline"></a></h2>
<p>The protocol between <abbr title="virtual smart card reader">vpcd</abbr> and <abbr title="virtual smart card">vpicc</abbr> as well as details on extending <abbr title="virtual smart card">vpicc</abbr>
with a different card emulator are covered in <a class="reference internal" href="api.html#virtualsmartcard-api"><span>Creating a Virtual Smart Card</span></a>. Here
we will focus on configuring and running the provided modules.</p>
<div class="section" id="configuring-vpcd-on-unix">
<span id="vicc-config"></span><h3>Configuring <abbr title="virtual smart card reader">vpcd</abbr> on Unix<a class="headerlink" href="#configuring-vpcd-on-unix" title="Permalink to this headline"></a></h3>
<p>The configuration file of <abbr title="virtual smart card reader">vpcd</abbr> is usually placed into
<code class="file docutils literal"><span class="pre">/etc/reader.conf.d/</span></code>. For older versions of PCSC-Lite you
need to run <strong class="command">update-reader.conf</strong> to update <strong class="command">pcscd</strong>&#8216;s main
configuration file. The PC/SC daemon should read it and load the
<abbr title="virtual smart card reader">vpcd</abbr> on startup. In debug mode <strong class="command">pcscd -f -d</strong> should say something
like &#8220;Attempting startup of Virtual PCD&#8221; when loading <abbr title="virtual smart card reader">vpcd</abbr>.</p>
<p>By default, <abbr title="virtual smart card reader">vpcd</abbr> opens a socket for <abbr title="virtual smart card">vpicc</abbr> and waits for incoming
connections. The port to open should be specified in <code class="docutils literal"><span class="pre">CHANNELID</span></code> and
<code class="docutils literal"><span class="pre">DEVICENAME</span></code>:</p>
<div class="highlight-sh"><div class="highlight"><pre>FRIENDLYNAME <span class="s2">&quot;Virtual PCD&quot;</span>
<span class="hll">DEVICENAME /dev/null:0x8C7B
</span>LIBPATH /usr/lib/pcsc/drivers/serial/libifdvpcd.so
<span class="hll">CHANNELID 0x8C7B
</span></pre></div>
</div>
<p>If the first part of the <code class="docutils literal"><span class="pre">DEVICENAME</span></code> is different from <code class="docutils literal"><span class="pre">/dev/null</span></code>, <abbr title="virtual smart card reader">vpcd</abbr>
will use this string as a hostname for connecting to a waiting <abbr title="virtual smart card">vpicc</abbr>. <abbr title="virtual smart card">vpicc</abbr>
needs to be started with <code class="xref std std-option docutils literal"><span class="pre">--reversed</span></code> in this case.</p>
</div>
<div class="section" id="configuring-vpcd-on-mac-os-x">
<h3>Configuring <abbr title="virtual smart card reader">vpcd</abbr> on Mac OS X<a class="headerlink" href="#configuring-vpcd-on-mac-os-x" title="Permalink to this headline"></a></h3>
<p>Mac OS X 10.9 and earlier is using PCSC-Lite as smart card service which allows
using the standard routine for <a class="reference internal" href="#vicc-config"><span>configuration on Unix</span></a>.</p>
<p>On Mac OS X 10.10 you should have configured the generation of
<code class="file docutils literal"><span class="pre">Info.plist</span></code> at compile time. Now do the following for registering <abbr title="virtual smart card reader">vpcd</abbr>
as USB device:</p>
<ol class="arabic">
<li><p class="first">Choose an USB device (e.g. mass storage, phone, mouse, ...), which will be
used to start <abbr title="virtual smart card reader">vpcd</abbr>. Plug it into the computer.</p>
</li>
<li><p class="first">Run the following command to get the device&#8217;s product and vendor ID:</p>
<div class="highlight-sh"><div class="highlight"><pre>system_profiler SPUSBDataType
</pre></div>
</div>
</li>
<li><p class="first">Change <code class="file docutils literal"><span class="pre">/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Info.plist</span></code>
to match your product and vendor ID:</p>
</li>
</ol>
<div class="highlight-sh"><div class="highlight"><pre>&lt;?xml <span class="nv">version</span><span class="o">=</span><span class="s2">&quot;1.0&quot;</span> <span class="nv">encoding</span><span class="o">=</span><span class="s2">&quot;UTF-8&quot;</span>?&gt;
&lt;!DOCTYPE plist PUBLIC <span class="s2">&quot;-//Apple Computer//DTD PLIST 1.0//EN&quot;</span> <span class="s2">&quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;</span>&gt;
&lt;plist <span class="nv">version</span><span class="o">=</span><span class="s2">&quot;1.0&quot;</span>&gt;
&lt;dict&gt;
&lt;key&gt;CFBundleDevelopmentRegion&lt;/key&gt;
&lt;string&gt;English&lt;/string&gt;
&lt;key&gt;CFBundleExecutable&lt;/key&gt;
&lt;string&gt;libifdvpcd.dylib&lt;/string&gt;
&lt;key&gt;CFBundleInfoDictionaryVersion&lt;/key&gt;
&lt;string&gt;6.0&lt;/string&gt;
&lt;key&gt;CFBundleName&lt;/key&gt;
&lt;string&gt;ifd-vpcd&lt;/string&gt;
&lt;key&gt;CFBundlePackageType&lt;/key&gt;
&lt;string&gt;BNDL&lt;/string&gt;
&lt;key&gt;CFBundleSignature&lt;/key&gt;
&lt;string&gt;????&lt;/string&gt;
&lt;key&gt;CFBundleVersion&lt;/key&gt;
&lt;string&gt;0.8&lt;/string&gt;
&lt;key&gt;ifdManufacturerString&lt;/key&gt;
&lt;string&gt;Virtual Smart Card Architecture&lt;/string&gt;
&lt;key&gt;ifdProductString&lt;/key&gt;
&lt;string&gt;Virtual PCD&lt;/string&gt;
&lt;key&gt;ifdCapabilities&lt;/key&gt;
&lt;string&gt;0x00000000&lt;/string&gt;
&lt;key&gt;ifdProtocolSupport&lt;/key&gt;
&lt;string&gt;0x00000001&lt;/string&gt;
&lt;key&gt;ifdVersionNumber&lt;/key&gt;
&lt;string&gt;0x00000001&lt;/string&gt;
&lt;key&gt;ifdVendorID&lt;/key&gt;
&lt;array&gt;
<span class="hll"> &lt;string&gt;0x18d1&lt;/string&gt;
</span> &lt;/array&gt;
&lt;key&gt;ifdProductID&lt;/key&gt;
&lt;array&gt;
<span class="hll"> &lt;string&gt;0x4ee1&lt;/string&gt;
</span> &lt;/array&gt;
&lt;key&gt;ifdFriendlyName&lt;/key&gt;
&lt;array&gt;
&lt;string&gt;/dev/null:0x8C7B&lt;/string&gt;
&lt;/array&gt;
&lt;key&gt;Copyright&lt;/key&gt;
&lt;string&gt;This driver is protected by terms of the GNU General Public License version 3, or <span class="o">(</span>at your option<span class="o">)</span> any later version.&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</pre></div>
</div>
<p>Note that <code class="docutils literal"><span class="pre">ifdFriendlyName</span></code> can be used in the same way as <code class="docutils literal"><span class="pre">DEVICENAME</span></code>
<a class="reference internal" href="#vicc-config"><span>described above</span></a>.</p>
<ol class="arabic" start="4">
<li><p class="first">Restart the PC/SC service:</p>
<div class="highlight-sh"><div class="highlight"><pre>sudo killall -SIGKILL -m .*com.apple.ifdreader
</pre></div>
</div>
</li>
</ol>
<p>Now, every time you plug in your USB device <abbr title="virtual smart card reader">vpcd</abbr> will be started. It will be
stopped when you unplug the device.</p>
</div>
<div class="section" id="configuring-vpcd-on-windows">
<h3>Configuring <abbr title="virtual smart card reader">vpcd</abbr> on Windows<a class="headerlink" href="#configuring-vpcd-on-windows" title="Permalink to this headline"></a></h3>
<p>The configuration file <cite>BixVReader.ini</cite> of <abbr title="virtual smart card reader">vpcd</abbr> is usually placed into
<code class="file docutils literal"><span class="pre">C:\Windows</span></code> (<span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal"><span class="pre">SystemRoot</span></code>). The user mode device driver
framework (<strong class="command">WUDFHost.exe</strong>) should read it automatically and load the
<abbr title="virtual smart card reader">vpcd</abbr> on startup. The Windows Device Manager <strong class="command">mmc devmgmt.msc</strong> should
list the <span class="guilabel">Bix Virtual Smart Card Reader</span>.</p>
<p><abbr title="virtual smart card reader">vpcd</abbr> opens a socket for <abbr title="virtual smart card">vpicc</abbr> and waits for incoming
connections. The port to open should be specified in <code class="docutils literal"><span class="pre">TCP_PORT</span></code>:</p>
<div class="highlight-sh"><div class="highlight"><pre><span class="o">[</span>Driver<span class="o">]</span>
<span class="nv">NumReaders</span><span class="o">=</span>3
<span class="o">[</span>Reader0<span class="o">]</span>
<span class="nv">RPC_TYPE</span><span class="o">=</span>0
<span class="nv">VENDOR_NAME</span><span class="o">=</span>Fabio Ottavi
<span class="nv">VENDOR_IFD_TYPE</span><span class="o">=</span>Pipe Reader
<span class="hll"><span class="nv">DECIVE_UNIT</span><span class="o">=</span>0
</span>
<span class="o">[</span>Reader1<span class="o">]</span>
<span class="nv">RPC_TYPE</span><span class="o">=</span>1
<span class="nv">VENDOR_NAME</span><span class="o">=</span>Fabio Ottavi
<span class="nv">VENDOR_IFD_TYPE</span><span class="o">=</span>TCP/IP Reader
<span class="nv">DECIVE_UNIT</span><span class="o">=</span>1
<span class="o">[</span>Reader2<span class="o">]</span>
<span class="nv">RPC_TYPE</span><span class="o">=</span>2
<span class="nv">VENDOR_NAME</span><span class="o">=</span>Virtual Smart Card Architecture
<span class="nv">VENDOR_IFD_TYPE</span><span class="o">=</span>Virtual PCD
<span class="nv">TCP_PORT</span><span class="o">=</span>35963
<span class="nv">DECIVE_UNIT</span><span class="o">=</span>2
</pre></div>
</div>
<p>Currently it is not possible to configure the Windows driver to connect to an
<abbr title="virtual smart card">vpicc</abbr> running with <code class="xref std std-option docutils literal"><span class="pre">--reversed</span></code>.</p>
</div>
<div class="section" id="running-vpicc">
<h3>Running <abbr title="virtual smart card">vpicc</abbr><a class="headerlink" href="#running-vpicc" title="Permalink to this headline"></a></h3>
<p>The compiled <a class="reference external" href="https://github.com/frankmorgner/vsmartcard/releases/download/virtualsmartcard-0.7/virtualsmartcard-0.7_win32.zip">Windows binaries</a> <a class="footnote-reference" href="#id34" id="id36">[18]</a> of <abbr title="virtual smart card">vpicc</abbr> include OpenPACE. The other
dependencies listed above need to be installed seperately. You can start the
<abbr title="virtual smart card">vpicc</abbr> via <strong class="command">python.exe vicc.py</strong>. On all other systems an executable
script <strong class="command">vicc</strong> is installed using the autotools.</p>
<p>The <abbr title="virtual smart card">vpicc</abbr> option <code class="xref std std-option docutils literal"><span class="pre">--help</span></code> gives an overview about the command line
switches:</p>
<div class="highlight-text"><div class="highlight"><pre>usage: vicc [-h] [-t {iso7816,cryptoflex,ePass,nPA,relay,handler_test}] [-v]
[-f FILE] [-H HOSTNAME] [-P PORT] [-R] [--version]
[--reader READER] [--ef-cardaccess EF_CARDACCESS]
[--ef-cardsecurity EF_CARDSECURITY] [--cvca CVCA]
[--disable-ta-checks] [--ca-key CA_KEY] [-d DATASETFILE]
[--esign-cert ESIGN_CERT] [--esign-ca-cert ESIGN_CA_CERT]
Virtual Smart Card 0.8: Smart card emulator written in Python. The emulator
connects to the virtual smart card reader reader (vpcd). Smart card
applications can access the Virtual Smart Card through the vpcd via PC/SC.
optional arguments:
-h, --help show this help message and exit
-t {iso7816,cryptoflex,ePass,nPA,relay,handler_test}, --type {iso7816,cryptoflex,ePass,nPA,relay,handler_test}
type of smart card to emulate (default: iso7816)
-v, --verbose Use (several times) to be more verbose
-f FILE, --file FILE load a saved smart card image
-H HOSTNAME, --hostname HOSTNAME
specifiy vpcd&#39;s host name if vicc shall connect to it.
(default: localhost)
-P PORT, --port PORT port of connection establishment (default: 35963)
-R, --reversed use reversed connection mode. vicc will wait for an
incoming connection from vpcd. (default: False)
--version show program&#39;s version number and exit
Relaying a local smart card (`--type=relay`):
--reader READER number of the reader containing the card to be relayed
(default: 0)
Emulation of German identity card (`--type=nPA`):
--ef-cardaccess EF_CARDACCESS
the card&#39;s EF.CardAccess (default: use file from first
generation nPA)
--ef-cardsecurity EF_CARDSECURITY
the card&#39;s EF.CardSecurity (default: use file from
first generation nPA)
--cvca CVCA trust anchor for verifying certificates in TA
(default: use libeac&#39;s trusted certificates)
--disable-ta-checks disable checking the validity period of CV certifcates
(default: False)
--ca-key CA_KEY the chip&#39;s private key for CA (default: randomly
generated, invalidates signature of EF.CardSecurity)
-d DATASETFILE, --datasetfile DATASETFILE
Load the smartcard&#39;s data groups (DGs) from the
specified dataset file. For DGs not in dataset file
default values are used. The data groups in the data
set file must have the following syntax:
---------------------------------------------------
Datagroupname=Datagroupvalue
---------------------------------------------------
For Example: GivenNames=GERTRUD. The following Dataset
Elements may be used in the dataset file:
DocumentType, IssuingState, DateOfExpiry, GivenNames,
FamilyNames, ReligiousArtisticName, AcademicTitle,
DateOfBirth, PlaceOfBirth, Nationality, Sex,
BirthName, Country, City, ZIP, Street, CommunityID,
ResidencePermit1, ResidencePermit2, dg12, dg14, dg15,
dg16, dg21.
--esign-cert ESIGN_CERT
the card holder&#39;s certificate for QES
--esign-ca-cert ESIGN_CA_CERT
the CA&#39;s certificate for QES
Report bugs to https://github.com/frankmorgner/vsmartcard/issues
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7: </span>We implemented <strong class="command">vpcd-config</strong> which tries to guess the local IP
address and outputs <abbr title="virtual smart card reader">vpcd</abbr>&#8216;s configuration. <abbr title="virtual smart card">vpicc</abbr>&#8216;s options should be
chosen accordingly (<code class="xref std std-option docutils literal"><span class="pre">--hostname</span></code> and <code class="xref std std-option docutils literal"><span class="pre">--port</span></code>)
<strong class="command">vpcd-config</strong> also prints a QR code for configuration of the
<a class="reference internal" href="../remote-reader/README.html#remote-reader"><span>Remote Smart Card Reader</span></a>.</p>
</div>
<p>When <abbr title="virtual smart card reader">vpcd</abbr> and <abbr title="virtual smart card">vpicc</abbr> are connected you should be able to access the card
through the PC/SC API. You can use the <strong class="command">opensc-explorer</strong> or
<strong class="command">pcsc_scan</strong> for testing. In Virtual Smart Card&#8217;s root directory we also
provide scripts for testing with <a class="reference external" href="https://github.com/frankmorgner/OpenSC">npa-tool</a> <a class="footnote-reference" href="#id37" id="id38">[19]</a> and PCSC-Lite&#8217;s smart card
reader driver tester.</p>
</div>
</div>
<div class="section" id="question">
<h2>Question<a class="headerlink" href="#question" title="Permalink to this headline"></a></h2>
<p>Do you have questions, suggestions or contributions? Feedback of any kind is
more than welcome! Please use our <a class="reference external" href="https://github.com/frankmorgner/vsmartcard/issues">project trackers</a>.</p>
</div>
<div class="section" id="notes-and-references">
<h2>Notes and References<a class="headerlink" href="#notes-and-references" title="Permalink to this headline"></a></h2>
<table class="docutils footnote" frame="void" id="id3" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id4">[3]</a></td><td><a class="reference external" href="https://github.com/henryk/cyberflex-shell">https://github.com/henryk/cyberflex-shell</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id5" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id6">[4]</a></td><td><a class="reference external" href="http://pcsclite.alioth.debian.org/">http://pcsclite.alioth.debian.org/</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id7" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id8">[5]</a></td><td><a class="reference external" href="http://www.python.org/">http://www.python.org/</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id9" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id10">[6]</a></td><td><a class="reference external" href="http://pyscard.sourceforge.net/">http://pyscard.sourceforge.net/</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id11" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id12">[7]</a></td><td><a class="reference external" href="http://pycrypto.org/">http://pycrypto.org/</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id13" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id14">[8]</a></td><td><a class="reference external" href="https://www.dlitz.net/software/python-pbkdf2/">https://www.dlitz.net/software/python-pbkdf2/</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id15" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id16">[9]</a></td><td><a class="reference external" href="https://docs.python.org/3.3/library/readline.html">https://docs.python.org/3.3/library/readline.html</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id17" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id18">[10]</a></td><td><a class="reference external" href="https://pypi.python.org/pypi/pyreadline">https://pypi.python.org/pypi/pyreadline</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id19" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id20">[11]</a></td><td><a class="reference external" href="http://www.pythonware.com/products/pil/">http://www.pythonware.com/products/pil/</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id21" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id22">[12]</a></td><td><a class="reference external" href="https://github.com/frankmorgner/openpace">https://github.com/frankmorgner/openpace</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id23" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id24">[13]</a></td><td><a class="reference external" href="https://fukuchi.org/works/qrencode/">https://fukuchi.org/works/qrencode/</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id25" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[14]</td><td><em>(<a class="fn-backref" href="#id26">1</a>, <a class="fn-backref" href="#id27">2</a>)</em> <a class="reference external" href="http://www.codeproject.com/Articles/134010/An-UMDF-Driver-for-a-Virtual-Smart-Card-Reader">http://www.codeproject.com/Articles/134010/An-UMDF-Driver-for-a-Virtual-Smart-Card-Reader</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id28" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id29">[15]</a></td><td><a class="reference external" href="http://msdn.microsoft.com/en-us/windows/hardware/hh852365.aspx">http://msdn.microsoft.com/en-us/windows/hardware/hh852365.aspx</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id30" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id31">[16]</a></td><td><a class="reference external" href="https://github.com/Microsoft/Windows-driver-samples/tree/master/setup/devcon">https://github.com/Microsoft/Windows-driver-samples/tree/master/setup/devcon</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id32" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id33">[17]</a></td><td><a class="reference external" href="http://msdn.microsoft.com/en-us/library/windows/hardware/dn653569%28v=vs.85%29.aspx">http://msdn.microsoft.com/en-us/library/windows/hardware/dn653569%28v=vs.85%29.aspx</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id34" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[18]</td><td><em>(<a class="fn-backref" href="#id35">1</a>, <a class="fn-backref" href="#id36">2</a>)</em> <a class="reference external" href="https://github.com/frankmorgner/vsmartcard/releases/download/virtualsmartcard-0.7/virtualsmartcard-0.7_win32.zip">https://github.com/frankmorgner/vsmartcard/releases/download/virtualsmartcard-0.7/virtualsmartcard-0.7_win32.zip</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id37" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id38">[19]</a></td><td><a class="reference external" href="https://github.com/frankmorgner/OpenSC">https://github.com/frankmorgner/OpenSC</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="footnote1" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>With VS 2013 and WDK 8.1 no Windows XP driver can be build. You need to use an older version of VS with WDK 7.1.0.</td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="footnote2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td>Note that WudfUpdate_01009.dll for 32 bit will be around 1795 KB and for 64 bit around 2102 KB big.</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,548 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Creating a Virtual Smart Card &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../index.html" />
<link rel="next" title="virtualsmartcard Package" href="api/virtualsmartcard.html" />
<link rel="prev" title="nPA Smart Card Library" href="../npa/README.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">Creating a Virtual Smart Card</a><ul>
<li><a class="reference internal" href="#documentation-to-virtual-smart-card">Documentation to Virtual Smart Card</a></li>
<li><a class="reference internal" href="#examples">Examples</a><ul>
<li><a class="reference internal" href="#implementing-a-iso-7816-like-smart-card">Implementing a ISO 7816 like Smart Card</a></li>
<li><a class="reference internal" href="#implementing-an-other-type-of-card">Implementing an Other Type of Card</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</ul>
</li>
<li>
<a href="../npa/README.html" title="Previous Chapter: nPA Smart Card Library"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; nPA Smart Card L...</span>
</a>
</li>
<li>
<a href="api/virtualsmartcard.html" title="Next Chapter: virtualsmartcard Package"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">virtualsmartcard... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="creating-a-virtual-smart-card">
<span id="virtualsmartcard-api"></span><h1>Creating a Virtual Smart Card<a class="headerlink" href="#creating-a-virtual-smart-card" title="Permalink to this headline"></a></h1>
<p><abbr title="virtual smart card reader">vpcd</abbr> communicates over a socked with <abbr title="virtual smart card">vpicc</abbr> usually on port <code class="docutils literal"><span class="pre">0x8C7B</span></code>
(configurably via <code class="file docutils literal"><span class="pre">/etc/reader.conf.d/vpcd</span></code>). So you can connect
virtually any program to the virtual smart card reader, as long as you respect
the following protocol:</p>
<table border="1" class="docutils" id="vpcd-commands">
<colgroup>
<col width="22%" />
<col width="34%" />
<col width="22%" />
<col width="22%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head" colspan="2"><abbr title="virtual smart card reader">vpcd</abbr></th>
<th class="head" colspan="2"><abbr title="virtual smart card">vpicc</abbr></th>
</tr>
<tr class="row-even"><th class="head">Length</th>
<th class="head">Command</th>
<th class="head">Length</th>
<th class="head">Response</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">0x00</span> <span class="pre">0x01</span></code></td>
<td><code class="docutils literal"><span class="pre">0x00</span></code> (Power Off)</td>
<td>&nbsp;</td>
<td>(No Response)</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">0x00</span> <span class="pre">0x01</span></code></td>
<td><code class="docutils literal"><span class="pre">0x01</span></code> (Power On)</td>
<td>&nbsp;</td>
<td>(No Response)</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">0x00</span> <span class="pre">0x01</span></code></td>
<td><code class="docutils literal"><span class="pre">0x02</span></code> (Reset)</td>
<td>&nbsp;</td>
<td>(No Response)</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">0x00</span> <span class="pre">0x01</span></code></td>
<td><code class="docutils literal"><span class="pre">0x04</span></code> (Get ATR)</td>
<td><code class="docutils literal"><span class="pre">0xXX</span> <span class="pre">0xXX</span></code></td>
<td>(ATR)</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">0xXX</span> <span class="pre">0xXX</span></code></td>
<td>(APDU)</td>
<td><code class="docutils literal"><span class="pre">0xXX</span> <span class="pre">0xXX</span></code></td>
<td>(R-APDU)</td>
</tr>
</tbody>
</table>
<p>The communication is initiated by <abbr title="virtual smart card reader">vpcd</abbr>. First the length of the data (in
network byte order, i.e. big endian) is sent followed by the data itself.</p>
<div class="section" id="documentation-to-virtual-smart-card">
<h2>Documentation to Virtual Smart Card<a class="headerlink" href="#documentation-to-virtual-smart-card" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="api/virtualsmartcard.html">virtualsmartcard Package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.cards.html">cards Package</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api/virtualsmartcard.cards.HandlerTest.html">HandlerTest Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="api/virtualsmartcard.cards.Relay.html">Relay Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="api/virtualsmartcard.cards.cryptoflex.html">cryptoflex Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="api/virtualsmartcard.cards.ePass.html">ePass Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="api/virtualsmartcard.cards.nPA.html">nPA Module</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.tests.html">tests Package</a><ul>
<li class="toctree-l3"><a class="reference internal" href="api/virtualsmartcard.tests.CardGenerator_test.html">CardGenerator_test Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="api/virtualsmartcard.tests.CryptoUtils_test.html">CryptoUtils_test Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="api/virtualsmartcard.tests.SmartcardSAM_test.html">SmartcardSAM_test Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="api/virtualsmartcard.tests.utils_test.html">utils_test Module</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.CardGenerator.html">CardGenerator Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.ConstantDefinitions.html">ConstantDefinitions Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.CryptoUtils.html">CryptoUtils Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.SEutils.html">SEutils Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.SWutils.html">SWutils Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.SmartcardFilesystem.html">SmartcardFilesystem Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.SmartcardSAM.html">SmartcardSAM Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.TLVutils.html">TLVutils Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html">VirtualSmartcard Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/virtualsmartcard.utils.html">utils Module</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="section" id="implementing-a-iso-7816-like-smart-card">
<h3>Implementing a ISO 7816 like Smart Card<a class="headerlink" href="#implementing-a-iso-7816-like-smart-card" title="Permalink to this headline"></a></h3>
<p><abbr title="virtual smart card">vpicc</abbr> includes an emulation of a card acting according to ISO 7816. This
includes all standard commands for file management and secure messaging.</p>
<p>Let&#8217;s assume we want to create a cryptoflex card, that acts mostly according to
ISO 7816. In this example we only want to add little things that differ from
ISO 7816. But as for most complex software you need to know where you need to
hook into. Here we only want to give an overview to the design, the complete
details can be found in section <a class="reference internal" href="#documentation-to-virtual-smart-card">Documentation to Virtual Smart Card</a>.</p>
<p>Back to the cryptoflex example.
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.VirtualICC" title="virtualsmartcard.VirtualSmartcard.VirtualICC"><code class="xref py py-class docutils literal"><span class="pre">VirtualICC</span></code></a> provides the connection
to the virtual smart card reader. It fetches an <abbr title="Application Protocol Data Unit">APDU</abbr> and other requests from
the <abbr title="virtual smart card reader">vpcd</abbr>. In <a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.VirtualICC" title="virtualsmartcard.VirtualSmartcard.VirtualICC"><code class="xref py py-class docutils literal"><span class="pre">VirtualICC</span></code></a> an <abbr title="Application Protocol Data Unit">APDU</abbr>
is only a buffer that is forwarded to the smart card OS. First we modify
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.VirtualICC" title="virtualsmartcard.VirtualSmartcard.VirtualICC"><code class="xref py py-class docutils literal"><span class="pre">VirtualICC</span></code></a> to recognize a new type
<code class="docutils literal"><span class="pre">&quot;cryptoflex&quot;</span></code> and to load
<a class="reference internal" href="api/virtualsmartcard.cards.cryptoflex.html#virtualsmartcard.cards.cryptoflex.CryptoflexOS" title="virtualsmartcard.cards.cryptoflex.CryptoflexOS"><code class="xref py py-class docutils literal"><span class="pre">CryptoflexOS</span></code></a>. The
<a class="reference internal" href="api/virtualsmartcard.CardGenerator.html#module-virtualsmartcard.CardGenerator" title="virtualsmartcard.CardGenerator"><code class="xref py py-class docutils literal"><span class="pre">CardGenerator</span></code></a> is used to create a file system and a
<abbr title="Secure Access Module">SAM</abbr> specific to the cryptoflex (we come back to this later).</p>
<div class="highlight-python"><div class="highlight"><pre> <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">datasetfile</span><span class="p">,</span> <span class="n">card_type</span><span class="p">,</span> <span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">,</span>
<span class="n">readernum</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">ef_cardsecurity</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">ef_cardaccess</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">ca_key</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">cvca</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">disable_checks</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">esign_key</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">esign_ca_cert</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">esign_cert</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
<span class="n">logginglevel</span><span class="o">=</span><span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">):</span>
<span class="kn">from</span> <span class="nn">os.path</span> <span class="kn">import</span> <span class="n">exists</span>
<span class="n">logging</span><span class="o">.</span><span class="n">basicConfig</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">logginglevel</span><span class="p">,</span>
<span class="n">format</span><span class="o">=</span><span class="s">&quot;</span><span class="si">%(asctime)s</span><span class="s"> [</span><span class="si">%(levelname)s</span><span class="s">] </span><span class="si">%(message)s</span><span class="s">&quot;</span><span class="p">,</span>
<span class="n">datefmt</span><span class="o">=</span><span class="s">&quot;</span><span class="si">%d</span><span class="s">.%m.%Y %H:%M:%S&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">cardGenerator</span> <span class="o">=</span> <span class="n">CardGenerator</span><span class="p">(</span><span class="n">card_type</span><span class="p">)</span>
<span class="c"># If a dataset file is specified, read the card&#39;s data groups from disk</span>
<span class="k">if</span> <span class="n">datasetfile</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
<span class="k">if</span> <span class="n">exists</span><span class="p">(</span><span class="n">datasetfile</span><span class="p">):</span>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Reading Data Groups from file </span><span class="si">%s</span><span class="s">.&quot;</span><span class="p">,</span>
<span class="n">datasetfile</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">cardGenerator</span><span class="o">.</span><span class="n">readDatagroups</span><span class="p">(</span><span class="n">datasetfile</span><span class="p">)</span>
<span class="n">MF</span><span class="p">,</span> <span class="n">SAM</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cardGenerator</span><span class="o">.</span><span class="n">getCard</span><span class="p">()</span>
<span class="c"># Generate an OS object of the correct card_type</span>
<span class="k">if</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s">&quot;iso7816&quot;</span> <span class="ow">or</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s">&quot;ePass&quot;</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">os</span> <span class="o">=</span> <span class="n">Iso7816OS</span><span class="p">(</span><span class="n">MF</span><span class="p">,</span> <span class="n">SAM</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s">&quot;nPA&quot;</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">virtualsmartcard.cards.nPA</span> <span class="kn">import</span> <span class="n">NPAOS</span>
<span class="bp">self</span><span class="o">.</span><span class="n">os</span> <span class="o">=</span> <span class="n">NPAOS</span><span class="p">(</span><span class="n">MF</span><span class="p">,</span> <span class="n">SAM</span><span class="p">,</span> <span class="n">ef_cardsecurity</span><span class="o">=</span><span class="n">ef_cardsecurity</span><span class="p">,</span>
<span class="n">ef_cardaccess</span><span class="o">=</span><span class="n">ef_cardaccess</span><span class="p">,</span> <span class="n">ca_key</span><span class="o">=</span><span class="n">ca_key</span><span class="p">,</span>
<span class="n">cvca</span><span class="o">=</span><span class="n">cvca</span><span class="p">,</span> <span class="n">disable_checks</span><span class="o">=</span><span class="n">disable_checks</span><span class="p">,</span>
<span class="n">esign_key</span><span class="o">=</span><span class="n">esign_key</span><span class="p">,</span> <span class="n">esign_ca_cert</span><span class="o">=</span><span class="n">esign_ca_cert</span><span class="p">,</span>
<span class="n">esign_cert</span><span class="o">=</span><span class="n">esign_cert</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s">&quot;cryptoflex&quot;</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">virtualsmartcard.cards.cryptoflex</span> <span class="kn">import</span> <span class="n">CryptoflexOS</span>
<span class="hll"> <span class="bp">self</span><span class="o">.</span><span class="n">os</span> <span class="o">=</span> <span class="n">CryptoflexOS</span><span class="p">(</span><span class="n">MF</span><span class="p">,</span> <span class="n">SAM</span><span class="p">)</span>
</span><span class="hll"> <span class="k">elif</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s">&quot;relay&quot;</span><span class="p">:</span>
</span><span class="hll"> <span class="kn">from</span> <span class="nn">virtualsmartcard.cards.Relay</span> <span class="kn">import</span> <span class="n">RelayOS</span>
</span> <span class="bp">self</span><span class="o">.</span><span class="n">os</span> <span class="o">=</span> <span class="n">RelayOS</span><span class="p">(</span><span class="n">readernum</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s">&quot;handler_test&quot;</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">virtualsmartcard.cards.HandlerTest</span> <span class="kn">import</span> <span class="n">HandlerTestOS</span>
<span class="bp">self</span><span class="o">.</span><span class="n">os</span> <span class="o">=</span> <span class="n">HandlerTestOS</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s">&quot;Unknown cardtype </span><span class="si">%s</span><span class="s">. Will use standard card_type </span><span class="se">\</span>
<span class="s"> (ISO 7816)&quot;</span><span class="p">,</span> <span class="n">card_type</span><span class="p">)</span>
<span class="n">card_type</span> <span class="o">=</span> <span class="s">&quot;iso7816&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">os</span> <span class="o">=</span> <span class="n">Iso7816OS</span><span class="p">(</span><span class="n">MF</span><span class="p">,</span> <span class="n">SAM</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">card_type</span>
<span class="c"># Connect to the VPCD</span>
<span class="bp">self</span><span class="o">.</span><span class="n">host</span> <span class="o">=</span> <span class="n">host</span>
<span class="bp">self</span><span class="o">.</span><span class="n">port</span> <span class="o">=</span> <span class="n">port</span>
<span class="k">if</span> <span class="n">host</span><span class="p">:</span>
<span class="c"># use normal connection mode</span>
<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">sock</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">connectToPort</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">sock</span><span class="o">.</span><span class="n">settimeout</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">server_sock</span> <span class="o">=</span> <span class="bp">None</span>
<span class="k">except</span> <span class="n">socket</span><span class="o">.</span><span class="n">error</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Failed to open socket: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Is pcscd running at </span><span class="si">%s</span><span class="s">? Is vpcd loaded? Is a </span><span class="se">\</span>
<span class="s"> firewall blocking port </span><span class="si">%u</span><span class="s">?&quot;</span><span class="p">,</span> <span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="c"># use reversed connection mode</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">local_ip</span> <span class="o">=</span> <span class="p">[(</span><span class="n">s</span><span class="o">.</span><span class="n">connect</span><span class="p">((</span><span class="s">&#39;8.8.8.8&#39;</span><span class="p">,</span> <span class="mi">53</span><span class="p">)),</span> <span class="n">s</span><span class="o">.</span><span class="n">getsockname</span><span class="p">()[</span><span class="mi">0</span><span class="p">],</span> <span class="n">s</span><span class="o">.</span><span class="n">close</span><span class="p">())</span> <span class="k">for</span> <span class="n">s</span> <span class="ow">in</span> <span class="p">[</span><span class="n">socket</span><span class="o">.</span><span class="n">socket</span><span class="p">(</span><span class="n">socket</span><span class="o">.</span><span class="n">AF_INET</span><span class="p">,</span> <span class="n">socket</span><span class="o">.</span><span class="n">SOCK_DGRAM</span><span class="p">)]][</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>
<span class="n">custom_url</span> <span class="o">=</span> <span class="s">&#39;vicc://</span><span class="si">%s</span><span class="s">:</span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">local_ip</span><span class="p">,</span> <span class="n">port</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">&#39;VICC hostname: </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">local_ip</span><span class="p">);</span>
<span class="k">print</span><span class="p">(</span><span class="s">&#39;VICC port: </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">port</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="s">&#39;On your NFC phone with the Android Smart Card Emulator app scan this code:&#39;</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="kn">import</span> <span class="nn">qrcode</span>
<span class="n">qr</span> <span class="o">=</span> <span class="n">qrcode</span><span class="o">.</span><span class="n">QRCode</span><span class="p">()</span>
<span class="n">qr</span><span class="o">.</span><span class="n">add_data</span><span class="p">(</span><span class="n">custom_url</span><span class="p">)</span>
<span class="n">qr</span><span class="o">.</span><span class="n">print_ascii</span><span class="p">()</span>
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="s">&#39;https://api.qrserver.com/v1/create-qr-code/?data=</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">custom_url</span><span class="p">)</span>
<span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sock</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">server_sock</span><span class="p">,</span> <span class="n">host</span><span class="p">)</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">openPort</span><span class="p">(</span><span class="n">port</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">sock</span><span class="o">.</span><span class="n">settimeout</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span>
<span class="k">except</span> <span class="n">socket</span><span class="o">.</span><span class="n">error</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Failed to open socket: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Is pcscd running? Is vpcd loaded and in </span><span class="se">\</span>
<span class="s"> reversed connection mode? Is a firewall </span><span class="se">\</span>
<span class="s"> blocking port </span><span class="si">%u</span><span class="s">?&quot;</span><span class="p">,</span> <span class="n">port</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">()</span>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Connected to virtual PCD at </span><span class="si">%s</span><span class="s">:</span><span class="si">%u</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">)</span>
<span class="n">signal</span><span class="o">.</span><span class="n">signal</span><span class="p">(</span><span class="n">signal</span><span class="o">.</span><span class="n">SIGINT</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">signalHandler</span><span class="p">)</span>
<span class="n">atexit</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">stop</span><span class="p">)</span>
</pre></div>
</div>
<p>Responses from our cryptoflex card look the same as for the 7816 card. But when
a command was successfull (or not) there is a little difference in what is
returned. So we need to edit
<a class="reference internal" href="api/virtualsmartcard.cards.cryptoflex.html#virtualsmartcard.cards.cryptoflex.CryptoflexOS.formatResult" title="virtualsmartcard.cards.cryptoflex.CryptoflexOS.formatResult"><code class="xref py py-class docutils literal"><span class="pre">formatResult</span></code></a>, which is
called to encode the <abbr title="status bytes SW 1 and SW 2">SWs</abbr> and the resulting data.</p>
<div class="highlight-python"><div class="highlight"><pre> <span class="k">def</span> <span class="nf">formatResult</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ins</span><span class="p">,</span> <span class="n">le</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">sw</span><span class="p">):</span>
<span class="k">if</span> <span class="n">le</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
<span class="c"># cryptoflex does not inpterpret le==0 as maxle</span>
<span class="bp">self</span><span class="o">.</span><span class="n">lastCommandSW</span> <span class="o">=</span> <span class="n">sw</span>
<span class="bp">self</span><span class="o">.</span><span class="n">lastCommandOffcut</span> <span class="o">=</span> <span class="n">data</span>
<span class="n">r</span> <span class="o">=</span> <span class="n">R_APDU</span><span class="p">(</span><span class="n">inttostring</span><span class="p">(</span><span class="n">SW</span><span class="p">[</span><span class="s">&quot;ERR_WRONGLENGTH&quot;</span><span class="p">]</span> <span class="o">+</span>
<span class="nb">min</span><span class="p">(</span><span class="mh">0xff</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">))))</span><span class="o">.</span><span class="n">render</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">ins</span> <span class="o">==</span> <span class="mh">0xa4</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
<span class="c"># get response should be followed by select file</span>
<span class="bp">self</span><span class="o">.</span><span class="n">lastCommandSW</span> <span class="o">=</span> <span class="n">sw</span>
<span class="bp">self</span><span class="o">.</span><span class="n">lastCommandOffcut</span> <span class="o">=</span> <span class="n">data</span>
<span class="n">r</span> <span class="o">=</span> <span class="n">R_APDU</span><span class="p">(</span><span class="n">inttostring</span><span class="p">(</span><span class="n">SW</span><span class="p">[</span><span class="s">&quot;NORMAL_REST&quot;</span><span class="p">]</span> <span class="o">+</span>
<span class="nb">min</span><span class="p">(</span><span class="mh">0xff</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">))))</span><span class="o">.</span><span class="n">render</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">r</span> <span class="o">=</span> <span class="n">Iso7816OS</span><span class="o">.</span><span class="n">formatResult</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">Iso7816OS</span><span class="o">.</span><span class="n">seekable</span><span class="p">(</span><span class="n">ins</span><span class="p">),</span> <span class="n">le</span><span class="p">,</span>
<span class="n">data</span><span class="p">,</span> <span class="n">sw</span><span class="p">,</span> <span class="bp">False</span><span class="p">)</span>
<span class="k">return</span> <span class="n">r</span>
</pre></div>
</div>
<p>Note that this also requires some insight knowledge about how
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.Iso7816OS" title="virtualsmartcard.VirtualSmartcard.Iso7816OS"><code class="xref py py-class docutils literal"><span class="pre">Iso7816OS</span></code></a> works.</p>
<p>The previously created <abbr title="Secure Access Module">SAM</abbr> handles keys, encryption, secure messaging and so
on (we will not go into more details here). The file system creates, selects
and reads contents of files or directories. File handling for our cryptoflex
card is similar to ISO 7816, but the meaning of P1, P2 and the <abbr title="Application Protocol Data Unit">APDU</abbr> data is
completely different when creating a file on the smart card. So we derive
<a class="reference internal" href="api/virtualsmartcard.cards.cryptoflex.html#virtualsmartcard.cards.cryptoflex.CryptoflexMF" title="virtualsmartcard.cards.cryptoflex.CryptoflexMF"><code class="xref py py-class docutils literal"><span class="pre">CryptoflexMF</span></code></a> from
<a class="reference internal" href="api/virtualsmartcard.SmartcardFilesystem.html#virtualsmartcard.SmartcardFilesystem.MF" title="virtualsmartcard.SmartcardFilesystem.MF"><code class="xref py py-class docutils literal"><span class="pre">MF</span></code></a> and modify
<a class="reference internal" href="api/virtualsmartcard.cards.cryptoflex.html#virtualsmartcard.cards.cryptoflex.CryptoflexMF.create" title="virtualsmartcard.cards.cryptoflex.CryptoflexMF.create"><code class="xref py py-class docutils literal"><span class="pre">create</span></code></a> to our needs.</p>
<p>As you can see it is quite simple to extend the virtual smart card to your
requirements. Simply overwrite those functions, that differ from ISO 78166. But
as said before, the virtual smart card is quite complex and you might have to
read some documentation or even source code to find out where it&#8217;s best to do
your modifications...</p>
</div>
<div class="section" id="implementing-an-other-type-of-card">
<h3>Implementing an Other Type of Card<a class="headerlink" href="#implementing-an-other-type-of-card" title="Permalink to this headline"></a></h3>
<p>If you have a card entirely different to ISO 7816, you surely want to avoid all
magic that is done while parsing a buffer (an <abbr title="Application Protocol Data Unit">APDU</abbr>). As example we will
connect to an other smart card using PC/SC and forward it to <abbr title="virtual smart card reader">vpcd</abbr>.</p>
<p>As before with the cryptoflex card, we let
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.VirtualICC" title="virtualsmartcard.VirtualSmartcard.VirtualICC"><code class="xref py py-class docutils literal"><span class="pre">VirtualICC</span></code></a> recognize the new type
<code class="docutils literal"><span class="pre">&quot;relay&quot;</span></code>. <a class="reference internal" href="api/virtualsmartcard.cards.Relay.html#virtualsmartcard.cards.Relay.RelayOS" title="virtualsmartcard.cards.Relay.RelayOS"><code class="xref py py-class docutils literal"><span class="pre">RelayOS</span></code></a> overwrites all
main functions from the template
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="virtualsmartcard.VirtualSmartcard.SmartcardOS"><code class="xref py py-class docutils literal"><span class="pre">SmartcardOS</span></code></a>. Its functions correspond
to the <a class="reference internal" href="#vpcd-commands"><span>commands sent by vpcd</span></a>. If you know how to use
<a class="reference external" href="http://pyscard.sourceforge.net/">pyscard</a> then the rest is pretty straight
forward, but see yourself...</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">RelayOS</span><span class="p">(</span><span class="n">SmartcardOS</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> This class implements relaying of a (physical) smartcard. The RelayOS</span>
<span class="sd"> forwards the command APDUs received from the vpcd to the real smartcard via</span>
<span class="sd"> an actual smart card reader and sends the responses back to the vpcd.</span>
<span class="sd"> This class can be used to implement relay or MitM attacks.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">readernum</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Initialize the connection to the (physical) smart card via a given</span>
<span class="sd"> reader</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c"># See which readers are available</span>
<span class="n">readers</span> <span class="o">=</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">System</span><span class="o">.</span><span class="n">listReaders</span><span class="p">()</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">readers</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="n">readernum</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Invalid number of reader &#39;</span><span class="si">%u</span><span class="s">&#39; (only </span><span class="si">%u</span><span class="s"> available)&quot;</span><span class="p">,</span>
<span class="n">readernum</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">readers</span><span class="p">))</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">()</span>
<span class="c"># Connect to the reader and its card</span>
<span class="c"># XXX this is a workaround, see on sourceforge bug #3083254</span>
<span class="c"># should better use</span>
<span class="c"># self.reader = smartcard.System.readers()[readernum]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">reader</span> <span class="o">=</span> <span class="n">readers</span><span class="p">[</span><span class="n">readernum</span><span class="p">]</span>
<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">session</span> <span class="o">=</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Session</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="p">)</span>
<span class="k">except</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Exceptions</span><span class="o">.</span><span class="n">CardConnectionException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Error connecting to card: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">()</span>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Connected to card in &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="p">)</span>
<span class="n">atexit</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">cleanup</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">cleanup</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Close the connection to the physical card</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">except</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Exceptions</span><span class="o">.</span><span class="n">CardConnectionException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s">&quot;Error disconnecting from card: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">getATR</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c"># when powerDown has been called, fetching the ATR will throw an error.</span>
<span class="c"># In this case we must try to reconnect (and then get the ATR).</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">atr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">getATR</span><span class="p">()</span>
<span class="k">except</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Exceptions</span><span class="o">.</span><span class="n">CardConnectionException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="c"># Try to reconnect to the card</span>
<span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">session</span> <span class="o">=</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Session</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="p">)</span>
<span class="n">atr</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">getATR</span><span class="p">()</span>
<span class="k">except</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Exceptions</span><span class="o">.</span><span class="n">CardConnectionException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Error getting ATR: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">()</span>
<span class="k">return</span> <span class="s">&quot;&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="nb">chr</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">atr</span><span class="p">])</span>
<span class="k">def</span> <span class="nf">powerUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c"># When powerUp is called multiple times the session is valid (and the</span>
<span class="c"># card is implicitly powered) we can check for an ATR. But when</span>
<span class="c"># powerDown has been called, the session gets lost. In this case we</span>
<span class="c"># must try to reconnect (and power the card).</span>
<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">getATR</span><span class="p">()</span>
<span class="k">except</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Exceptions</span><span class="o">.</span><span class="n">CardConnectionException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">session</span> <span class="o">=</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Session</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">reader</span><span class="p">)</span>
<span class="k">except</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Exceptions</span><span class="o">.</span><span class="n">CardConnectionException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Error connecting to card: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">message</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">powerDown</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c"># There is no power down in the session context so we simply</span>
<span class="c"># disconnect, which should implicitly power down the card.</span>
<span class="k">try</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="k">except</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Exceptions</span><span class="o">.</span><span class="n">CardConnectionException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Error disconnecting from card: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">powerDown</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">powerUp</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">execute</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">msg</span><span class="p">):</span>
<span class="c"># sendCommandAPDU() expects a list of APDU bytes</span>
<span class="n">apdu</span> <span class="o">=</span> <span class="nb">map</span><span class="p">(</span><span class="nb">ord</span><span class="p">,</span> <span class="n">msg</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">rapdu</span><span class="p">,</span> <span class="n">sw1</span><span class="p">,</span> <span class="n">sw2</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">sendCommandAPDU</span><span class="p">(</span><span class="n">apdu</span><span class="p">)</span>
<span class="k">except</span> <span class="n">smartcard</span><span class="o">.</span><span class="n">Exceptions</span><span class="o">.</span><span class="n">CardConnectionException</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&quot;Error transmitting APDU: </span><span class="si">%s</span><span class="s">&quot;</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">e</span><span class="p">))</span>
<span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">()</span>
<span class="c"># XXX this is a workaround, see on sourceforge bug #3083586</span>
<span class="c"># should better use</span>
<span class="c"># rapdu = rapdu + [sw1, sw2]</span>
<span class="k">if</span> <span class="n">rapdu</span><span class="p">[</span><span class="o">-</span><span class="mi">2</span><span class="p">:]</span> <span class="o">==</span> <span class="p">[</span><span class="n">sw1</span><span class="p">,</span> <span class="n">sw2</span><span class="p">]:</span>
<span class="k">pass</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">rapdu</span> <span class="o">=</span> <span class="n">rapdu</span> <span class="o">+</span> <span class="p">[</span><span class="n">sw1</span><span class="p">,</span> <span class="n">sw2</span><span class="p">]</span>
<span class="c"># return the response APDU as string</span>
<span class="k">return</span> <span class="s">&quot;&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="nb">chr</span><span class="p">(</span><span class="n">b</span><span class="p">)</span> <span class="k">for</span> <span class="n">b</span> <span class="ow">in</span> <span class="n">rapdu</span><span class="p">])</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,239 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CardGenerator Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="ConstantDefinitions Module" href="virtualsmartcard.ConstantDefinitions.html" />
<link rel="prev" title="utils_test Module" href="virtualsmartcard.tests.utils_test.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">CardGenerator Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.tests.utils_test.html" title="Previous Chapter: utils_test Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; utils_test Modul...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.ConstantDefinitions.html" title="Next Chapter: ConstantDefinitions Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">ConstantDefiniti... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="cardgenerator-module">
<h1>CardGenerator Module<a class="headerlink" href="#cardgenerator-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-151a141442b8b2ad4b9ca6f670abcf103a9252a6.png" alt="Inheritance diagram of virtualsmartcard.CardGenerator" usemap="#inheritancecb03a25959" class="inheritance"/>
<map id="inheritancecb03a25959" name="inheritancecb03a25959">
<area shape="rect" id="node1" href="#virtualsmartcard.CardGenerator.CardGenerator" title="This class is used to generate the SAM and filesystem for the" alt="" coords="5,5,331,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.CardGenerator"></span><dl class="class">
<dt id="virtualsmartcard.CardGenerator.CardGenerator">
<em class="property">class </em><code class="descclassname">virtualsmartcard.CardGenerator.</code><code class="descname">CardGenerator</code><span class="sig-paren">(</span><em>card_type=None</em>, <em>sam=None</em>, <em>mf=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>This class is used to generate the SAM and filesystem for the
different supported card types. It is also able used for persistent storage
(in encrypted form) of the card on disks.</p>
<dl class="method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_cryptoflex">
<code class="descname">_CardGenerator__generate_cryptoflex</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_cryptoflex" title="Permalink to this definition"></a></dt>
<dd><p>Generate the Filesystem and SAM of a cryptoflex card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_ePass">
<code class="descname">_CardGenerator__generate_ePass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_ePass" title="Permalink to this definition"></a></dt>
<dd><p>Generate the MF and SAM of an ICAO passport. This method is
responsible for generating the filesystem and filling it with content.
Therefore it must interact with the user by prompting for the MRZ and
optionally for the path to a photo.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_iso_card">
<code class="descname">_CardGenerator__generate_iso_card</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_iso_card" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_nPA">
<code class="descname">_CardGenerator__generate_nPA</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_nPA" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.generateCard">
<code class="descname">generateCard</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator.generateCard" title="Permalink to this definition"></a></dt>
<dd><p>Generate a new card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.getCard">
<code class="descname">getCard</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator.getCard" title="Permalink to this definition"></a></dt>
<dd><p>Get the MF and SAM from the current card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.readDatagroups">
<code class="descname">readDatagroups</code><span class="sig-paren">(</span><em>datasetfile</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator.readDatagroups" title="Permalink to this definition"></a></dt>
<dd><p>Read Datagroups from file</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.setCard">
<code class="descname">setCard</code><span class="sig-paren">(</span><em>mf=None</em>, <em>sam=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator.setCard" title="Permalink to this definition"></a></dt>
<dd><p>Set the MF and SAM of the current card</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,175 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ConstantDefinitions Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="CryptoUtils Module" href="virtualsmartcard.CryptoUtils.html" />
<link rel="prev" title="CardGenerator Module" href="virtualsmartcard.CardGenerator.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">ConstantDefinitions Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.CardGenerator.html" title="Previous Chapter: CardGenerator Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; CardGenerator Mo...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.CryptoUtils.html" title="Next Chapter: CryptoUtils Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">CryptoUtils Modu... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="constantdefinitions-module">
<h1>ConstantDefinitions Module<a class="headerlink" href="#constantdefinitions-module" title="Permalink to this headline"></a></h1>
<span class="target" id="module-virtualsmartcard.ConstantDefinitions"></span></div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,270 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CryptoUtils Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="SEutils Module" href="virtualsmartcard.SEutils.html" />
<link rel="prev" title="ConstantDefinitions Module" href="virtualsmartcard.ConstantDefinitions.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">CryptoUtils Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.ConstantDefinitions.html" title="Previous Chapter: ConstantDefinitions Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; ConstantDefiniti...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.SEutils.html" title="Next Chapter: SEutils Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">SEutils Module &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="cryptoutils-module">
<h1>CryptoUtils Module<a class="headerlink" href="#cryptoutils-module" title="Permalink to this headline"></a></h1>
<span class="target" id="module-virtualsmartcard.CryptoUtils"></span><dl class="function">
<dt id="virtualsmartcard.CryptoUtils._makesalt">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">_makesalt</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils._makesalt" title="Permalink to this definition"></a></dt>
<dd><p>Return a 48-bit pseudorandom salt for crypt().</p>
<p>This function is not suitable for generating cryptographic secrets.</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.append_padding">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">append_padding</code><span class="sig-paren">(</span><em>blocklen</em>, <em>data</em>, <em>padding_class=1</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.append_padding" title="Permalink to this definition"></a></dt>
<dd><p>Append padding to the data.
Length of padding depends on length of data and the block size of the
specified encryption algorithm.
Different types of padding may be selected via the padding_class parameter</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.calculate_MAC">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">calculate_MAC</code><span class="sig-paren">(</span><em>session_key</em>, <em>message</em>, <em>iv='\x00\x00\x00\x00\x00\x00\x00\x00'</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.calculate_MAC" title="Permalink to this definition"></a></dt>
<dd><p>Cyberflex MAC is the last Block of the input encrypted with DES3-CBC</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.cipher">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">cipher</code><span class="sig-paren">(</span><em>do_encrypt</em>, <em>cipherspec</em>, <em>key</em>, <em>data</em>, <em>iv=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.cipher" title="Permalink to this definition"></a></dt>
<dd><p>Do a cryptographic operation.
operation = do_encrypt ? encrypt : decrypt,
cipherspec must be of the form &#8220;cipher-mode&#8221;, or &#8220;cipher&#8221;</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.crypto_checksum">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">crypto_checksum</code><span class="sig-paren">(</span><em>algo</em>, <em>key</em>, <em>data</em>, <em>iv=None</em>, <em>ssc=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.crypto_checksum" title="Permalink to this definition"></a></dt>
<dd><p>Compute various types of cryptographic checksums.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>algo</strong> &#8211; A string specifying the algorithm to use. Currently supported
algorithms are &#8220;MAX&#8221; &#8220;HMAC&#8221; and &#8220;CC&#8221; (Meaning a cryptographic
checksum as used by the ICAO passports)</li>
<li><strong>key</strong> &#8211; They key used to computed the cryptographic checksum</li>
<li><strong>data</strong> &#8211; The data for which to calculate the checksum</li>
<li><strong>iv</strong> &#8211; Optional. An initialization vector. Only used by the &#8220;MAC&#8221; algorithm</li>
<li><strong>ssc</strong> &#8211; Optional. A send sequence counter to be prepended to the data.
Only used by the &#8220;CC&#8221; algorithm</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.decrypt">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">decrypt</code><span class="sig-paren">(</span><em>cipherspec</em>, <em>key</em>, <em>data</em>, <em>iv=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.decrypt" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.encrypt">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">encrypt</code><span class="sig-paren">(</span><em>cipherspec</em>, <em>key</em>, <em>data</em>, <em>iv=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.encrypt" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.get_cipher">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">get_cipher</code><span class="sig-paren">(</span><em>cipherspec</em>, <em>key</em>, <em>iv=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.get_cipher" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.get_cipher_blocklen">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">get_cipher_blocklen</code><span class="sig-paren">(</span><em>cipherspec</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.get_cipher_blocklen" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.get_cipher_keylen">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">get_cipher_keylen</code><span class="sig-paren">(</span><em>cipherspec</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.get_cipher_keylen" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.hash">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">hash</code><span class="sig-paren">(</span><em>hashmethod</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.hash" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.operation_on_string">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">operation_on_string</code><span class="sig-paren">(</span><em>string1</em>, <em>string2</em>, <em>op</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.operation_on_string" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.CryptoUtils.strip_padding">
<code class="descclassname">virtualsmartcard.CryptoUtils.</code><code class="descname">strip_padding</code><span class="sig-paren">(</span><em>blocklen</em>, <em>data</em>, <em>padding_class=1</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CryptoUtils.strip_padding" title="Permalink to this definition"></a></dt>
<dd><p>Strip the padding of decrypted data. Returns data without padding</p>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,648 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SEutils Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="SWutils Module" href="virtualsmartcard.SWutils.html" />
<link rel="prev" title="CryptoUtils Module" href="virtualsmartcard.CryptoUtils.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">SEutils Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.CryptoUtils.html" title="Previous Chapter: CryptoUtils Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; CryptoUtils Modu...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.SWutils.html" title="Next Chapter: SWutils Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">SWutils Module &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="seutils-module">
<h1>SEutils Module<a class="headerlink" href="#seutils-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-9f3c7bc88811fee87e07a30133f7586cb9c7a2ee.png" alt="Inheritance diagram of virtualsmartcard.SEutils" usemap="#inheritance7064aeb8f6" class="inheritance"/>
<map id="inheritance7064aeb8f6" name="inheritance7064aeb8f6">
<area shape="rect" id="node1" href="#virtualsmartcard.SEutils.ControlReferenceTemplate" title="Control Reference Templates are used to configure the Security" alt="" coords="5,55,353,80"/>
<area shape="rect" id="node2" href="#virtualsmartcard.SEutils.Security_Environment" title="virtualsmartcard.SEutils.Security_Environment" alt="" coords="20,5,339,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.SEutils"></span><dl class="class">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate">
<em class="property">class </em><code class="descclassname">virtualsmartcard.SEutils.</code><code class="descname">ControlReferenceTemplate</code><span class="sig-paren">(</span><em>tag</em>, <em>config=''</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate" title="Permalink to this definition"></a></dt>
<dd><p>Control Reference Templates are used to configure the Security
Environments. They specify which algorithms to use in which mode of
operation and with which keys. There are six different types of Control
Reference Template:
HT, AT, KT, CCT, DST, CT-sym, CT-asym.</p>
<dl class="method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__replace_tag">
<code class="descname">_ControlReferenceTemplate__replace_tag</code><span class="sig-paren">(</span><em>tag</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__replace_tag" title="Permalink to this definition"></a></dt>
<dd><p>Adjust the config string using a given tag, value combination. If the
config string already contains a tag, value pair for the given tag,
replace it. Otherwise append tag, length and value to the config
string.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_algo">
<code class="descname">_ControlReferenceTemplate__set_algo</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_algo" title="Permalink to this definition"></a></dt>
<dd><p>Set the algorithm to be used by this CRT. The algorithms are specified
in a global dictionary. New cards may add or modify this table in order
to support new or different algorithms.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> &#8211; reference to an algorithm</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_iv">
<code class="descname">_ControlReferenceTemplate__set_iv</code><span class="sig-paren">(</span><em>tag</em>, <em>length</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_iv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_key">
<code class="descname">_ControlReferenceTemplate__set_key</code><span class="sig-paren">(</span><em>tag</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate.parse_SE_config">
<code class="descname">parse_SE_config</code><span class="sig-paren">(</span><em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate.parse_SE_config" title="Permalink to this definition"></a></dt>
<dd><p>Parse a control reference template as given e.g. in an MSE APDU.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>config</strong> &#8211; a TLV string containing the configuration for the CRT.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate.to_string">
<code class="descname">to_string</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate.to_string" title="Permalink to this definition"></a></dt>
<dd><p>Return the content of the CRT, encoded as TLV data in a string</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="virtualsmartcard.SEutils.Security_Environment">
<em class="property">class </em><code class="descclassname">virtualsmartcard.SEutils.</code><code class="descname">Security_Environment</code><span class="sig-paren">(</span><em>MF</em>, <em>SAM</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment._set_SE">
<code class="descname">_set_SE</code><span class="sig-paren">(</span><em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment._set_SE" title="Permalink to this definition"></a></dt>
<dd><p>Manipulate the current Security Environment. P2 is the tag of a
control reference template, data contains control reference objects</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.compute_cryptographic_checksum">
<code class="descname">compute_cryptographic_checksum</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.compute_cryptographic_checksum" title="Permalink to this definition"></a></dt>
<dd><p>Compute a cryptographic checksum (e.g. MAC) for the given data.
Algorithm and key are specified in the current SE</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.compute_digital_signature">
<code class="descname">compute_digital_signature</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.compute_digital_signature" title="Permalink to this definition"></a></dt>
<dd><p>Compute a digital signature for the given data.
Algorithm and key are specified in the current SE</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>p1</strong> &#8211; Must be 0x9E = Secure Messaging class for digital signatures</li>
<li><strong>p2</strong> &#8211; Must be one of 0x9A, 0xAC, 0xBC. Indicates what kind of data
is included in the data field.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.decipher">
<code class="descname">decipher</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.decipher" title="Permalink to this definition"></a></dt>
<dd><p>Decipher data using key, algorithm, IV and Padding specified
by the current Security environment.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">raw data (no TLV coding). Padding is not removed!!!</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.encipher">
<code class="descname">encipher</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.encipher" title="Permalink to this definition"></a></dt>
<dd><p>Encipher data using key, algorithm, IV and Padding specified
by the current Security environment.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">raw data (no TLV coding).</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.generate_public_key_pair">
<code class="descname">generate_public_key_pair</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.generate_public_key_pair" title="Permalink to this definition"></a></dt>
<dd><p>The GENERATE PUBLIC-KEY PAIR command either initiates the generation
and storing of a key pair, i.e., a public key and a private key, in the
card, or accesses a key pair previously generated in the card.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>p1</strong> &#8211; should be 0x00 (generate new key)</li>
<li><strong>p2</strong> &#8211; &#8216;00&#8217; (no information provided) or reference of the key to
be generated</li>
<li><strong>data</strong> &#8211; One or more CRTs associated to the key generation if
P1-P2 different from &#8216;0000&#8217;</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.hash">
<code class="descname">hash</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.hash" title="Permalink to this definition"></a></dt>
<dd><p>Hash the given data using the algorithm specified by the current
Security environment.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">raw data (no TLV coding).</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.manage_security_environment">
<code class="descname">manage_security_environment</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.manage_security_environment" title="Permalink to this definition"></a></dt>
<dd><p>This method is used to store, restore or erase Security Environments
or to manipulate the various parameters of the current SE.
P1 specifies the operation to perform, p2 is either the SEID for the
referred SE or the tag of a control reference template</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>p1</strong> &#8211; <p>Bitmask according to this table</p>
<table border="1" class="docutils">
<colgroup>
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="71%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">b8</th>
<th class="head">b7</th>
<th class="head">b6</th>
<th class="head">b5</th>
<th class="head">b4</th>
<th class="head">b3</th>
<th class="head">b2</th>
<th class="head">b1</th>
<th class="head">Meaning</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>1</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>Secure messaging in command data field</td>
</tr>
<tr class="row-odd"><td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>1</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>Secure messaging in response data field</td>
</tr>
<tr class="row-even"><td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>1</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>Computation, decipherment, internal
authentication and key agreement</td>
</tr>
<tr class="row-odd"><td>1</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>Verification, encipherment, external
authentication and key agreement</td>
</tr>
<tr class="row-even"><td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>SET</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>STORE</td>
</tr>
<tr class="row-even"><td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>RESTORE</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>ERASE</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.parse_SM_CAPDU">
<code class="descname">parse_SM_CAPDU</code><span class="sig-paren">(</span><em>CAPDU</em>, <em>authenticate_header</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.parse_SM_CAPDU" title="Permalink to this definition"></a></dt>
<dd><p>This methods parses a data field including Secure Messaging objects.
SM_header indicates whether or not the header of the message shall be
authenticated. It returns an unprotected command APDU</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>CAPDU</strong> &#8211; The protected CAPDU to be parsed</li>
<li><strong>authenticate_header</strong> &#8211; Whether or not the header should be
included in authentication mechanisms</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Unprotected command APDU</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.perform_security_operation">
<code class="descname">perform_security_operation</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.perform_security_operation" title="Permalink to this definition"></a></dt>
<dd><p>In the end this command is nothing but a big switch for all the other
commands in ISO 7816-8. It will invoke the appropriate command and
return its result</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.protect_response">
<code class="descname">protect_response</code><span class="sig-paren">(</span><em>sw</em>, <em>result</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.protect_response" title="Permalink to this definition"></a></dt>
<dd><p>This method protects a response APDU using secure messaging mechanisms</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the protected data and the SW bytes</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.verify_certificate">
<code class="descname">verify_certificate</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.verify_certificate" title="Permalink to this definition"></a></dt>
<dd><p>Verify a certificate send by the terminal using the internal trust
anchors.
This method is currently not implemented.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.verify_cryptographic_checksum">
<code class="descname">verify_cryptographic_checksum</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.verify_cryptographic_checksum" title="Permalink to this definition"></a></dt>
<dd><p>Verify the cryptographic checksum contained in the data field.
Data field must contain a cryptographic checksum (tag 0x8E) and a plain
value (tag 0x80)</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.Security_Environment.verify_digital_signature">
<code class="descname">verify_digital_signature</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.verify_digital_signature" title="Permalink to this definition"></a></dt>
<dd><p>Verify the digital signature contained in the data field. Data must
contain a data to sign (tag 0x9A, 0xAC or 0xBC) and a digital signature
(0x9E)</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,197 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SWutils Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="SmartcardFilesystem Module" href="virtualsmartcard.SmartcardFilesystem.html" />
<link rel="prev" title="SEutils Module" href="virtualsmartcard.SEutils.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">SWutils Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.SEutils.html" title="Previous Chapter: SEutils Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; SEutils Module</span>
</a>
</li>
<li>
<a href="virtualsmartcard.SmartcardFilesystem.html" title="Next Chapter: SmartcardFilesystem Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">SmartcardFilesys... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="swutils-module">
<h1>SWutils Module<a class="headerlink" href="#swutils-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-2df37359f5f3e9e8ae5b3298a982b18985d97b0f.png" alt="Inheritance diagram of virtualsmartcard.SWutils" usemap="#inheritancef021466e51" class="inheritance"/>
<map id="inheritancef021466e51" name="inheritancef021466e51">
<area shape="rect" id="node1" href="#virtualsmartcard.SWutils.SwError" title="virtualsmartcard.SWutils.SwError" alt="" coords="5,5,239,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.SWutils"></span><dl class="exception">
<dt id="virtualsmartcard.SWutils.SwError">
<em class="property">exception </em><code class="descclassname">virtualsmartcard.SWutils.</code><code class="descname">SwError</code><span class="sig-paren">(</span><em>sw</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SWutils.SwError" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></code></p>
<dl class="attribute">
<dt id="virtualsmartcard.SWutils.SwError.args">
<code class="descname">args</code><a class="headerlink" href="#virtualsmartcard.SWutils.SwError.args" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.SWutils.SwError.message">
<code class="descname">message</code><a class="headerlink" href="#virtualsmartcard.SWutils.SwError.message" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,475 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SmartcardSAM Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="TLVutils Module" href="virtualsmartcard.TLVutils.html" />
<link rel="prev" title="SmartcardFilesystem Module" href="virtualsmartcard.SmartcardFilesystem.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">SmartcardSAM Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.SmartcardFilesystem.html" title="Previous Chapter: SmartcardFilesystem Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; SmartcardFilesys...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.TLVutils.html" title="Next Chapter: TLVutils Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">TLVutils Module &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="smartcardsam-module">
<h1>SmartcardSAM Module<a class="headerlink" href="#smartcardsam-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-2bbcd7895a62e5ec48d90ac42e0891ae2f9feca4.png" alt="Inheritance diagram of virtualsmartcard.SmartcardSAM" usemap="#inheritance8b3e5dd7ee" class="inheritance"/>
<map id="inheritance8b3e5dd7ee" name="inheritance8b3e5dd7ee">
<area shape="rect" id="node1" href="#virtualsmartcard.SmartcardSAM.SAM" title="This class is used to store the data needed by the SAM." alt="" coords="5,5,263,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.SmartcardSAM"></span><dl class="class">
<dt id="virtualsmartcard.SmartcardSAM.SAM">
<em class="property">class </em><code class="descclassname">virtualsmartcard.SmartcardSAM.</code><code class="descname">SAM</code><span class="sig-paren">(</span><em>PIN</em>, <em>cardNumber</em>, <em>mf=None</em>, <em>cardSecret=None</em>, <em>default_se=&lt;class 'virtualsmartcard.SEutils.Security_Environment'&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>This class is used to store the data needed by the SAM.
It includes the PIN, the master key of the SAM and a hashmap containing all
the keys used by the file encryption system. The keys in the hashmap are
indexed via the path to the corresponding container.</p>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.FSdecrypt">
<code class="descname">FSdecrypt</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.FSdecrypt" title="Permalink to this definition"></a></dt>
<dd><p>Decrypt the given data, using the parameters stored in the SAM.
Right now we do not encrypt the data. In memory encryption might or
might not be added in a future version.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.FSencrypt">
<code class="descname">FSencrypt</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.FSencrypt" title="Permalink to this definition"></a></dt>
<dd><p>Encrypt the given data, using the parameters stored in the SAM.
Right now we do not encrypt the data. In memory encryption might or
might not be added in a future version.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM._get_referenced_key">
<code class="descname">_get_referenced_key</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM._get_referenced_key" title="Permalink to this definition"></a></dt>
<dd><p>This method returns the key specified by the p2 parameter. The key may
be stored on the cards filesystem.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>p1</strong> &#8211; Specifies the algorithm to use.</li>
<li><strong>p2</strong> &#8211; <p>Specifies a reference to the key to be used for encryption.</p>
<table border="1" class="docutils">
<colgroup>
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="73%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">b8</th>
<th class="head">b7</th>
<th class="head">b6</th>
<th class="head">b5</th>
<th class="head">b4</th>
<th class="head">b3</th>
<th class="head">b2</th>
<th class="head">b1</th>
<th class="head">Meaning</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>No information is given</td>
</tr>
<tr class="row-odd"><td>0</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td>Global reference data(e.g. MF specific key)</td>
</tr>
<tr class="row-even"><td>1</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td>Specific reference data(e.g. DF specific
key)</td>
</tr>
<tr class="row-odd"><td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>Number of the secret</td>
</tr>
</tbody>
</table>
<p>Any other value RFU</p>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.change_reference_data">
<code class="descname">change_reference_data</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.change_reference_data" title="Permalink to this definition"></a></dt>
<dd><p>Change the specified referenced data (e.g. CHV) of the card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.erase_SE">
<code class="descname">erase_SE</code><span class="sig-paren">(</span><em>SEID</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.erase_SE" title="Permalink to this definition"></a></dt>
<dd><p>Erases a Security Environment stored under SEID from the SAM</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.external_authenticate">
<code class="descname">external_authenticate</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.external_authenticate" title="Permalink to this definition"></a></dt>
<dd><p>Authenticate the terminal to the card. Check whether Terminal correctly
encrypted the given challenge or not</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.generate_public_key_pair">
<code class="descname">generate_public_key_pair</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.generate_public_key_pair" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.get_card_number">
<code class="descname">get_card_number</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.get_card_number" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.get_challenge">
<code class="descname">get_challenge</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.get_challenge" title="Permalink to this definition"></a></dt>
<dd><p>Generate a random number of maximum 8 Byte and return it.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.internal_authenticate">
<code class="descname">internal_authenticate</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.internal_authenticate" title="Permalink to this definition"></a></dt>
<dd><p>Authenticate card to terminal. Encrypt the challenge of the terminal
to prove key posession</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.manage_security_environment">
<code class="descname">manage_security_environment</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.manage_security_environment" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.mutual_authenticate">
<code class="descname">mutual_authenticate</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>mutual_challenge</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.mutual_authenticate" title="Permalink to this definition"></a></dt>
<dd><p>Takes an encrypted challenge in the form
&#8216;Terminal Challenge | Card Challenge | Card number&#8217;
and checks it for validity. If the challenge is successful
the card encrypts &#8216;Card Challenge | Terminal challenge&#8217; and
returns this value</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.parse_SM_CAPDU">
<code class="descname">parse_SM_CAPDU</code><span class="sig-paren">(</span><em>CAPDU</em>, <em>header_authentication</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.parse_SM_CAPDU" title="Permalink to this definition"></a></dt>
<dd><p>Parse a command APDU protected by Secure Messaging and return the
unprotected command APDU</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.perform_security_operation">
<code class="descname">perform_security_operation</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.perform_security_operation" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.protect_result">
<code class="descname">protect_result</code><span class="sig-paren">(</span><em>sw</em>, <em>unprotected_result</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.protect_result" title="Permalink to this definition"></a></dt>
<dd><p>Protect a plain response APDU by Secure Messaging</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.restore_SE">
<code class="descname">restore_SE</code><span class="sig-paren">(</span><em>SEID</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.restore_SE" title="Permalink to this definition"></a></dt>
<dd><p>Restores a Security Environment from the SAM and replaces the current
SE with it.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.set_MF">
<code class="descname">set_MF</code><span class="sig-paren">(</span><em>mf</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.set_MF" title="Permalink to this definition"></a></dt>
<dd><p>Setter function for the internal reference to the Filesystem. The SAM
needs a reference to the filesystem in order to store/retrieve keys.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.set_asym_algorithm">
<code class="descname">set_asym_algorithm</code><span class="sig-paren">(</span><em>cipher</em>, <em>keytype</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.set_asym_algorithm" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>cipher</strong> &#8211; Public/private key object from used for encryption</li>
<li><strong>keytype</strong> &#8211; Type of the public key (e.g. RSA, DSA)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.store_SE">
<code class="descname">store_SE</code><span class="sig-paren">(</span><em>SEID</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.store_SE" title="Permalink to this definition"></a></dt>
<dd><p>Stores the current Security environment in the secure access module.
The SEID is used as a reference to identify the SE.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.verify">
<code class="descname">verify</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>PIN</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.verify" title="Permalink to this definition"></a></dt>
<dd><p>Authenticate the card user. Check if he entered a valid PIN.
If the PIN is invalid decrement retry counter. If retry counter
equals zero, block the card until reset with correct PUK</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.SmartcardSAM.get_referenced_cipher">
<code class="descclassname">virtualsmartcard.SmartcardSAM.</code><code class="descname">get_referenced_cipher</code><span class="sig-paren">(</span><em>p1</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.get_referenced_cipher" title="Permalink to this definition"></a></dt>
<dd><p>P1 defines the algorithm and mode to use. We dispatch it and return a
string that is understood by CryptoUtils.py functions</p>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,272 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TLVutils Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="VirtualSmartcard Module" href="virtualsmartcard.VirtualSmartcard.html" />
<link rel="prev" title="SmartcardSAM Module" href="virtualsmartcard.SmartcardSAM.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">TLVutils Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.SmartcardSAM.html" title="Previous Chapter: SmartcardSAM Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; SmartcardSAM Mod...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.VirtualSmartcard.html" title="Next Chapter: VirtualSmartcard Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">VirtualSmartcard... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="tlvutils-module">
<h1>TLVutils Module<a class="headerlink" href="#tlvutils-module" title="Permalink to this headline"></a></h1>
<span class="target" id="module-virtualsmartcard.TLVutils"></span><dl class="function">
<dt id="virtualsmartcard.TLVutils.bertlv_pack">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">bertlv_pack</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.bertlv_pack" title="Permalink to this definition"></a></dt>
<dd><p>Packs a bertlv list of 3-tuples (tag, length, newvalue) into a string</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.bertlv_unpack">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">bertlv_unpack</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.bertlv_unpack" title="Permalink to this definition"></a></dt>
<dd><p>Unpacks a bertlv coded string into a list of 3-tuples (tag, length,
newvalue).</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.decodeDiscretionaryDataObjects">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">decodeDiscretionaryDataObjects</code><span class="sig-paren">(</span><em>tlv_data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeDiscretionaryDataObjects" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.decodeExtendedHeaderList">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">decodeExtendedHeaderList</code><span class="sig-paren">(</span><em>tlv_data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeExtendedHeaderList" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.decodeHeaderList">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">decodeHeaderList</code><span class="sig-paren">(</span><em>tlv_data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeHeaderList" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.decodeOffsetDataObjects">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">decodeOffsetDataObjects</code><span class="sig-paren">(</span><em>tlv_data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeOffsetDataObjects" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.decodeTagList">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">decodeTagList</code><span class="sig-paren">(</span><em>tlv_data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeTagList" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.encodeDataOffsetObjects">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">encodeDataOffsetObjects</code><span class="sig-paren">(</span><em>datalist</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.encodeDataOffsetObjects" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.encodeDiscretionaryDataObjects">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">encodeDiscretionaryDataObjects</code><span class="sig-paren">(</span><em>datalist</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.encodeDiscretionaryDataObjects" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.encodebertlvDatalist">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">encodebertlvDatalist</code><span class="sig-paren">(</span><em>tag</em>, <em>datalist</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.encodebertlvDatalist" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.pack">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">pack</code><span class="sig-paren">(</span><em>tlv_data</em>, <em>recalculate_length=False</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.pack" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.simpletlv_pack">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">simpletlv_pack</code><span class="sig-paren">(</span><em>tlv_data</em>, <em>recalculate_length=False</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.simpletlv_pack" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.simpletlv_unpack">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">simpletlv_unpack</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.simpletlv_unpack" title="Permalink to this definition"></a></dt>
<dd><p>Unpacks a simpletlv coded string into a list of 3-tuples (tag, length,
newvalue).</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.tlv_find_tag">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">tlv_find_tag</code><span class="sig-paren">(</span><em>tlv_data</em>, <em>tag</em>, <em>num_results=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.tlv_find_tag" title="Permalink to this definition"></a></dt>
<dd><p>Find (and return) all instances of tag in the given tlv structure (as
returned by unpack).
If num_results is specified then at most that many results will be
returned.</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.tlv_find_tags">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">tlv_find_tags</code><span class="sig-paren">(</span><em>tlv_data</em>, <em>tags</em>, <em>num_results=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.tlv_find_tags" title="Permalink to this definition"></a></dt>
<dd><p>Find (and return) all instances of tags in the given tlv structure (as
returned by unpack). If num_results is specified then at most that many
results will be returned.</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.tlv_unpack">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">tlv_unpack</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.tlv_unpack" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.TLVutils.unpack">
<code class="descclassname">virtualsmartcard.TLVutils.</code><code class="descname">unpack</code><span class="sig-paren">(</span><em>data</em>, <em>with_marks=None</em>, <em>offset=0</em>, <em>include_filler=False</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.unpack" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,389 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>VirtualSmartcard Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="utils Module" href="virtualsmartcard.utils.html" />
<link rel="prev" title="TLVutils Module" href="virtualsmartcard.TLVutils.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">VirtualSmartcard Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.TLVutils.html" title="Previous Chapter: TLVutils Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; TLVutils Module</span>
</a>
</li>
<li>
<a href="virtualsmartcard.utils.html" title="Next Chapter: utils Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">utils Module &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="virtualsmartcard-module">
<h1>VirtualSmartcard Module<a class="headerlink" href="#virtualsmartcard-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-66308f7843803aa5084df2fbf62c13b8b1f3a5d4.png" alt="Inheritance diagram of virtualsmartcard.VirtualSmartcard" usemap="#inheritance4bd50c7c14" class="inheritance"/>
<map id="inheritance4bd50c7c14" name="inheritance4bd50c7c14">
<area shape="rect" id="node1" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS" title="virtualsmartcard.VirtualSmartcard.Iso7816OS" alt="" coords="383,55,695,80"/>
<area shape="rect" id="node2" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="Base class for a smart card OS" alt="" coords="5,55,335,80"/>
<area shape="rect" id="node3" href="#virtualsmartcard.VirtualSmartcard.VirtualICC" title="This class is responsible for maintaining the communication of the virtual" alt="" coords="17,5,323,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.VirtualSmartcard"></span><dl class="class">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS">
<em class="property">class </em><code class="descclassname">virtualsmartcard.VirtualSmartcard.</code><code class="descname">Iso7816OS</code><span class="sig-paren">(</span><em>mf</em>, <em>sam</em>, <em>ins2handler=None</em>, <em>extended_length=False</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="virtualsmartcard.VirtualSmartcard.SmartcardOS"><code class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.VirtualSmartcard.SmartcardOS</span></code></a></p>
<dl class="attribute">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.SAM">
<code class="descname">SAM</code><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.SAM" title="Permalink to this definition"></a></dt>
<dd><p>secure access module</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.execute">
<code class="descname">execute</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.formatResult">
<code class="descname">formatResult</code><span class="sig-paren">(</span><em>seekable</em>, <em>le</em>, <em>data</em>, <em>sw</em>, <em>sm</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.formatResult" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.getATR">
<code class="descname">getATR</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.getATR" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.getResponse">
<code class="descname">getResponse</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.getResponse" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="staticmethod">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.makeATR">
<em class="property">static </em><code class="descname">makeATR</code><span class="sig-paren">(</span><em>**args</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.makeATR" title="Permalink to this definition"></a></dt>
<dd><p>Calculate Answer to Reset (ATR) and returns the bitstring.</p>
<blockquote>
<div><ul>
<li><dl class="first docutils">
<dt>directConvention (bool): Whether to use direct convention or</dt>
<dd><p class="first last">inverse convention.</p>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>TAi, TBi, TCi (optional): Value between 0 and 0xff. Interface</dt>
<dd><p class="first last">Characters (for meaning see ISO 7816-3). Note that
if no transmission protocol is given, it is
automatically selected with T=max{j-1|TAj in args
OR TBj in args OR TCj in args}.</p>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>T (optional): Value between 0 and 15. Transmission Protocol.</dt>
<dd><p class="first last">Note that if T is set, TAi/TBi/TCi for i&gt;T are
omitted.</p>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>histChars (optional): Bitstring with 0 &lt;= len(histChars) &lt;= 15.</dt>
<dd><p class="first last">Historical Characters T1 to T15 (for
meaning see ISO 7816-4).</p>
</dd>
</dl>
</li>
</ul>
</div></blockquote>
<p>T0, TDi and TCK are automatically calculated.</p>
</dd></dl>
<dl class="staticmethod">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.makeThirdSoftwareFunctionTable">
<em class="property">static </em><code class="descname">makeThirdSoftwareFunctionTable</code><span class="sig-paren">(</span><em>commandChainging=False</em>, <em>extendedLe=False</em>, <em>assignLogicalChannel=0</em>, <em>maximumChannels=0</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.makeThirdSoftwareFunctionTable" title="Permalink to this definition"></a></dt>
<dd><p>Returns a byte according to the third software function table from the
historical bytes of the card capabilities.</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.mf">
<code class="descname">mf</code><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.mf" title="Permalink to this definition"></a></dt>
<dd><p>master file</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.powerDown">
<code class="descname">powerDown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.powerDown" title="Permalink to this definition"></a></dt>
<dd><p>Powers down the card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.powerUp">
<code class="descname">powerUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.powerUp" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.reset">
<code class="descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.reset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="staticmethod">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.seekable">
<em class="property">static </em><code class="descname">seekable</code><span class="sig-paren">(</span><em>ins</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.seekable" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS">
<em class="property">class </em><code class="descclassname">virtualsmartcard.VirtualSmartcard.</code><code class="descname">SmartcardOS</code><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Base class for a smart card OS</p>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.execute">
<code class="descname">execute</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS.execute" title="Permalink to this definition"></a></dt>
<dd><p>Returns response to the given APDU as string of characters</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>msg</strong> &#8211; the APDU as string of characters</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.getATR">
<code class="descname">getATR</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS.getATR" title="Permalink to this definition"></a></dt>
<dd><p>Returns the ATR of the card as string of characters</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.powerDown">
<code class="descname">powerDown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS.powerDown" title="Permalink to this definition"></a></dt>
<dd><p>Powers down the card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.powerUp">
<code class="descname">powerUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS.powerUp" title="Permalink to this definition"></a></dt>
<dd><p>Powers up the card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.reset">
<code class="descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS.reset" title="Permalink to this definition"></a></dt>
<dd><p>Performs a warm reset of the card (no power down)</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC">
<em class="property">class </em><code class="descclassname">virtualsmartcard.VirtualSmartcard.</code><code class="descname">VirtualICC</code><span class="sig-paren">(</span><em>datasetfile</em>, <em>card_type</em>, <em>host</em>, <em>port</em>, <em>readernum=None</em>, <em>ef_cardsecurity=None</em>, <em>ef_cardaccess=None</em>, <em>ca_key=None</em>, <em>cvca=None</em>, <em>disable_checks=False</em>, <em>esign_key=None</em>, <em>esign_ca_cert=None</em>, <em>esign_cert=None</em>, <em>logginglevel=20</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>This class is responsible for maintaining the communication of the virtual
PCD and the emulated smartcard. vpicc and vpcd communicate via a socket.
The vpcd sends command APDUs (which it receives from an application) to the
vicc. The vicc passes these CAPDUs on to an emulated smartcard, which
produces a response APDU. This RAPDU is then passed back by the vicc to
the vpcd, which forwards it to the application.</p>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC._VirtualICC__recvFromVPICC">
<code class="descname">_VirtualICC__recvFromVPICC</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC._VirtualICC__recvFromVPICC" title="Permalink to this definition"></a></dt>
<dd><p>Receive a message from the vpcd</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC._VirtualICC__sendToVPICC">
<code class="descname">_VirtualICC__sendToVPICC</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC._VirtualICC__sendToVPICC" title="Permalink to this definition"></a></dt>
<dd><p>Send a message to the vpcd</p>
</dd></dl>
<dl class="staticmethod">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.connectToPort">
<em class="property">static </em><code class="descname">connectToPort</code><span class="sig-paren">(</span><em>host</em>, <em>port</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.connectToPort" title="Permalink to this definition"></a></dt>
<dd><p>Open a connection to a given host on a given port.</p>
</dd></dl>
<dl class="staticmethod">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.openPort">
<em class="property">static </em><code class="descname">openPort</code><span class="sig-paren">(</span><em>port</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.openPort" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.run">
<code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.run" title="Permalink to this definition"></a></dt>
<dd><p>Main loop of the vpicc. Receives command APDUs via a socket from the
vpcd, dispatches them to the emulated smartcard and sends the resulting
respsonse APDU back to the vpcd.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.signalHandler">
<code class="descname">signalHandler</code><span class="sig-paren">(</span><em>sig=None</em>, <em>frame=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.signalHandler" title="Permalink to this definition"></a></dt>
<dd><p>Basically this signal handler just surpresses a traceback from being
printed when the user presses crtl-c</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.stop">
<code class="descname">stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.stop" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,224 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HandlerTest Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="cards Package" href="virtualsmartcard.cards.html" />
<link rel="next" title="Relay Module" href="virtualsmartcard.cards.Relay.html" />
<link rel="prev" title="cards Package" href="virtualsmartcard.cards.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">HandlerTest Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.cards.html" title="Previous Chapter: cards Package"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; cards Package</span>
</a>
</li>
<li>
<a href="virtualsmartcard.cards.Relay.html" title="Next Chapter: Relay Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">Relay Module &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="handlertest-module">
<h1>HandlerTest Module<a class="headerlink" href="#handlertest-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-87c02cb0f500902e28e2583f9a1dc09e571332ee.png" alt="Inheritance diagram of virtualsmartcard.cards.HandlerTest" usemap="#inheritancee548df9983" class="inheritance"/>
<map id="inheritancee548df9983" name="inheritancee548df9983">
<area shape="rect" id="node1" href="virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="Base class for a smart card OS" alt="" coords="5,5,335,31"/>
<area shape="rect" id="node2" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS" title="This class implements the commands used for the PC/SC&#45;lite &#160;smart &#160;card" alt="" coords="383,5,725,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.cards.HandlerTest"></span><dl class="class">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS">
<em class="property">class </em><code class="descclassname">virtualsmartcard.cards.HandlerTest.</code><code class="descname">HandlerTestOS</code><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="virtualsmartcard.VirtualSmartcard.SmartcardOS"><code class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.VirtualSmartcard.SmartcardOS</span></code></a></p>
<p>This class implements the commands used for the PC/SC-lite smart card
reader driver tester. See <a class="reference external" href="http://pcsclite.alioth.debian.org/pcsclite.html">http://pcsclite.alioth.debian.org/pcsclite.html</a>
and handler_test(1).</p>
<dl class="method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS._HandlerTestOS__output_from_le">
<code class="descname">_HandlerTestOS__output_from_le</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS._HandlerTestOS__output_from_le" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.execute">
<code class="descname">execute</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.getATR">
<code class="descname">getATR</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.getATR" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.powerDown">
<code class="descname">powerDown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.powerDown" title="Permalink to this definition"></a></dt>
<dd><p>Powers down the card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.powerUp">
<code class="descname">powerUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.powerUp" title="Permalink to this definition"></a></dt>
<dd><p>Powers up the card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.reset">
<code class="descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.reset" title="Permalink to this definition"></a></dt>
<dd><p>Performs a warm reset of the card (no power down)</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,223 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Relay Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="cards Package" href="virtualsmartcard.cards.html" />
<link rel="next" title="cryptoflex Module" href="virtualsmartcard.cards.cryptoflex.html" />
<link rel="prev" title="HandlerTest Module" href="virtualsmartcard.cards.HandlerTest.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">Relay Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.cards.HandlerTest.html" title="Previous Chapter: HandlerTest Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; HandlerTest Modu...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.cards.cryptoflex.html" title="Next Chapter: cryptoflex Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">cryptoflex Modul... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="relay-module">
<h1>Relay Module<a class="headerlink" href="#relay-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-d5ba565391cc5041a7ec6184d1e94238defbb78e.png" alt="Inheritance diagram of virtualsmartcard.cards.Relay" usemap="#inheritanceeed1b727ec" class="inheritance"/>
<map id="inheritanceeed1b727ec" name="inheritanceeed1b727ec">
<area shape="rect" id="node1" href="virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="Base class for a smart card OS" alt="" coords="5,5,335,31"/>
<area shape="rect" id="node2" href="#virtualsmartcard.cards.Relay.RelayOS" title="This class implements relaying of a (physical) smartcard. The RelayOS" alt="" coords="383,5,644,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.cards.Relay"></span><dl class="class">
<dt id="virtualsmartcard.cards.Relay.RelayOS">
<em class="property">class </em><code class="descclassname">virtualsmartcard.cards.Relay.</code><code class="descname">RelayOS</code><span class="sig-paren">(</span><em>readernum</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="virtualsmartcard.VirtualSmartcard.SmartcardOS"><code class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.VirtualSmartcard.SmartcardOS</span></code></a></p>
<p>This class implements relaying of a (physical) smartcard. The RelayOS
forwards the command APDUs received from the vpcd to the real smartcard via
an actual smart card reader and sends the responses back to the vpcd.
This class can be used to implement relay or MitM attacks.</p>
<dl class="method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.cleanup">
<code class="descname">cleanup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.cleanup" title="Permalink to this definition"></a></dt>
<dd><p>Close the connection to the physical card</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.execute">
<code class="descname">execute</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.getATR">
<code class="descname">getATR</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.getATR" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.powerDown">
<code class="descname">powerDown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.powerDown" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.powerUp">
<code class="descname">powerUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.powerUp" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.reset">
<code class="descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.reset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,890 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ePass Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="cards Package" href="virtualsmartcard.cards.html" />
<link rel="next" title="nPA Module" href="virtualsmartcard.cards.nPA.html" />
<link rel="prev" title="cryptoflex Module" href="virtualsmartcard.cards.cryptoflex.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">ePass Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.cards.cryptoflex.html" title="Previous Chapter: cryptoflex Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; cryptoflex Modul...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.cards.nPA.html" title="Next Chapter: nPA Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">nPA Module &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="epass-module">
<h1>ePass Module<a class="headerlink" href="#epass-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-4ccf04ec0e92318a21cb6d3d419a82fcf6101d07.png" alt="Inheritance diagram of virtualsmartcard.cards.ePass" usemap="#inheritancef880455e0d" class="inheritance"/>
<map id="inheritancef880455e0d" name="inheritancef880455e0d">
<area shape="rect" id="node1" href="virtualsmartcard.SEutils.html#virtualsmartcard.SEutils.Security_Environment" title="virtualsmartcard.SEutils.Security_Environment" alt="" coords="5,55,324,80"/>
<area shape="rect" id="node4" href="#virtualsmartcard.cards.ePass.ePass_SE" title="This class implements the Security Environment of the ICAO Passports. It" alt="" coords="383,55,655,80"/>
<area shape="rect" id="node2" href="virtualsmartcard.SmartcardSAM.html#virtualsmartcard.SmartcardSAM.SAM" title="This class is used to store the data needed by the SAM." alt="" coords="36,5,293,31"/>
<area shape="rect" id="node3" href="#virtualsmartcard.cards.ePass.PassportSAM" title="SAM for ICAO ePassport. Implements Basic access control and key derivation" alt="" coords="372,5,667,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.cards.ePass"></span><dl class="class">
<dt id="virtualsmartcard.cards.ePass.PassportSAM">
<em class="property">class </em><code class="descclassname">virtualsmartcard.cards.ePass.</code><code class="descname">PassportSAM</code><span class="sig-paren">(</span><em>mf</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="virtualsmartcard.SmartcardSAM.html#virtualsmartcard.SmartcardSAM.SAM" title="virtualsmartcard.SmartcardSAM.SAM"><code class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.SmartcardSAM.SAM</span></code></a></p>
<p>SAM for ICAO ePassport. Implements Basic access control and key derivation
for Secure Messaging.</p>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.FSdecrypt">
<code class="descname">FSdecrypt</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.FSdecrypt" title="Permalink to this definition"></a></dt>
<dd><p>Decrypt the given data, using the parameters stored in the SAM.
Right now we do not encrypt the data. In memory encryption might or
might not be added in a future version.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.FSencrypt">
<code class="descname">FSencrypt</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.FSencrypt" title="Permalink to this definition"></a></dt>
<dd><p>Encrypt the given data, using the parameters stored in the SAM.
Right now we do not encrypt the data. In memory encryption might or
might not be added in a future version.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM._PassportSAM__computeKeys">
<code class="descname">_PassportSAM__computeKeys</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM._PassportSAM__computeKeys" title="Permalink to this definition"></a></dt>
<dd><p>Computes the keys depending on the machine readable
zone of the passport according to TR-PKI mrtds ICC read-only
access v1.1 annex E.1.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM._get_referenced_key">
<code class="descname">_get_referenced_key</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM._get_referenced_key" title="Permalink to this definition"></a></dt>
<dd><p>This method returns the key specified by the p2 parameter. The key may
be stored on the cards filesystem.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>p1</strong> &#8211; Specifies the algorithm to use.</li>
<li><strong>p2</strong> &#8211; <p>Specifies a reference to the key to be used for encryption.</p>
<table border="1" class="docutils">
<colgroup>
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="3%" />
<col width="73%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">b8</th>
<th class="head">b7</th>
<th class="head">b6</th>
<th class="head">b5</th>
<th class="head">b4</th>
<th class="head">b3</th>
<th class="head">b2</th>
<th class="head">b1</th>
<th class="head">Meaning</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>No information is given</td>
</tr>
<tr class="row-odd"><td>0</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td>Global reference data(e.g. MF specific key)</td>
</tr>
<tr class="row-even"><td>1</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td>Specific reference data(e.g. DF specific
key)</td>
</tr>
<tr class="row-odd"><td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td><ul class="first last">
<li></li>
</ul>
</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>x</td>
<td>Number of the secret</td>
</tr>
</tbody>
</table>
<p>Any other value RFU</p>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.change_reference_data">
<code class="descname">change_reference_data</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.change_reference_data" title="Permalink to this definition"></a></dt>
<dd><p>Change the specified referenced data (e.g. CHV) of the card</p>
</dd></dl>
<dl class="staticmethod">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.derive_key">
<em class="property">static </em><code class="descname">derive_key</code><span class="sig-paren">(</span><em>seed</em>, <em>c</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.derive_key" title="Permalink to this definition"></a></dt>
<dd><p>Derive a key according to TR-PKI mrtds ICC read-only access v1.1
annex E.1.
c is either 1 for encryption or 2 for MAC computation.
Returns: Ka + Kb
Note: Does not adjust parity. Nobody uses that anyway ...</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.erase_SE">
<code class="descname">erase_SE</code><span class="sig-paren">(</span><em>SEID</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.erase_SE" title="Permalink to this definition"></a></dt>
<dd><p>Erases a Security Environment stored under SEID from the SAM</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.external_authenticate">
<code class="descname">external_authenticate</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>resp_data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.external_authenticate" title="Permalink to this definition"></a></dt>
<dd><p>Performs the basic access control protocol as defined in
the ICAO MRTD standard</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.generate_public_key_pair">
<code class="descname">generate_public_key_pair</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.generate_public_key_pair" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.get_card_number">
<code class="descname">get_card_number</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.get_card_number" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.get_challenge">
<code class="descname">get_challenge</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.get_challenge" title="Permalink to this definition"></a></dt>
<dd><p>Generate a random number of maximum 8 Byte and return it.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.internal_authenticate">
<code class="descname">internal_authenticate</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.internal_authenticate" title="Permalink to this definition"></a></dt>
<dd><p>Authenticate card to terminal. Encrypt the challenge of the terminal
to prove key posession</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.manage_security_environment">
<code class="descname">manage_security_environment</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.manage_security_environment" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.mutual_authenticate">
<code class="descname">mutual_authenticate</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>mutual_challenge</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.mutual_authenticate" title="Permalink to this definition"></a></dt>
<dd><p>Takes an encrypted challenge in the form
&#8216;Terminal Challenge | Card Challenge | Card number&#8217;
and checks it for validity. If the challenge is successful
the card encrypts &#8216;Card Challenge | Terminal challenge&#8217; and
returns this value</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.parse_SM_CAPDU">
<code class="descname">parse_SM_CAPDU</code><span class="sig-paren">(</span><em>CAPDU</em>, <em>header_authentication</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.parse_SM_CAPDU" title="Permalink to this definition"></a></dt>
<dd><p>Parse a command APDU protected by Secure Messaging and return the
unprotected command APDU</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.perform_security_operation">
<code class="descname">perform_security_operation</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.perform_security_operation" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.protect_result">
<code class="descname">protect_result</code><span class="sig-paren">(</span><em>sw</em>, <em>unprotected_result</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.protect_result" title="Permalink to this definition"></a></dt>
<dd><p>Protect a plain response APDU by Secure Messaging</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.restore_SE">
<code class="descname">restore_SE</code><span class="sig-paren">(</span><em>SEID</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.restore_SE" title="Permalink to this definition"></a></dt>
<dd><p>Restores a Security Environment from the SAM and replaces the current
SE with it.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.set_MF">
<code class="descname">set_MF</code><span class="sig-paren">(</span><em>mf</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.set_MF" title="Permalink to this definition"></a></dt>
<dd><p>Setter function for the internal reference to the Filesystem. The SAM
needs a reference to the filesystem in order to store/retrieve keys.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.set_asym_algorithm">
<code class="descname">set_asym_algorithm</code><span class="sig-paren">(</span><em>cipher</em>, <em>keytype</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.set_asym_algorithm" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>cipher</strong> &#8211; Public/private key object from used for encryption</li>
<li><strong>keytype</strong> &#8211; Type of the public key (e.g. RSA, DSA)</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.store_SE">
<code class="descname">store_SE</code><span class="sig-paren">(</span><em>SEID</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.store_SE" title="Permalink to this definition"></a></dt>
<dd><p>Stores the current Security environment in the secure access module.
The SEID is used as a reference to identify the SE.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.PassportSAM.verify">
<code class="descname">verify</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>PIN</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.PassportSAM.verify" title="Permalink to this definition"></a></dt>
<dd><p>Authenticate the card user. Check if he entered a valid PIN.
If the PIN is invalid decrement retry counter. If retry counter
equals zero, block the card until reset with correct PUK</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="virtualsmartcard.cards.ePass.ePass_SE">
<em class="property">class </em><code class="descclassname">virtualsmartcard.cards.ePass.</code><code class="descname">ePass_SE</code><span class="sig-paren">(</span><em>MF</em>, <em>SAM</em>, <em>ssc=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="virtualsmartcard.SEutils.html#virtualsmartcard.SEutils.Security_Environment" title="virtualsmartcard.SEutils.Security_Environment"><code class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.SEutils.Security_Environment</span></code></a></p>
<p>This class implements the Security Environment of the ICAO Passports. It
is required in order to use the send sequence counter for secure messaging.</p>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE._set_SE">
<code class="descname">_set_SE</code><span class="sig-paren">(</span><em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE._set_SE" title="Permalink to this definition"></a></dt>
<dd><p>Manipulate the current Security Environment. P2 is the tag of a
control reference template, data contains control reference objects</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.compute_cryptographic_checksum">
<code class="descname">compute_cryptographic_checksum</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.compute_cryptographic_checksum" title="Permalink to this definition"></a></dt>
<dd><p>Compute a cryptographic checksum (e.g. MAC) for the given data.
The ePass uses a Send Sequence Counter for MAC calculation</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.compute_digital_signature">
<code class="descname">compute_digital_signature</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.compute_digital_signature" title="Permalink to this definition"></a></dt>
<dd><p>Compute a digital signature for the given data.
Algorithm and key are specified in the current SE</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>p1</strong> &#8211; Must be 0x9E = Secure Messaging class for digital signatures</li>
<li><strong>p2</strong> &#8211; Must be one of 0x9A, 0xAC, 0xBC. Indicates what kind of data
is included in the data field.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.decipher">
<code class="descname">decipher</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.decipher" title="Permalink to this definition"></a></dt>
<dd><p>Decipher data using key, algorithm, IV and Padding specified
by the current Security environment.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">raw data (no TLV coding). Padding is not removed!!!</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.encipher">
<code class="descname">encipher</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.encipher" title="Permalink to this definition"></a></dt>
<dd><p>Encipher data using key, algorithm, IV and Padding specified
by the current Security environment.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">raw data (no TLV coding).</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.generate_public_key_pair">
<code class="descname">generate_public_key_pair</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.generate_public_key_pair" title="Permalink to this definition"></a></dt>
<dd><p>The GENERATE PUBLIC-KEY PAIR command either initiates the generation
and storing of a key pair, i.e., a public key and a private key, in the
card, or accesses a key pair previously generated in the card.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>p1</strong> &#8211; should be 0x00 (generate new key)</li>
<li><strong>p2</strong> &#8211; &#8216;00&#8217; (no information provided) or reference of the key to
be generated</li>
<li><strong>data</strong> &#8211; One or more CRTs associated to the key generation if
P1-P2 different from &#8216;0000&#8217;</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.hash">
<code class="descname">hash</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.hash" title="Permalink to this definition"></a></dt>
<dd><p>Hash the given data using the algorithm specified by the current
Security environment.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">raw data (no TLV coding).</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.manage_security_environment">
<code class="descname">manage_security_environment</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.manage_security_environment" title="Permalink to this definition"></a></dt>
<dd><p>This method is used to store, restore or erase Security Environments
or to manipulate the various parameters of the current SE.
P1 specifies the operation to perform, p2 is either the SEID for the
referred SE or the tag of a control reference template</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>p1</strong> &#8211; <p>Bitmask according to this table</p>
<table border="1" class="docutils">
<colgroup>
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="4%" />
<col width="71%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">b8</th>
<th class="head">b7</th>
<th class="head">b6</th>
<th class="head">b5</th>
<th class="head">b4</th>
<th class="head">b3</th>
<th class="head">b2</th>
<th class="head">b1</th>
<th class="head">Meaning</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>1</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>Secure messaging in command data field</td>
</tr>
<tr class="row-odd"><td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>1</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>Secure messaging in response data field</td>
</tr>
<tr class="row-even"><td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>1</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>Computation, decipherment, internal
authentication and key agreement</td>
</tr>
<tr class="row-odd"><td>1</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>Verification, encipherment, external
authentication and key agreement</td>
</tr>
<tr class="row-even"><td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<li></li>
</ul>
</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>SET</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>STORE</td>
</tr>
<tr class="row-even"><td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>RESTORE</td>
</tr>
<tr class="row-odd"><td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>ERASE</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.parse_SM_CAPDU">
<code class="descname">parse_SM_CAPDU</code><span class="sig-paren">(</span><em>CAPDU</em>, <em>authenticate_header</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.parse_SM_CAPDU" title="Permalink to this definition"></a></dt>
<dd><p>This methods parses a data field including Secure Messaging objects.
SM_header indicates whether or not the header of the message shall be
authenticated. It returns an unprotected command APDU</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>CAPDU</strong> &#8211; The protected CAPDU to be parsed</li>
<li><strong>authenticate_header</strong> &#8211; Whether or not the header should be
included in authentication mechanisms</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Unprotected command APDU</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.perform_security_operation">
<code class="descname">perform_security_operation</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.perform_security_operation" title="Permalink to this definition"></a></dt>
<dd><p>In the end this command is nothing but a big switch for all the other
commands in ISO 7816-8. It will invoke the appropriate command and
return its result</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.protect_response">
<code class="descname">protect_response</code><span class="sig-paren">(</span><em>sw</em>, <em>result</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.protect_response" title="Permalink to this definition"></a></dt>
<dd><p>This method protects a response APDU using secure messaging mechanisms</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the protected data and the SW bytes</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.verify_certificate">
<code class="descname">verify_certificate</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.verify_certificate" title="Permalink to this definition"></a></dt>
<dd><p>Verify a certificate send by the terminal using the internal trust
anchors.
This method is currently not implemented.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.verify_cryptographic_checksum">
<code class="descname">verify_cryptographic_checksum</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.verify_cryptographic_checksum" title="Permalink to this definition"></a></dt>
<dd><p>Verify the cryptographic checksum contained in the data field.
Data field must contain a cryptographic checksum (tag 0x8E) and a plain
value (tag 0x80)</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.cards.ePass.ePass_SE.verify_digital_signature">
<code class="descname">verify_digital_signature</code><span class="sig-paren">(</span><em>p1</em>, <em>p2</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.ePass.ePass_SE.verify_digital_signature" title="Permalink to this definition"></a></dt>
<dd><p>Verify the digital signature contained in the data field. Data must
contain a data to sign (tag 0x9A, 0xAC or 0xBC) and a digital signature
(0x9E)</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cards Package &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="HandlerTest Module" href="virtualsmartcard.cards.HandlerTest.html" />
<link rel="prev" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">cards Package</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.html" title="Previous Chapter: virtualsmartcard Package"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; virtualsmartcard...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.cards.HandlerTest.html" title="Next Chapter: HandlerTest Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">HandlerTest Modu... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="cards-package">
<h1>cards Package<a class="headerlink" href="#cards-package" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.cards.HandlerTest.html">HandlerTest Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.cards.Relay.html">Relay Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.cards.cryptoflex.html">cryptoflex Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.cards.ePass.html">ePass Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.cards.nPA.html">nPA Module</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,204 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>virtualsmartcard Package &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="Creating a Virtual Smart Card" href="../api.html" />
<link rel="next" title="cards Package" href="virtualsmartcard.cards.html" />
<link rel="prev" title="Creating a Virtual Smart Card" href="../api.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">virtualsmartcard Package</a></li>
</ul>
</ul>
</li>
<li>
<a href="../api.html" title="Previous Chapter: Creating a Virtual Smart Card"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; Creating a Virtu...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.cards.html" title="Next Chapter: cards Package"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">cards Package &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="virtualsmartcard-package">
<h1>virtualsmartcard Package<a class="headerlink" href="#virtualsmartcard-package" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.cards.html">cards Package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="virtualsmartcard.cards.HandlerTest.html">HandlerTest Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="virtualsmartcard.cards.Relay.html">Relay Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="virtualsmartcard.cards.cryptoflex.html">cryptoflex Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="virtualsmartcard.cards.ePass.html">ePass Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="virtualsmartcard.cards.nPA.html">nPA Module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.tests.html">tests Package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="virtualsmartcard.tests.CardGenerator_test.html">CardGenerator_test Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="virtualsmartcard.tests.CryptoUtils_test.html">CryptoUtils_test Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="virtualsmartcard.tests.SmartcardSAM_test.html">SmartcardSAM_test Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="virtualsmartcard.tests.utils_test.html">utils_test Module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.CardGenerator.html">CardGenerator Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.ConstantDefinitions.html">ConstantDefinitions Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.CryptoUtils.html">CryptoUtils Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.SEutils.html">SEutils Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.SWutils.html">SWutils Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.SmartcardFilesystem.html">SmartcardFilesystem Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.SmartcardSAM.html">SmartcardSAM Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.TLVutils.html">TLVutils Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.VirtualSmartcard.html">VirtualSmartcard Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.utils.html">utils Module</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,731 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CryptoUtils_test Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="tests Package" href="virtualsmartcard.tests.html" />
<link rel="next" title="SmartcardSAM_test Module" href="virtualsmartcard.tests.SmartcardSAM_test.html" />
<link rel="prev" title="CardGenerator_test Module" href="virtualsmartcard.tests.CardGenerator_test.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">CryptoUtils_test Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.tests.CardGenerator_test.html" title="Previous Chapter: CardGenerator_test Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; CardGenerator_te...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.tests.SmartcardSAM_test.html" title="Next Chapter: SmartcardSAM_test Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">SmartcardSAM_tes... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="cryptoutils-test-module">
<h1>CryptoUtils_test Module<a class="headerlink" href="#cryptoutils-test-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-8d7ae2bc5a5efc5bac682034d18967034c43784c.png" alt="Inheritance diagram of virtualsmartcard.tests.CryptoUtils_test" usemap="#inheritance34477d81d3" class="inheritance"/>
<map id="inheritance34477d81d3" name="inheritance34477d81d3">
<area shape="rect" id="node1" title="A class whose instances are single test cases." alt="" coords="5,5,172,31"/>
<area shape="rect" id="node2" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils" title="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils" alt="" coords="220,5,591,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.tests.CryptoUtils_test"></span><dl class="class">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils">
<em class="property">class </em><code class="descclassname">virtualsmartcard.tests.CryptoUtils_test.</code><code class="descname">TestCryptoUtils</code><span class="sig-paren">(</span><em>methodName='runTest'</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">unittest.case.TestCase</span></code></p>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._addSkip">
<code class="descname">_addSkip</code><span class="sig-paren">(</span><em>result</em>, <em>reason</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._addSkip" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._baseAssertEqual">
<code class="descname">_baseAssertEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._baseAssertEqual" title="Permalink to this definition"></a></dt>
<dd><p>The default assertEqual implementation, not type specific.</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._classSetupFailed">
<code class="descname">_classSetupFailed</code><em class="property"> = False</em><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._classSetupFailed" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._deprecate">
<code class="descname">_deprecate</code><span class="sig-paren">(</span><em>original_func</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._deprecate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._diffThreshold">
<code class="descname">_diffThreshold</code><em class="property"> = 65536</em><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._diffThreshold" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._formatMessage">
<code class="descname">_formatMessage</code><span class="sig-paren">(</span><em>msg</em>, <em>standardMsg</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._formatMessage" title="Permalink to this definition"></a></dt>
<dd><p>Honour the longMessage attribute when generating failure messages.
If longMessage is False this means:
* Use only an explicit message if it is provided
* Otherwise use the standard message for the assert</p>
<p>If longMessage is True:
* Use the standard message
* If an explicit message is provided, plus &#8216; : &#8216; and the explicit message</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._getAssertEqualityFunc">
<code class="descname">_getAssertEqualityFunc</code><span class="sig-paren">(</span><em>first</em>, <em>second</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._getAssertEqualityFunc" title="Permalink to this definition"></a></dt>
<dd><p>Get a detailed comparison function for the types of the two args.</p>
<p>Returns: A callable accepting (first, second, msg=None) that will
raise a failure exception if first != second with a useful human
readable error message for those types.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._truncateMessage">
<code class="descname">_truncateMessage</code><span class="sig-paren">(</span><em>message</em>, <em>diff</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils._truncateMessage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.addCleanup">
<code class="descname">addCleanup</code><span class="sig-paren">(</span><em>function</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.addCleanup" title="Permalink to this definition"></a></dt>
<dd><p>Add a function, with arguments, to be called when the test is
completed. Functions added are called on a LIFO basis and are
called after tearDown on test failure or success.</p>
<p>Cleanup items are called even if setUp fails (unlike tearDown).</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.addTypeEqualityFunc">
<code class="descname">addTypeEqualityFunc</code><span class="sig-paren">(</span><em>typeobj</em>, <em>function</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.addTypeEqualityFunc" title="Permalink to this definition"></a></dt>
<dd><p>Add a type specific assertEqual style function to compare a type.</p>
<p>This method is for use by TestCase subclasses that need to register
their own type equality functions to provide nicer error messages.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><dl class="first last docutils">
<dt>typeobj: The data type to call this function on when both values</dt>
<dd>are of the same type in assertEqual().</dd>
<dt>function: The callable taking two arguments and an optional</dt>
<dd>msg= argument that raises self.failureException with a
useful error message when the two arguments are not equal.</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertAlmostEqual">
<code class="descname">assertAlmostEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertAlmostEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is more than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>If the two objects compare equal then they will automatically
compare almost equal.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertAlmostEquals">
<code class="descname">assertAlmostEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertAlmostEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is more than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>If the two objects compare equal then they will automatically
compare almost equal.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertDictContainsSubset">
<code class="descname">assertDictContainsSubset</code><span class="sig-paren">(</span><em>expected</em>, <em>actual</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertDictContainsSubset" title="Permalink to this definition"></a></dt>
<dd><p>Checks whether actual is a superset of expected.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertDictEqual">
<code class="descname">assertDictEqual</code><span class="sig-paren">(</span><em>d1</em>, <em>d2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertDictEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertEqual">
<code class="descname">assertEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by the &#8216;==&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertEquals">
<code class="descname">assertEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by the &#8216;==&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertFalse">
<code class="descname">assertFalse</code><span class="sig-paren">(</span><em>expr</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertFalse" title="Permalink to this definition"></a></dt>
<dd><p>Check that the expression is false.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertGreater">
<code class="descname">assertGreater</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertGreater" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &gt; b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertGreaterEqual">
<code class="descname">assertGreaterEqual</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertGreaterEqual" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &gt;= b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIn">
<code class="descname">assertIn</code><span class="sig-paren">(</span><em>member</em>, <em>container</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIn" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a in b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIs">
<code class="descname">assertIs</code><span class="sig-paren">(</span><em>expr1</em>, <em>expr2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIs" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a is b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIsInstance">
<code class="descname">assertIsInstance</code><span class="sig-paren">(</span><em>obj</em>, <em>cls</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIsInstance" title="Permalink to this definition"></a></dt>
<dd><p>Same as self.assertTrue(isinstance(obj, cls)), with a nicer
default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIsNone">
<code class="descname">assertIsNone</code><span class="sig-paren">(</span><em>obj</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIsNone" title="Permalink to this definition"></a></dt>
<dd><p>Same as self.assertTrue(obj is None), with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIsNot">
<code class="descname">assertIsNot</code><span class="sig-paren">(</span><em>expr1</em>, <em>expr2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIsNot" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a is not b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIsNotNone">
<code class="descname">assertIsNotNone</code><span class="sig-paren">(</span><em>obj</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertIsNotNone" title="Permalink to this definition"></a></dt>
<dd><p>Included for symmetry with assertIsNone.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertItemsEqual">
<code class="descname">assertItemsEqual</code><span class="sig-paren">(</span><em>expected_seq</em>, <em>actual_seq</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertItemsEqual" title="Permalink to this definition"></a></dt>
<dd><p>An unordered sequence specific comparison. It asserts that
actual_seq and expected_seq have the same element counts.
Equivalent to:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">Counter</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">actual_seq</span><span class="p">)),</span>
<span class="n">Counter</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">expected_seq</span><span class="p">)))</span>
</pre></div>
</div>
<p>Asserts that each element has the same count in both sequences.
Example:</p>
<blockquote>
<div><ul class="simple">
<li>[0, 1, 1] and [1, 0, 1] compare equal.</li>
<li>[0, 0, 1] and [0, 1] compare unequal.</li>
</ul>
</div></blockquote>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertLess">
<code class="descname">assertLess</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertLess" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &lt; b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertLessEqual">
<code class="descname">assertLessEqual</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertLessEqual" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &lt;= b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertListEqual">
<code class="descname">assertListEqual</code><span class="sig-paren">(</span><em>list1</em>, <em>list2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertListEqual" title="Permalink to this definition"></a></dt>
<dd><p>A list-specific equality assertion.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">list1: The first list to compare.
list2: The second list to compare.
msg: Optional message to use on failure instead of a list of</p>
<blockquote class="last">
<div>differences.</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertMultiLineEqual">
<code class="descname">assertMultiLineEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertMultiLineEqual" title="Permalink to this definition"></a></dt>
<dd><p>Assert that two multi-line strings are equal.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotAlmostEqual">
<code class="descname">assertNotAlmostEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotAlmostEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is less than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>Objects that are equal automatically fail.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotAlmostEquals">
<code class="descname">assertNotAlmostEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotAlmostEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is less than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>Objects that are equal automatically fail.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotEqual">
<code class="descname">assertNotEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by the &#8216;!=&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotEquals">
<code class="descname">assertNotEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by the &#8216;!=&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotIn">
<code class="descname">assertNotIn</code><span class="sig-paren">(</span><em>member</em>, <em>container</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotIn" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a not in b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotIsInstance">
<code class="descname">assertNotIsInstance</code><span class="sig-paren">(</span><em>obj</em>, <em>cls</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotIsInstance" title="Permalink to this definition"></a></dt>
<dd><p>Included for symmetry with assertIsInstance.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotRegexpMatches">
<code class="descname">assertNotRegexpMatches</code><span class="sig-paren">(</span><em>text</em>, <em>unexpected_regexp</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertNotRegexpMatches" title="Permalink to this definition"></a></dt>
<dd><p>Fail the test if the text matches the regular expression.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertRaises">
<code class="descname">assertRaises</code><span class="sig-paren">(</span><em>excClass</em>, <em>callableObj=None</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertRaises" title="Permalink to this definition"></a></dt>
<dd><p>Fail unless an exception of class excClass is raised
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
raised, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.</p>
<p>If called with callableObj omitted or None, will return a
context object used like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="n">SomeException</span><span class="p">):</span>
<span class="n">do_something</span><span class="p">()</span>
</pre></div>
</div>
<p>The context manager keeps a reference to the exception as
the &#8216;exception&#8217; attribute. This allows you to inspect the
exception after the assertion:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="n">SomeException</span><span class="p">)</span> <span class="k">as</span> <span class="n">cm</span><span class="p">:</span>
<span class="n">do_something</span><span class="p">()</span>
<span class="n">the_exception</span> <span class="o">=</span> <span class="n">cm</span><span class="o">.</span><span class="n">exception</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">the_exception</span><span class="o">.</span><span class="n">error_code</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertRaisesRegexp">
<code class="descname">assertRaisesRegexp</code><span class="sig-paren">(</span><em>expected_exception</em>, <em>expected_regexp</em>, <em>callable_obj=None</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertRaisesRegexp" title="Permalink to this definition"></a></dt>
<dd><p>Asserts that the message in a raised exception matches a regexp.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">expected_exception: Exception class expected to be raised.
expected_regexp: Regexp (re pattern object or string) expected</p>
<blockquote>
<div>to be found in error message.</div></blockquote>
<p class="last">callable_obj: Function to be called.
args: Extra args.
kwargs: Extra kwargs.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertRegexpMatches">
<code class="descname">assertRegexpMatches</code><span class="sig-paren">(</span><em>text</em>, <em>expected_regexp</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertRegexpMatches" title="Permalink to this definition"></a></dt>
<dd><p>Fail the test unless the text matches the regular expression.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertSequenceEqual">
<code class="descname">assertSequenceEqual</code><span class="sig-paren">(</span><em>seq1</em>, <em>seq2</em>, <em>msg=None</em>, <em>seq_type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertSequenceEqual" title="Permalink to this definition"></a></dt>
<dd><p>An equality assertion for ordered sequences (like lists and tuples).</p>
<p>For the purposes of this function, a valid ordered sequence type is one
which can be indexed, has a length, and has an equality operator.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">seq1: The first sequence to compare.
seq2: The second sequence to compare.
seq_type: The expected datatype of the sequences, or None if no</p>
<blockquote>
<div>datatype should be enforced.</div></blockquote>
<dl class="last docutils">
<dt>msg: Optional message to use on failure instead of a list of</dt>
<dd>differences.</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertSetEqual">
<code class="descname">assertSetEqual</code><span class="sig-paren">(</span><em>set1</em>, <em>set2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertSetEqual" title="Permalink to this definition"></a></dt>
<dd><p>A set-specific equality assertion.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">set1: The first set to compare.
set2: The second set to compare.
msg: Optional message to use on failure instead of a list of</p>
<blockquote class="last">
<div>differences.</div></blockquote>
</dd>
</dl>
<p>assertSetEqual uses ducktyping to support different types of sets, and
is optimized for sets specifically (parameters must support a
difference method).</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertTrue">
<code class="descname">assertTrue</code><span class="sig-paren">(</span><em>expr</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertTrue" title="Permalink to this definition"></a></dt>
<dd><p>Check that the expression is true.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertTupleEqual">
<code class="descname">assertTupleEqual</code><span class="sig-paren">(</span><em>tuple1</em>, <em>tuple2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assertTupleEqual" title="Permalink to this definition"></a></dt>
<dd><p>A tuple-specific equality assertion.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">tuple1: The first tuple to compare.
tuple2: The second tuple to compare.
msg: Optional message to use on failure instead of a list of</p>
<blockquote class="last">
<div>differences.</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assert_">
<code class="descname">assert_</code><span class="sig-paren">(</span><em>expr</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.assert_" title="Permalink to this definition"></a></dt>
<dd><p>Check that the expression is true.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.countTestCases">
<code class="descname">countTestCases</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.countTestCases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.debug">
<code class="descname">debug</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.debug" title="Permalink to this definition"></a></dt>
<dd><p>Run the test without collecting errors in a TestResult</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.defaultTestResult">
<code class="descname">defaultTestResult</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.defaultTestResult" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.doCleanups">
<code class="descname">doCleanups</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.doCleanups" title="Permalink to this definition"></a></dt>
<dd><p>Execute all cleanup functions. Normally called for you after
tearDown.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.fail">
<code class="descname">fail</code><span class="sig-paren">(</span><em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.fail" title="Permalink to this definition"></a></dt>
<dd><p>Fail immediately, with the given message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failIf">
<code class="descname">failIf</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failIf" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failIfAlmostEqual">
<code class="descname">failIfAlmostEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failIfAlmostEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failIfEqual">
<code class="descname">failIfEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failIfEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failUnless">
<code class="descname">failUnless</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failUnless" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failUnlessAlmostEqual">
<code class="descname">failUnlessAlmostEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failUnlessAlmostEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failUnlessEqual">
<code class="descname">failUnlessEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failUnlessEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failUnlessRaises">
<code class="descname">failUnlessRaises</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failUnlessRaises" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failureException">
<code class="descname">failureException</code><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.failureException" title="Permalink to this definition"></a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal"><span class="pre">AssertionError</span></code></p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.id">
<code class="descname">id</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.id" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.longMessage">
<code class="descname">longMessage</code><em class="property"> = False</em><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.longMessage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.maxDiff">
<code class="descname">maxDiff</code><em class="property"> = 640</em><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.maxDiff" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.run">
<code class="descname">run</code><span class="sig-paren">(</span><em>result=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.setUp">
<code class="descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.setUp" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.setUpClass">
<code class="descname">setUpClass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.setUpClass" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for setting up class fixture before running tests in the class.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.shortDescription">
<code class="descname">shortDescription</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.shortDescription" title="Permalink to this definition"></a></dt>
<dd><p>Returns a one-line description of the test, or None if no
description has been provided.</p>
<p>The default implementation of this method returns the first line of
the specified test method&#8217;s docstring.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.skipTest">
<code class="descname">skipTest</code><span class="sig-paren">(</span><em>reason</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.skipTest" title="Permalink to this definition"></a></dt>
<dd><p>Skip this test.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.tearDown">
<code class="descname">tearDown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.tearDown" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for deconstructing the test fixture after testing it.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.tearDownClass">
<code class="descname">tearDownClass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.tearDownClass" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for deconstructing the class fixture after running all tests in the class.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.test_padding">
<code class="descname">test_padding</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.CryptoUtils_test.TestCryptoUtils.test_padding" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,751 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SmartcardSAM_test Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="tests Package" href="virtualsmartcard.tests.html" />
<link rel="next" title="utils_test Module" href="virtualsmartcard.tests.utils_test.html" />
<link rel="prev" title="CryptoUtils_test Module" href="virtualsmartcard.tests.CryptoUtils_test.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">SmartcardSAM_test Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.tests.CryptoUtils_test.html" title="Previous Chapter: CryptoUtils_test Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; CryptoUtils_test...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.tests.utils_test.html" title="Next Chapter: utils_test Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">utils_test Modul... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="smartcardsam-test-module">
<h1>SmartcardSAM_test Module<a class="headerlink" href="#smartcardsam-test-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-6bbe035741f5d2dcb113ca7864c78d0280548c16.png" alt="Inheritance diagram of virtualsmartcard.tests.SmartcardSAM_test" usemap="#inheritance91c24ce5a0" class="inheritance"/>
<map id="inheritance91c24ce5a0" name="inheritance91c24ce5a0">
<area shape="rect" id="node1" title="A class whose instances are single test cases." alt="" coords="5,5,172,31"/>
<area shape="rect" id="node2" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM" title="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM" alt="" coords="220,5,639,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.tests.SmartcardSAM_test"></span><dl class="class">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM">
<em class="property">class </em><code class="descclassname">virtualsmartcard.tests.SmartcardSAM_test.</code><code class="descname">TestSmartcardSAM</code><span class="sig-paren">(</span><em>methodName='runTest'</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">unittest.case.TestCase</span></code></p>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._addSkip">
<code class="descname">_addSkip</code><span class="sig-paren">(</span><em>result</em>, <em>reason</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._addSkip" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._baseAssertEqual">
<code class="descname">_baseAssertEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._baseAssertEqual" title="Permalink to this definition"></a></dt>
<dd><p>The default assertEqual implementation, not type specific.</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._classSetupFailed">
<code class="descname">_classSetupFailed</code><em class="property"> = False</em><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._classSetupFailed" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._deprecate">
<code class="descname">_deprecate</code><span class="sig-paren">(</span><em>original_func</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._deprecate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._diffThreshold">
<code class="descname">_diffThreshold</code><em class="property"> = 65536</em><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._diffThreshold" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._formatMessage">
<code class="descname">_formatMessage</code><span class="sig-paren">(</span><em>msg</em>, <em>standardMsg</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._formatMessage" title="Permalink to this definition"></a></dt>
<dd><p>Honour the longMessage attribute when generating failure messages.
If longMessage is False this means:
* Use only an explicit message if it is provided
* Otherwise use the standard message for the assert</p>
<p>If longMessage is True:
* Use the standard message
* If an explicit message is provided, plus &#8216; : &#8216; and the explicit message</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._getAssertEqualityFunc">
<code class="descname">_getAssertEqualityFunc</code><span class="sig-paren">(</span><em>first</em>, <em>second</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._getAssertEqualityFunc" title="Permalink to this definition"></a></dt>
<dd><p>Get a detailed comparison function for the types of the two args.</p>
<p>Returns: A callable accepting (first, second, msg=None) that will
raise a failure exception if first != second with a useful human
readable error message for those types.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._truncateMessage">
<code class="descname">_truncateMessage</code><span class="sig-paren">(</span><em>message</em>, <em>diff</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM._truncateMessage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.addCleanup">
<code class="descname">addCleanup</code><span class="sig-paren">(</span><em>function</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.addCleanup" title="Permalink to this definition"></a></dt>
<dd><p>Add a function, with arguments, to be called when the test is
completed. Functions added are called on a LIFO basis and are
called after tearDown on test failure or success.</p>
<p>Cleanup items are called even if setUp fails (unlike tearDown).</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.addTypeEqualityFunc">
<code class="descname">addTypeEqualityFunc</code><span class="sig-paren">(</span><em>typeobj</em>, <em>function</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.addTypeEqualityFunc" title="Permalink to this definition"></a></dt>
<dd><p>Add a type specific assertEqual style function to compare a type.</p>
<p>This method is for use by TestCase subclasses that need to register
their own type equality functions to provide nicer error messages.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><dl class="first last docutils">
<dt>typeobj: The data type to call this function on when both values</dt>
<dd>are of the same type in assertEqual().</dd>
<dt>function: The callable taking two arguments and an optional</dt>
<dd>msg= argument that raises self.failureException with a
useful error message when the two arguments are not equal.</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertAlmostEqual">
<code class="descname">assertAlmostEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertAlmostEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is more than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>If the two objects compare equal then they will automatically
compare almost equal.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertAlmostEquals">
<code class="descname">assertAlmostEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertAlmostEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is more than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>If the two objects compare equal then they will automatically
compare almost equal.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertDictContainsSubset">
<code class="descname">assertDictContainsSubset</code><span class="sig-paren">(</span><em>expected</em>, <em>actual</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertDictContainsSubset" title="Permalink to this definition"></a></dt>
<dd><p>Checks whether actual is a superset of expected.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertDictEqual">
<code class="descname">assertDictEqual</code><span class="sig-paren">(</span><em>d1</em>, <em>d2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertDictEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertEqual">
<code class="descname">assertEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by the &#8216;==&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertEquals">
<code class="descname">assertEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by the &#8216;==&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertFalse">
<code class="descname">assertFalse</code><span class="sig-paren">(</span><em>expr</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertFalse" title="Permalink to this definition"></a></dt>
<dd><p>Check that the expression is false.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertGreater">
<code class="descname">assertGreater</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertGreater" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &gt; b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertGreaterEqual">
<code class="descname">assertGreaterEqual</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertGreaterEqual" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &gt;= b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIn">
<code class="descname">assertIn</code><span class="sig-paren">(</span><em>member</em>, <em>container</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIn" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a in b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIs">
<code class="descname">assertIs</code><span class="sig-paren">(</span><em>expr1</em>, <em>expr2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIs" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a is b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIsInstance">
<code class="descname">assertIsInstance</code><span class="sig-paren">(</span><em>obj</em>, <em>cls</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIsInstance" title="Permalink to this definition"></a></dt>
<dd><p>Same as self.assertTrue(isinstance(obj, cls)), with a nicer
default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIsNone">
<code class="descname">assertIsNone</code><span class="sig-paren">(</span><em>obj</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIsNone" title="Permalink to this definition"></a></dt>
<dd><p>Same as self.assertTrue(obj is None), with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIsNot">
<code class="descname">assertIsNot</code><span class="sig-paren">(</span><em>expr1</em>, <em>expr2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIsNot" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a is not b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIsNotNone">
<code class="descname">assertIsNotNone</code><span class="sig-paren">(</span><em>obj</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertIsNotNone" title="Permalink to this definition"></a></dt>
<dd><p>Included for symmetry with assertIsNone.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertItemsEqual">
<code class="descname">assertItemsEqual</code><span class="sig-paren">(</span><em>expected_seq</em>, <em>actual_seq</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertItemsEqual" title="Permalink to this definition"></a></dt>
<dd><p>An unordered sequence specific comparison. It asserts that
actual_seq and expected_seq have the same element counts.
Equivalent to:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">Counter</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">actual_seq</span><span class="p">)),</span>
<span class="n">Counter</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">expected_seq</span><span class="p">)))</span>
</pre></div>
</div>
<p>Asserts that each element has the same count in both sequences.
Example:</p>
<blockquote>
<div><ul class="simple">
<li>[0, 1, 1] and [1, 0, 1] compare equal.</li>
<li>[0, 0, 1] and [0, 1] compare unequal.</li>
</ul>
</div></blockquote>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertLess">
<code class="descname">assertLess</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertLess" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &lt; b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertLessEqual">
<code class="descname">assertLessEqual</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertLessEqual" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &lt;= b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertListEqual">
<code class="descname">assertListEqual</code><span class="sig-paren">(</span><em>list1</em>, <em>list2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertListEqual" title="Permalink to this definition"></a></dt>
<dd><p>A list-specific equality assertion.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">list1: The first list to compare.
list2: The second list to compare.
msg: Optional message to use on failure instead of a list of</p>
<blockquote class="last">
<div>differences.</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertMultiLineEqual">
<code class="descname">assertMultiLineEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertMultiLineEqual" title="Permalink to this definition"></a></dt>
<dd><p>Assert that two multi-line strings are equal.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotAlmostEqual">
<code class="descname">assertNotAlmostEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotAlmostEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is less than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>Objects that are equal automatically fail.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotAlmostEquals">
<code class="descname">assertNotAlmostEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotAlmostEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is less than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>Objects that are equal automatically fail.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotEqual">
<code class="descname">assertNotEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by the &#8216;!=&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotEquals">
<code class="descname">assertNotEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by the &#8216;!=&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotIn">
<code class="descname">assertNotIn</code><span class="sig-paren">(</span><em>member</em>, <em>container</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotIn" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a not in b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotIsInstance">
<code class="descname">assertNotIsInstance</code><span class="sig-paren">(</span><em>obj</em>, <em>cls</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotIsInstance" title="Permalink to this definition"></a></dt>
<dd><p>Included for symmetry with assertIsInstance.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotRegexpMatches">
<code class="descname">assertNotRegexpMatches</code><span class="sig-paren">(</span><em>text</em>, <em>unexpected_regexp</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertNotRegexpMatches" title="Permalink to this definition"></a></dt>
<dd><p>Fail the test if the text matches the regular expression.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertRaises">
<code class="descname">assertRaises</code><span class="sig-paren">(</span><em>excClass</em>, <em>callableObj=None</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertRaises" title="Permalink to this definition"></a></dt>
<dd><p>Fail unless an exception of class excClass is raised
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
raised, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.</p>
<p>If called with callableObj omitted or None, will return a
context object used like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="n">SomeException</span><span class="p">):</span>
<span class="n">do_something</span><span class="p">()</span>
</pre></div>
</div>
<p>The context manager keeps a reference to the exception as
the &#8216;exception&#8217; attribute. This allows you to inspect the
exception after the assertion:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="n">SomeException</span><span class="p">)</span> <span class="k">as</span> <span class="n">cm</span><span class="p">:</span>
<span class="n">do_something</span><span class="p">()</span>
<span class="n">the_exception</span> <span class="o">=</span> <span class="n">cm</span><span class="o">.</span><span class="n">exception</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">the_exception</span><span class="o">.</span><span class="n">error_code</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertRaisesRegexp">
<code class="descname">assertRaisesRegexp</code><span class="sig-paren">(</span><em>expected_exception</em>, <em>expected_regexp</em>, <em>callable_obj=None</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertRaisesRegexp" title="Permalink to this definition"></a></dt>
<dd><p>Asserts that the message in a raised exception matches a regexp.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">expected_exception: Exception class expected to be raised.
expected_regexp: Regexp (re pattern object or string) expected</p>
<blockquote>
<div>to be found in error message.</div></blockquote>
<p class="last">callable_obj: Function to be called.
args: Extra args.
kwargs: Extra kwargs.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertRegexpMatches">
<code class="descname">assertRegexpMatches</code><span class="sig-paren">(</span><em>text</em>, <em>expected_regexp</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertRegexpMatches" title="Permalink to this definition"></a></dt>
<dd><p>Fail the test unless the text matches the regular expression.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertSequenceEqual">
<code class="descname">assertSequenceEqual</code><span class="sig-paren">(</span><em>seq1</em>, <em>seq2</em>, <em>msg=None</em>, <em>seq_type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertSequenceEqual" title="Permalink to this definition"></a></dt>
<dd><p>An equality assertion for ordered sequences (like lists and tuples).</p>
<p>For the purposes of this function, a valid ordered sequence type is one
which can be indexed, has a length, and has an equality operator.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">seq1: The first sequence to compare.
seq2: The second sequence to compare.
seq_type: The expected datatype of the sequences, or None if no</p>
<blockquote>
<div>datatype should be enforced.</div></blockquote>
<dl class="last docutils">
<dt>msg: Optional message to use on failure instead of a list of</dt>
<dd>differences.</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertSetEqual">
<code class="descname">assertSetEqual</code><span class="sig-paren">(</span><em>set1</em>, <em>set2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertSetEqual" title="Permalink to this definition"></a></dt>
<dd><p>A set-specific equality assertion.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">set1: The first set to compare.
set2: The second set to compare.
msg: Optional message to use on failure instead of a list of</p>
<blockquote class="last">
<div>differences.</div></blockquote>
</dd>
</dl>
<p>assertSetEqual uses ducktyping to support different types of sets, and
is optimized for sets specifically (parameters must support a
difference method).</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertTrue">
<code class="descname">assertTrue</code><span class="sig-paren">(</span><em>expr</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertTrue" title="Permalink to this definition"></a></dt>
<dd><p>Check that the expression is true.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertTupleEqual">
<code class="descname">assertTupleEqual</code><span class="sig-paren">(</span><em>tuple1</em>, <em>tuple2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assertTupleEqual" title="Permalink to this definition"></a></dt>
<dd><p>A tuple-specific equality assertion.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">tuple1: The first tuple to compare.
tuple2: The second tuple to compare.
msg: Optional message to use on failure instead of a list of</p>
<blockquote class="last">
<div>differences.</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assert_">
<code class="descname">assert_</code><span class="sig-paren">(</span><em>expr</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.assert_" title="Permalink to this definition"></a></dt>
<dd><p>Check that the expression is true.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.countTestCases">
<code class="descname">countTestCases</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.countTestCases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.debug">
<code class="descname">debug</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.debug" title="Permalink to this definition"></a></dt>
<dd><p>Run the test without collecting errors in a TestResult</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.defaultTestResult">
<code class="descname">defaultTestResult</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.defaultTestResult" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.doCleanups">
<code class="descname">doCleanups</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.doCleanups" title="Permalink to this definition"></a></dt>
<dd><p>Execute all cleanup functions. Normally called for you after
tearDown.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.fail">
<code class="descname">fail</code><span class="sig-paren">(</span><em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.fail" title="Permalink to this definition"></a></dt>
<dd><p>Fail immediately, with the given message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failIf">
<code class="descname">failIf</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failIf" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failIfAlmostEqual">
<code class="descname">failIfAlmostEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failIfAlmostEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failIfEqual">
<code class="descname">failIfEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failIfEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failUnless">
<code class="descname">failUnless</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failUnless" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failUnlessAlmostEqual">
<code class="descname">failUnlessAlmostEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failUnlessAlmostEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failUnlessEqual">
<code class="descname">failUnlessEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failUnlessEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failUnlessRaises">
<code class="descname">failUnlessRaises</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failUnlessRaises" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failureException">
<code class="descname">failureException</code><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.failureException" title="Permalink to this definition"></a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal"><span class="pre">AssertionError</span></code></p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.id">
<code class="descname">id</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.id" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.longMessage">
<code class="descname">longMessage</code><em class="property"> = False</em><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.longMessage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.maxDiff">
<code class="descname">maxDiff</code><em class="property"> = 640</em><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.maxDiff" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.run">
<code class="descname">run</code><span class="sig-paren">(</span><em>result=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.setUp">
<code class="descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.setUp" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.setUpClass">
<code class="descname">setUpClass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.setUpClass" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for setting up class fixture before running tests in the class.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.shortDescription">
<code class="descname">shortDescription</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.shortDescription" title="Permalink to this definition"></a></dt>
<dd><p>Returns a one-line description of the test, or None if no
description has been provided.</p>
<p>The default implementation of this method returns the first line of
the specified test method&#8217;s docstring.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.skipTest">
<code class="descname">skipTest</code><span class="sig-paren">(</span><em>reason</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.skipTest" title="Permalink to this definition"></a></dt>
<dd><p>Skip this test.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.tearDown">
<code class="descname">tearDown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.tearDown" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for deconstructing the test fixture after testing it.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.tearDownClass">
<code class="descname">tearDownClass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.tearDownClass" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for deconstructing the class fixture after running all tests in the class.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_counter_decrement">
<code class="descname">test_counter_decrement</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_counter_decrement" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_external_authenticate">
<code class="descname">test_external_authenticate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_external_authenticate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_incorrect_pin">
<code class="descname">test_incorrect_pin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_incorrect_pin" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_internal_authenticate">
<code class="descname">test_internal_authenticate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_internal_authenticate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_security_environment">
<code class="descname">test_security_environment</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.SmartcardSAM_test.TestSmartcardSAM.test_security_environment" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,183 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>tests Package &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="next" title="CardGenerator_test Module" href="virtualsmartcard.tests.CardGenerator_test.html" />
<link rel="prev" title="nPA Module" href="virtualsmartcard.cards.nPA.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">tests Package</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.cards.nPA.html" title="Previous Chapter: nPA Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; nPA Module</span>
</a>
</li>
<li>
<a href="virtualsmartcard.tests.CardGenerator_test.html" title="Next Chapter: CardGenerator_test Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">CardGenerator_te... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="tests-package">
<h1>tests Package<a class="headerlink" href="#tests-package" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.tests.CardGenerator_test.html">CardGenerator_test Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.tests.CryptoUtils_test.html">CryptoUtils_test Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.tests.SmartcardSAM_test.html">SmartcardSAM_test Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualsmartcard.tests.utils_test.html">utils_test Module</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,737 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>utils_test Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="tests Package" href="virtualsmartcard.tests.html" />
<link rel="next" title="CardGenerator Module" href="virtualsmartcard.CardGenerator.html" />
<link rel="prev" title="SmartcardSAM_test Module" href="virtualsmartcard.tests.SmartcardSAM_test.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">utils_test Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.tests.SmartcardSAM_test.html" title="Previous Chapter: SmartcardSAM_test Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; SmartcardSAM_tes...</span>
</a>
</li>
<li>
<a href="virtualsmartcard.CardGenerator.html" title="Next Chapter: CardGenerator Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">CardGenerator Mo... &raquo;</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="utils-test-module">
<h1>utils_test Module<a class="headerlink" href="#utils-test-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-e1d6573d10e97f2502d55eaa993e54e501d1540a.png" alt="Inheritance diagram of virtualsmartcard.tests.utils_test" usemap="#inheritancedaa185e5f0" class="inheritance"/>
<map id="inheritancedaa185e5f0" name="inheritancedaa185e5f0">
<area shape="rect" id="node1" title="A class whose instances are single test cases." alt="" coords="5,5,172,31"/>
<area shape="rect" id="node2" href="#virtualsmartcard.tests.utils_test.TestUtils" title="virtualsmartcard.tests.utils_test.TestUtils" alt="" coords="220,5,503,31"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.tests.utils_test"></span><dl class="class">
<dt id="virtualsmartcard.tests.utils_test.TestUtils">
<em class="property">class </em><code class="descclassname">virtualsmartcard.tests.utils_test.</code><code class="descname">TestUtils</code><span class="sig-paren">(</span><em>methodName='runTest'</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">unittest.case.TestCase</span></code></p>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils._addSkip">
<code class="descname">_addSkip</code><span class="sig-paren">(</span><em>result</em>, <em>reason</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils._addSkip" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils._baseAssertEqual">
<code class="descname">_baseAssertEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils._baseAssertEqual" title="Permalink to this definition"></a></dt>
<dd><p>The default assertEqual implementation, not type specific.</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.utils_test.TestUtils._classSetupFailed">
<code class="descname">_classSetupFailed</code><em class="property"> = False</em><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils._classSetupFailed" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils._deprecate">
<code class="descname">_deprecate</code><span class="sig-paren">(</span><em>original_func</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils._deprecate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.utils_test.TestUtils._diffThreshold">
<code class="descname">_diffThreshold</code><em class="property"> = 65536</em><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils._diffThreshold" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils._formatMessage">
<code class="descname">_formatMessage</code><span class="sig-paren">(</span><em>msg</em>, <em>standardMsg</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils._formatMessage" title="Permalink to this definition"></a></dt>
<dd><p>Honour the longMessage attribute when generating failure messages.
If longMessage is False this means:
* Use only an explicit message if it is provided
* Otherwise use the standard message for the assert</p>
<p>If longMessage is True:
* Use the standard message
* If an explicit message is provided, plus &#8216; : &#8216; and the explicit message</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils._getAssertEqualityFunc">
<code class="descname">_getAssertEqualityFunc</code><span class="sig-paren">(</span><em>first</em>, <em>second</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils._getAssertEqualityFunc" title="Permalink to this definition"></a></dt>
<dd><p>Get a detailed comparison function for the types of the two args.</p>
<p>Returns: A callable accepting (first, second, msg=None) that will
raise a failure exception if first != second with a useful human
readable error message for those types.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils._truncateMessage">
<code class="descname">_truncateMessage</code><span class="sig-paren">(</span><em>message</em>, <em>diff</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils._truncateMessage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.addCleanup">
<code class="descname">addCleanup</code><span class="sig-paren">(</span><em>function</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.addCleanup" title="Permalink to this definition"></a></dt>
<dd><p>Add a function, with arguments, to be called when the test is
completed. Functions added are called on a LIFO basis and are
called after tearDown on test failure or success.</p>
<p>Cleanup items are called even if setUp fails (unlike tearDown).</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.addTypeEqualityFunc">
<code class="descname">addTypeEqualityFunc</code><span class="sig-paren">(</span><em>typeobj</em>, <em>function</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.addTypeEqualityFunc" title="Permalink to this definition"></a></dt>
<dd><p>Add a type specific assertEqual style function to compare a type.</p>
<p>This method is for use by TestCase subclasses that need to register
their own type equality functions to provide nicer error messages.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><dl class="first last docutils">
<dt>typeobj: The data type to call this function on when both values</dt>
<dd>are of the same type in assertEqual().</dd>
<dt>function: The callable taking two arguments and an optional</dt>
<dd>msg= argument that raises self.failureException with a
useful error message when the two arguments are not equal.</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertAlmostEqual">
<code class="descname">assertAlmostEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertAlmostEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is more than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>If the two objects compare equal then they will automatically
compare almost equal.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertAlmostEquals">
<code class="descname">assertAlmostEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertAlmostEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is more than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>If the two objects compare equal then they will automatically
compare almost equal.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertDictContainsSubset">
<code class="descname">assertDictContainsSubset</code><span class="sig-paren">(</span><em>expected</em>, <em>actual</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertDictContainsSubset" title="Permalink to this definition"></a></dt>
<dd><p>Checks whether actual is a superset of expected.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertDictEqual">
<code class="descname">assertDictEqual</code><span class="sig-paren">(</span><em>d1</em>, <em>d2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertDictEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertEqual">
<code class="descname">assertEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by the &#8216;==&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertEquals">
<code class="descname">assertEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are unequal as determined by the &#8216;==&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertFalse">
<code class="descname">assertFalse</code><span class="sig-paren">(</span><em>expr</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertFalse" title="Permalink to this definition"></a></dt>
<dd><p>Check that the expression is false.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertGreater">
<code class="descname">assertGreater</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertGreater" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &gt; b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertGreaterEqual">
<code class="descname">assertGreaterEqual</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertGreaterEqual" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &gt;= b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertIn">
<code class="descname">assertIn</code><span class="sig-paren">(</span><em>member</em>, <em>container</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertIn" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a in b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertIs">
<code class="descname">assertIs</code><span class="sig-paren">(</span><em>expr1</em>, <em>expr2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertIs" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a is b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertIsInstance">
<code class="descname">assertIsInstance</code><span class="sig-paren">(</span><em>obj</em>, <em>cls</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertIsInstance" title="Permalink to this definition"></a></dt>
<dd><p>Same as self.assertTrue(isinstance(obj, cls)), with a nicer
default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertIsNone">
<code class="descname">assertIsNone</code><span class="sig-paren">(</span><em>obj</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertIsNone" title="Permalink to this definition"></a></dt>
<dd><p>Same as self.assertTrue(obj is None), with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertIsNot">
<code class="descname">assertIsNot</code><span class="sig-paren">(</span><em>expr1</em>, <em>expr2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertIsNot" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a is not b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertIsNotNone">
<code class="descname">assertIsNotNone</code><span class="sig-paren">(</span><em>obj</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertIsNotNone" title="Permalink to this definition"></a></dt>
<dd><p>Included for symmetry with assertIsNone.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertItemsEqual">
<code class="descname">assertItemsEqual</code><span class="sig-paren">(</span><em>expected_seq</em>, <em>actual_seq</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertItemsEqual" title="Permalink to this definition"></a></dt>
<dd><p>An unordered sequence specific comparison. It asserts that
actual_seq and expected_seq have the same element counts.
Equivalent to:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">Counter</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">actual_seq</span><span class="p">)),</span>
<span class="n">Counter</span><span class="p">(</span><span class="nb">iter</span><span class="p">(</span><span class="n">expected_seq</span><span class="p">)))</span>
</pre></div>
</div>
<p>Asserts that each element has the same count in both sequences.
Example:</p>
<blockquote>
<div><ul class="simple">
<li>[0, 1, 1] and [1, 0, 1] compare equal.</li>
<li>[0, 0, 1] and [0, 1] compare unequal.</li>
</ul>
</div></blockquote>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertLess">
<code class="descname">assertLess</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertLess" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &lt; b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertLessEqual">
<code class="descname">assertLessEqual</code><span class="sig-paren">(</span><em>a</em>, <em>b</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertLessEqual" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a &lt;= b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertListEqual">
<code class="descname">assertListEqual</code><span class="sig-paren">(</span><em>list1</em>, <em>list2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertListEqual" title="Permalink to this definition"></a></dt>
<dd><p>A list-specific equality assertion.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">list1: The first list to compare.
list2: The second list to compare.
msg: Optional message to use on failure instead of a list of</p>
<blockquote class="last">
<div>differences.</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertMultiLineEqual">
<code class="descname">assertMultiLineEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertMultiLineEqual" title="Permalink to this definition"></a></dt>
<dd><p>Assert that two multi-line strings are equal.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertNotAlmostEqual">
<code class="descname">assertNotAlmostEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertNotAlmostEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is less than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>Objects that are equal automatically fail.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertNotAlmostEquals">
<code class="descname">assertNotAlmostEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>places=None</em>, <em>msg=None</em>, <em>delta=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertNotAlmostEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero, or by comparing that the
between the two objects is less than the given delta.</p>
<p>Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).</p>
<p>Objects that are equal automatically fail.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertNotEqual">
<code class="descname">assertNotEqual</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertNotEqual" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by the &#8216;!=&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertNotEquals">
<code class="descname">assertNotEquals</code><span class="sig-paren">(</span><em>first</em>, <em>second</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertNotEquals" title="Permalink to this definition"></a></dt>
<dd><p>Fail if the two objects are equal as determined by the &#8216;!=&#8217;
operator.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertNotIn">
<code class="descname">assertNotIn</code><span class="sig-paren">(</span><em>member</em>, <em>container</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertNotIn" title="Permalink to this definition"></a></dt>
<dd><p>Just like self.assertTrue(a not in b), but with a nicer default message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertNotIsInstance">
<code class="descname">assertNotIsInstance</code><span class="sig-paren">(</span><em>obj</em>, <em>cls</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertNotIsInstance" title="Permalink to this definition"></a></dt>
<dd><p>Included for symmetry with assertIsInstance.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertNotRegexpMatches">
<code class="descname">assertNotRegexpMatches</code><span class="sig-paren">(</span><em>text</em>, <em>unexpected_regexp</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertNotRegexpMatches" title="Permalink to this definition"></a></dt>
<dd><p>Fail the test if the text matches the regular expression.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertRaises">
<code class="descname">assertRaises</code><span class="sig-paren">(</span><em>excClass</em>, <em>callableObj=None</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertRaises" title="Permalink to this definition"></a></dt>
<dd><p>Fail unless an exception of class excClass is raised
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
raised, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.</p>
<p>If called with callableObj omitted or None, will return a
context object used like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="n">SomeException</span><span class="p">):</span>
<span class="n">do_something</span><span class="p">()</span>
</pre></div>
</div>
<p>The context manager keeps a reference to the exception as
the &#8216;exception&#8217; attribute. This allows you to inspect the
exception after the assertion:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="n">SomeException</span><span class="p">)</span> <span class="k">as</span> <span class="n">cm</span><span class="p">:</span>
<span class="n">do_something</span><span class="p">()</span>
<span class="n">the_exception</span> <span class="o">=</span> <span class="n">cm</span><span class="o">.</span><span class="n">exception</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">the_exception</span><span class="o">.</span><span class="n">error_code</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertRaisesRegexp">
<code class="descname">assertRaisesRegexp</code><span class="sig-paren">(</span><em>expected_exception</em>, <em>expected_regexp</em>, <em>callable_obj=None</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertRaisesRegexp" title="Permalink to this definition"></a></dt>
<dd><p>Asserts that the message in a raised exception matches a regexp.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">expected_exception: Exception class expected to be raised.
expected_regexp: Regexp (re pattern object or string) expected</p>
<blockquote>
<div>to be found in error message.</div></blockquote>
<p class="last">callable_obj: Function to be called.
args: Extra args.
kwargs: Extra kwargs.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertRegexpMatches">
<code class="descname">assertRegexpMatches</code><span class="sig-paren">(</span><em>text</em>, <em>expected_regexp</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertRegexpMatches" title="Permalink to this definition"></a></dt>
<dd><p>Fail the test unless the text matches the regular expression.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertSequenceEqual">
<code class="descname">assertSequenceEqual</code><span class="sig-paren">(</span><em>seq1</em>, <em>seq2</em>, <em>msg=None</em>, <em>seq_type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertSequenceEqual" title="Permalink to this definition"></a></dt>
<dd><p>An equality assertion for ordered sequences (like lists and tuples).</p>
<p>For the purposes of this function, a valid ordered sequence type is one
which can be indexed, has a length, and has an equality operator.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">seq1: The first sequence to compare.
seq2: The second sequence to compare.
seq_type: The expected datatype of the sequences, or None if no</p>
<blockquote>
<div>datatype should be enforced.</div></blockquote>
<dl class="last docutils">
<dt>msg: Optional message to use on failure instead of a list of</dt>
<dd>differences.</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertSetEqual">
<code class="descname">assertSetEqual</code><span class="sig-paren">(</span><em>set1</em>, <em>set2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertSetEqual" title="Permalink to this definition"></a></dt>
<dd><p>A set-specific equality assertion.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">set1: The first set to compare.
set2: The second set to compare.
msg: Optional message to use on failure instead of a list of</p>
<blockquote class="last">
<div>differences.</div></blockquote>
</dd>
</dl>
<p>assertSetEqual uses ducktyping to support different types of sets, and
is optimized for sets specifically (parameters must support a
difference method).</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertTrue">
<code class="descname">assertTrue</code><span class="sig-paren">(</span><em>expr</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertTrue" title="Permalink to this definition"></a></dt>
<dd><p>Check that the expression is true.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assertTupleEqual">
<code class="descname">assertTupleEqual</code><span class="sig-paren">(</span><em>tuple1</em>, <em>tuple2</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assertTupleEqual" title="Permalink to this definition"></a></dt>
<dd><p>A tuple-specific equality assertion.</p>
<dl class="docutils">
<dt>Args:</dt>
<dd><p class="first">tuple1: The first tuple to compare.
tuple2: The second tuple to compare.
msg: Optional message to use on failure instead of a list of</p>
<blockquote class="last">
<div>differences.</div></blockquote>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.assert_">
<code class="descname">assert_</code><span class="sig-paren">(</span><em>expr</em>, <em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.assert_" title="Permalink to this definition"></a></dt>
<dd><p>Check that the expression is true.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.countTestCases">
<code class="descname">countTestCases</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.countTestCases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.debug">
<code class="descname">debug</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.debug" title="Permalink to this definition"></a></dt>
<dd><p>Run the test without collecting errors in a TestResult</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.defaultTestResult">
<code class="descname">defaultTestResult</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.defaultTestResult" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.doCleanups">
<code class="descname">doCleanups</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.doCleanups" title="Permalink to this definition"></a></dt>
<dd><p>Execute all cleanup functions. Normally called for you after
tearDown.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.fail">
<code class="descname">fail</code><span class="sig-paren">(</span><em>msg=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.fail" title="Permalink to this definition"></a></dt>
<dd><p>Fail immediately, with the given message.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.failIf">
<code class="descname">failIf</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.failIf" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.failIfAlmostEqual">
<code class="descname">failIfAlmostEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.failIfAlmostEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.failIfEqual">
<code class="descname">failIfEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.failIfEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.failUnless">
<code class="descname">failUnless</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.failUnless" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.failUnlessAlmostEqual">
<code class="descname">failUnlessAlmostEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.failUnlessAlmostEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.failUnlessEqual">
<code class="descname">failUnlessEqual</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.failUnlessEqual" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.failUnlessRaises">
<code class="descname">failUnlessRaises</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.failUnlessRaises" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.failureException">
<code class="descname">failureException</code><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.failureException" title="Permalink to this definition"></a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal"><span class="pre">AssertionError</span></code></p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.id">
<code class="descname">id</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.id" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.longMessage">
<code class="descname">longMessage</code><em class="property"> = False</em><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.longMessage" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.maxDiff">
<code class="descname">maxDiff</code><em class="property"> = 640</em><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.maxDiff" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.run">
<code class="descname">run</code><span class="sig-paren">(</span><em>result=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.run" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.setUp">
<code class="descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.setUp" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for setting up the test fixture before exercising it.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.setUpClass">
<code class="descname">setUpClass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.setUpClass" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for setting up class fixture before running tests in the class.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.shortDescription">
<code class="descname">shortDescription</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.shortDescription" title="Permalink to this definition"></a></dt>
<dd><p>Returns a one-line description of the test, or None if no
description has been provided.</p>
<p>The default implementation of this method returns the first line of
the specified test method&#8217;s docstring.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.skipTest">
<code class="descname">skipTest</code><span class="sig-paren">(</span><em>reason</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.skipTest" title="Permalink to this definition"></a></dt>
<dd><p>Skip this test.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.tearDown">
<code class="descname">tearDown</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.tearDown" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for deconstructing the test fixture after testing it.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.tearDownClass">
<code class="descname">tearDownClass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.tearDownClass" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for deconstructing the class fixture after running all tests in the class.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.test_CAPDU">
<code class="descname">test_CAPDU</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.test_CAPDU" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.tests.utils_test.TestUtils.test_RAPDU">
<code class="descname">test_RAPDU</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.tests.utils_test.TestUtils.test_RAPDU" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,498 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>utils Module &mdash; vsmartcard 2016-10-10 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootswatch-3.3.4/flatly/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2016-10-10',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="../../_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2016-10-10 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="prev" title="VirtualSmartcard Module" href="virtualsmartcard.VirtualSmartcard.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
id="gh-banner"
style="position: absolute; top: 50px; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"
alt="Fork me on GitHub"></a>
<script>
// Adjust banner height.
$(function () {
var navHeight = $(".navbar .container").css("height");
$("#gh-banner").css("top", navHeight);
});
</script>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../index.html">
vsmartcard</a>
<span class="navbar-text navbar-version pull-left"><b></b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="../../index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">Virtual Smart Card</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../remote-reader/README.html">Remote Smart Card Reader</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ACardEmulator/README.html">Android Smart Card Emulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../pcsc-relay/README.html">PC/SC Relay</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../npa/README.html">nPA Smart Card Library</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">utils Module</a></li>
</ul>
</ul>
</li>
<li>
<a href="virtualsmartcard.VirtualSmartcard.html" title="Previous Chapter: VirtualSmartcard Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; VirtualSmartcard...</span>
</a>
</li>
<li class="hidden-sm"></li>
</ul>
<form class="navbar-form navbar-right" action="../../search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12 content">
<div class="section" id="utils-module">
<h1>utils Module<a class="headerlink" href="#utils-module" title="Permalink to this headline"></a></h1>
<p class="graphviz">
<img src="../../_images/inheritance-647e4e3af2eb4356e4633a015c7851f55a66a0bd.png" alt="Inheritance diagram of virtualsmartcard.utils" usemap="#inheritance305ec42f0e" class="inheritance"/>
<map id="inheritance305ec42f0e" name="inheritance305ec42f0e">
<area shape="rect" id="node1" href="#virtualsmartcard.utils.APDU" title="Base class for an APDU" alt="" coords="5,31,204,56"/>
<area shape="rect" id="node2" href="#virtualsmartcard.utils.C_APDU" title="Class for a command APDU" alt="" coords="252,5,467,31"/>
<area shape="rect" id="node3" href="#virtualsmartcard.utils.R_APDU" title="Class for a response APDU" alt="" coords="252,55,467,80"/>
</map>
</p>
<span class="target" id="module-virtualsmartcard.utils"></span><dl class="class">
<dt id="virtualsmartcard.utils.APDU">
<em class="property">class </em><code class="descclassname">virtualsmartcard.utils.</code><code class="descname">APDU</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.APDU" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Base class for an APDU</p>
<dl class="method">
<dt id="virtualsmartcard.utils.APDU._deldata">
<code class="descname">_deldata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.APDU._deldata" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.APDU._format_parts">
<code class="descname">_format_parts</code><span class="sig-paren">(</span><em>fields</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.APDU._format_parts" title="Permalink to this definition"></a></dt>
<dd><p>utility function to be used in __str__ and __repr__</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.APDU._getdata">
<code class="descname">_getdata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.APDU._getdata" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.APDU._setbyte">
<code class="descname">_setbyte</code><span class="sig-paren">(</span><em>name</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.APDU._setbyte" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.APDU._setdata">
<code class="descname">_setdata</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.APDU._setdata" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.APDU.data">
<code class="descname">data</code><a class="headerlink" href="#virtualsmartcard.utils.APDU.data" title="Permalink to this definition"></a></dt>
<dd><p>The data contents of this APDU</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="virtualsmartcard.utils.C_APDU">
<em class="property">class </em><code class="descclassname">virtualsmartcard.utils.</code><code class="descname">C_APDU</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#virtualsmartcard.utils.APDU" title="virtualsmartcard.utils.APDU"><code class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.utils.APDU</span></code></a></p>
<p>Class for a command APDU</p>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.CLA">
<code class="descname">CLA</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.CLA" title="Permalink to this definition"></a></dt>
<dd><p>The CLA attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.INS">
<code class="descname">INS</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.INS" title="Permalink to this definition"></a></dt>
<dd><p>The INS attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.Lc">
<code class="descname">Lc</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.Lc" title="Permalink to this definition"></a></dt>
<dd><p>The Lc attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.Le">
<code class="descname">Le</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.Le" title="Permalink to this definition"></a></dt>
<dd><p>The Le attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.P1">
<code class="descname">P1</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.P1" title="Permalink to this definition"></a></dt>
<dd><p>The P1 attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.P2">
<code class="descname">P2</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.P2" title="Permalink to this definition"></a></dt>
<dd><p>The P2 attribute of the APDU</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.C_APDU._deldata">
<code class="descname">_deldata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._deldata" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.C_APDU._format_fields">
<code class="descname">_format_fields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._format_fields" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.C_APDU._format_parts">
<code class="descname">_format_parts</code><span class="sig-paren">(</span><em>fields</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._format_parts" title="Permalink to this definition"></a></dt>
<dd><p>utility function to be used in __str__ and __repr__</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.C_APDU._getdata">
<code class="descname">_getdata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._getdata" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.C_APDU._setbyte">
<code class="descname">_setbyte</code><span class="sig-paren">(</span><em>name</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._setbyte" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.C_APDU._setdata">
<code class="descname">_setdata</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._setdata" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.C_APDU.case">
<code class="descname">case</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.case" title="Permalink to this definition"></a></dt>
<dd><p>Return 1, 2, 3 or 4, depending on which ISO case we represent.</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.cla">
<code class="descname">cla</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.cla" title="Permalink to this definition"></a></dt>
<dd><p>The CLA attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.data">
<code class="descname">data</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.data" title="Permalink to this definition"></a></dt>
<dd><p>The data contents of this APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.effective_Le">
<code class="descname">effective_Le</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.effective_Le" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.ins">
<code class="descname">ins</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.ins" title="Permalink to this definition"></a></dt>
<dd><p>The INS attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.lc">
<code class="descname">lc</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.lc" title="Permalink to this definition"></a></dt>
<dd><p>The Lc attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.le">
<code class="descname">le</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.le" title="Permalink to this definition"></a></dt>
<dd><p>The Le attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.p1">
<code class="descname">p1</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.p1" title="Permalink to this definition"></a></dt>
<dd><p>The P1 attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.C_APDU.p2">
<code class="descname">p2</code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.p2" title="Permalink to this definition"></a></dt>
<dd><p>The P2 attribute of the APDU</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.C_APDU.parse">
<code class="descname">parse</code><span class="sig-paren">(</span><em>apdu</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.parse" title="Permalink to this definition"></a></dt>
<dd><p>Parse a full command APDU and assign the values to our object,
overwriting whatever there was.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.C_APDU.render">
<code class="descname">render</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.render" title="Permalink to this definition"></a></dt>
<dd><p>Return this APDU as a binary string</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="virtualsmartcard.utils.R_APDU">
<em class="property">class </em><code class="descclassname">virtualsmartcard.utils.</code><code class="descname">R_APDU</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#virtualsmartcard.utils.APDU" title="virtualsmartcard.utils.APDU"><code class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.utils.APDU</span></code></a></p>
<p>Class for a response APDU</p>
<dl class="attribute">
<dt id="virtualsmartcard.utils.R_APDU.SW">
<code class="descname">SW</code><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.SW" title="Permalink to this definition"></a></dt>
<dd><p>The Status Word of this response APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.R_APDU.SW1">
<code class="descname">SW1</code><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.SW1" title="Permalink to this definition"></a></dt>
<dd><p>The SW1 attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.R_APDU.SW2">
<code class="descname">SW2</code><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.SW2" title="Permalink to this definition"></a></dt>
<dd><p>The SW2 attribute of the APDU</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU._deldata">
<code class="descname">_deldata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._deldata" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU._format_fields">
<code class="descname">_format_fields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._format_fields" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU._format_parts">
<code class="descname">_format_parts</code><span class="sig-paren">(</span><em>fields</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._format_parts" title="Permalink to this definition"></a></dt>
<dd><p>utility function to be used in __str__ and __repr__</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU._getdata">
<code class="descname">_getdata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._getdata" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU._getsw">
<code class="descname">_getsw</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._getsw" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU._setbyte">
<code class="descname">_setbyte</code><span class="sig-paren">(</span><em>name</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._setbyte" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU._setdata">
<code class="descname">_setdata</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._setdata" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU._setsw">
<code class="descname">_setsw</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._setsw" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.R_APDU.data">
<code class="descname">data</code><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.data" title="Permalink to this definition"></a></dt>
<dd><p>The data contents of this APDU</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU.parse">
<code class="descname">parse</code><span class="sig-paren">(</span><em>apdu</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.parse" title="Permalink to this definition"></a></dt>
<dd><p>Parse a full response APDU and assign the values to our object,
overwriting whatever there was.</p>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.utils.R_APDU.render">
<code class="descname">render</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.render" title="Permalink to this definition"></a></dt>
<dd><p>Return this APDU as a binary string</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.R_APDU.sw">
<code class="descname">sw</code><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.sw" title="Permalink to this definition"></a></dt>
<dd><p>The Status Word of this response APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.R_APDU.sw1">
<code class="descname">sw1</code><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.sw1" title="Permalink to this definition"></a></dt>
<dd><p>The SW1 attribute of the APDU</p>
</dd></dl>
<dl class="attribute">
<dt id="virtualsmartcard.utils.R_APDU.sw2">
<code class="descname">sw2</code><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.sw2" title="Permalink to this definition"></a></dt>
<dd><p>The SW2 attribute of the APDU</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.utils._make_byte_property">
<code class="descclassname">virtualsmartcard.utils.</code><code class="descname">_make_byte_property</code><span class="sig-paren">(</span><em>prop</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils._make_byte_property" title="Permalink to this definition"></a></dt>
<dd><p>Make a byte property(). This is meta code.</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.utils._unformat_hexdump">
<code class="descclassname">virtualsmartcard.utils.</code><code class="descname">_unformat_hexdump</code><span class="sig-paren">(</span><em>dump</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils._unformat_hexdump" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.utils.hexdump">
<code class="descclassname">virtualsmartcard.utils.</code><code class="descname">hexdump</code><span class="sig-paren">(</span><em>data</em>, <em>indent=0</em>, <em>short=False</em>, <em>linelen=16</em>, <em>offset=0</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.hexdump" title="Permalink to this definition"></a></dt>
<dd><p>Generates a nice hexdump of data and returns it. Consecutive lines will
be indented with indent spaces. When short is true, will instead generate
hexdump without adresses and on one line.</p>
<p>Examples:
hexdump(&#8216;A&#8217;) -&gt; &#8216;0000: 00 41 .A &#8216;
hexdump(&#8216;A&#8217;, short=True) -&gt; &#8216;00 41 (.A)&#8217;</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.utils.inttostring">
<code class="descclassname">virtualsmartcard.utils.</code><code class="descname">inttostring</code><span class="sig-paren">(</span><em>i</em>, <em>length=None</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.inttostring" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="virtualsmartcard.utils.parse_status">
<code class="descclassname">virtualsmartcard.utils.</code><code class="descname">parse_status</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.parse_status" title="Permalink to this definition"></a></dt>
<dd><p>Parses the Response APDU of a GetStatus command.</p>
</dd></dl>
<dl class="function">
<dt id="virtualsmartcard.utils.stringtoint">
<code class="descclassname">virtualsmartcard.utils.</code><code class="descname">stringtoint</code><span class="sig-paren">(</span><em>str</em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.stringtoint" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2009-2016 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>