regenerated documentation

This commit is contained in:
Frank Morgner
2021-04-28 02:13:40 +02:00
parent 29a818c69a
commit 27b3dfb62b
216 changed files with 26154 additions and 24712 deletions

View File

@@ -1,35 +1,23 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Virtual Smart Card &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Virtual Smart Card &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/js/jquery-1.11.0.min.js"></script>
<script src="../_static/js/jquery-fix.js"></script>
<script src="../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 documentation" href="../index.html" />
<link rel="search" title="Search" href="../search.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'>
@@ -37,8 +25,7 @@
<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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -82,7 +69,7 @@
<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 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="../TCardEmulator/README.html">Tizen Smart Card Emulator</a></li>
@@ -132,11 +119,11 @@
<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 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 th...</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 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 ... &raquo;</span>
</a>
</li>
@@ -169,105 +156,73 @@
<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">Smart card emulator written in Python</p>
<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">License:</th><td class="field-body"><p class="first">GPL version 3</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name" colspan="2">Tested Platforms:</th></tr>
<tr class="field-even field"><td>&nbsp;</td><td class="field-body"><ul class="first last simple">
<li>Windows</li>
<li>macOS</li>
<li>Linux (Debian, Ubuntu, OpenMoko)</li>
<p class="sidebar-title">Smart card emulator written in Python</p>
<dl class="field-list simple">
<dt class="field-odd">License</dt>
<dd class="field-odd"><p>GPL version 3</p>
</dd>
<dt class="field-even">Tested Platforms</dt>
<dd class="field-even"><ul class="simple">
<li><p>Windows</p></li>
<li><p>macOS</p></li>
<li><p>Linux (Debian, Ubuntu, OpenMoko)</p></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</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>
<li><p>Generic ISO-7816 smart card including secure messaging</p></li>
<li><p>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>)</p></li>
<li><p>Electronic passport (ePass/MRTD) with support for <abbr title="Basic Access Control">BAC</abbr></p></li>
<li><p>Cryptoflex smart card (incomplete)</p></li>
</ul>
<p>The <abbr title="virtual smart card reader">vpcd</abbr> is a smart card reader driver for <a class="reference external" href="https://pcsclite.apdu.fr/">PCSC-Lite</a> <a class="footnote-reference" href="#id3" id="id4">[2]</a> and the windows smart
<p>The <abbr title="virtual smart card reader">vpcd</abbr> is a smart card reader driver for <a class="reference external" href="https://pcsclite.apdu.fr/">PCSC-Lite</a> <a class="footnote-reference brackets" href="#id5" id="id6">2</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
<abbr title="virtual smart card">vpicc</abbr>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"><em>PC/SC Relay</em></a> to make it accessible to an external contact-less smart card
<a class="reference internal" href="../pcsc-relay/README.html#pcsc-relay"><span class="std std-ref">PC/SC Relay</span></a> to make it accessible to an external contact-less smart card
reader.</p>
<p>The file <tt class="file docutils literal"><span class="pre">utils.py</span></tt> 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="#id1" id="id2">[1]</a>.</p>
<div class="figure">
<p><img src="../_images/tikz-b5a668553fb9bf21fb5abcc4cae46289d11490d1.svg" alt="\input{$wd/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/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
<p>The file <code class="file docutils literal notranslate"><span class="pre">utils.py</span></code> was taken from Henryk Plötzs <a class="reference external" href="https://github.com/henryk/cyberflex-shell">cyberflex-shell</a> <a class="footnote-reference brackets" href="#id3" id="id4">1</a>.</p>
<div class="figure" id="id1" style="text-align: center">
<p><img src="../_images/tikz-b5a668553fb9bf21fb5abcc4cae46289d11490d1.svg" alt="Figure made with TikZ" /></p>
<p class="caption"><span class="caption-text">Virtual Smart Card used with PCSC-Lite or WinSCard</span></p>
</div><div class="versionadded">
<p><span class="versionmodified added">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 <tt class="docutils literal"><span class="pre">libpcsclite</span></tt> which can lead to
implementation acts as replacement for <code class="docutils literal notranslate"><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-c523bba45f9fcaa801dd4f6284c7efa1f320c9b1.svg" alt="\input{$wd/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/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
<div class="figure" id="id2" style="text-align: center">
<p><img src="../_images/tikz-c523bba45f9fcaa801dd4f6284c7efa1f320c9b1.svg" alt="Figure made with TikZ" /></p>
<p class="caption"><span class="caption-text">Virtual Smart Card used with its own PC/SC implementation</span></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"><em>Remote Smart Card Reader</em></a>) can connect as <abbr title="virtual smart card">vpicc</abbr> delegating all requests and
(e.g. <a class="reference internal" href="../remote-reader/README.html#remote-reader"><span class="std std-ref">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="#id5" id="id6">[3]</a></li>
<li><a class="reference external" href="http://pyscard.sourceforge.net/">pyscard</a> <a class="footnote-reference" href="#id7" id="id8">[4]</a> (relaying a local smart card with <em class="xref std std-option">--type=relay</em>)</li>
<li><a class="reference external" href="http://pycrypto.org/">PyCrypto</a> <a class="footnote-reference" href="#id9" id="id10">[5]</a>, <a class="reference external" href="https://www.dlitz.net/software/python-pbkdf2/">PBKDF2</a> <a class="footnote-reference" href="#id11" id="id12">[6]</a>, <a class="reference external" href="http://www.pythonware.com/products/pil/">PIL</a> <a class="footnote-reference" href="#id17" id="id18">[9]</a>, <a class="reference external" href="https://docs.python.org/3.3/library/readline.html">readline</a> <a class="footnote-reference" href="#id13" id="id14">[7]</a> or <a class="reference external" href="https://pypi.python.org/pypi/pyreadline">PyReadline</a> <a class="footnote-reference" href="#id15" id="id16">[8]</a> (emulation of electronic
passport with <em class="xref std std-option">--type=ePass</em>)</li>
<li><a class="reference external" href="https://github.com/frankmorgner/openpace">OpenPACE</a> <a class="footnote-reference" href="#id19" id="id20">[10]</a> (emulation of German identity card with <em class="xref std std-option">--type=nPA</em>)</li>
<li><a class="reference external" href="https://fukuchi.org/works/qrencode/">libqrencode</a> <a class="footnote-reference" href="#id21" id="id22">[11]</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>
<li><p><a class="reference external" href="http://www.python.org/">Python</a> <a class="footnote-reference brackets" href="#id7" id="id8">3</a></p></li>
<li><p><a class="reference external" href="http://pyscard.sourceforge.net/">pyscard</a> <a class="footnote-reference brackets" href="#id9" id="id10">4</a> (relaying a local smart card with <cite>type=relay</cite>)</p></li>
<li><p><a class="reference external" href="http://pycrypto.org/">PyCrypto</a> <a class="footnote-reference brackets" href="#id11" id="id12">5</a>, <a class="reference external" href="https://www.dlitz.net/software/python-pbkdf2/">PBKDF2</a> <a class="footnote-reference brackets" href="#id13" id="id14">6</a>, <a class="reference external" href="http://www.pythonware.com/products/pil/">PIL</a> <a class="footnote-reference brackets" href="#id19" id="id20">9</a>, <a class="reference external" href="https://docs.python.org/3.3/library/readline.html">readline</a> <a class="footnote-reference brackets" href="#id15" id="id16">7</a> or <a class="reference external" href="https://pypi.python.org/pypi/pyreadline">PyReadline</a> <a class="footnote-reference brackets" href="#id17" id="id18">8</a> (emulation of electronic
passport with <cite>type=ePass</cite>)</p></li>
<li><p><a class="reference external" href="https://github.com/frankmorgner/openpace">OpenPACE</a> <a class="footnote-reference brackets" href="#id21" id="id22">10</a> (emulation of German identity card with <cite>type=nPA</cite>)</p></li>
<li><p><a class="reference external" href="https://fukuchi.org/works/qrencode/">libqrencode</a> <a class="footnote-reference brackets" href="#id23" id="id24">11</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)</p></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
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/frankmorgner/vsmartcard.git
</pre></div>
</div>
</div>
@@ -276,16 +231,16 @@ still available on <a class="reference external" href="http://sourceforge.net/pr
<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 <tt class="file docutils literal"><span class="pre">INSTALL</span></tt>. If you can not find
it, you are probably working bleeding edge in the repository. Run the
following command in <tt class="file docutils literal"><span class="pre">virtualsmartcard</span></tt> to get the missing standard
auxiliary files:</p>
<div class="highlight-sh"><div class="highlight"><pre>autoreconf --verbose --install
unfamiliar with it, please have a look at <code class="file docutils literal notranslate"><span class="pre">INSTALL</span></code>. If you can not find
it, you are probably working bleeding edge in the repository. To generate the
missing standard auxiliary files you need to additionally install <cite>libtool</cite> and
<cite>pkg-config</cite> and run the following command in <code class="file docutils literal notranslate"><span class="pre">virtualsmartcard</span></code>:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>autoreconf --verbose --install
</pre></div>
</div>
<p>To configure (<strong class="command">configure &#8211;help</strong> lists possible options), build and
<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
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>./configure --sysconfdir<span class="o">=</span>/etc
make
make install
</pre></div>
@@ -294,13 +249,13 @@ make install
<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"><em>installation on Unix</em></a>.</p>
using the standard routine for <a class="reference internal" href="#vicc-install"><span class="std std-ref">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 <tt class="file docutils literal"><span class="pre">Ìnfo.plist</span></tt>:</p>
<div class="highlight-sh"><div class="highlight"><pre>./configure --prefix<span class="o">=</span>/ --enable-infoplist
card reader with an <code class="file docutils literal notranslate"><span class="pre">Info.plist</span></code>:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>./configure --enable-infoplist
make
make install
</pre></div>
@@ -309,93 +264,88 @@ make install
<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
<p><span class="versionmodified added">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 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="#id23" id="id24">[12]</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="https://msdn.microsoft.com/en-us/library/windows/hardware/ff557573">Windows Driver Kit 10 and Visual Studio 2015</a> <a class="footnote-reference" href="#id26" id="id27">[13]</a>. The vpcd
installer requires the <a class="reference external" href="https://wixtoolset.org/releases/v3.10/stable">WiX Toolset 3.10</a> <a class="footnote-reference" href="#id28" id="id29">[14]</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="#id30" id="id31">[15]</a>, you may directly jump to step 4.</p>
<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 Ottavis UMDF Driver for a
Virtual Smart Card Reader</a> <a class="footnote-reference brackets" href="#id25" id="id26">12</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="https://msdn.microsoft.com/en-us/library/windows/hardware/ff557573">Windows Driver Kit 10 and Visual Studio 2015</a> <a class="footnote-reference brackets" href="#id28" id="id29">13</a>. The vpcd
installer requires the <a class="reference external" href="https://wixtoolset.org/releases/v3.10/stable">WiX Toolset 3.10</a> <a class="footnote-reference brackets" href="#id30" id="id31">14</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 brackets" href="#id32" id="id33">15</a>, you may directly jump to step 4.</p>
<ol class="arabic">
<li><p class="first">Clone the git repository and make sure it is initialized with all
<li><p>Clone the git repository and make sure it is initialized with all
submodules:</p>
<div class="highlight-sh"><div class="highlight"><pre>git clone https://github.com/frankmorgner/vsmartcard.git
<span class="nb">cd </span>vsmartcard
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>git clone https://github.com/frankmorgner/vsmartcard.git
<span class="nb">cd</span> vsmartcard
git submodule update --init --recursive
</pre></div>
</div>
</li>
<li><p class="first">In Visual Studio open <abbr title="virtual smart card reader">vpcd</abbr>&#8216;s solution
<tt class="file docutils literal"><span class="pre">virtualsmartcard\win32\BixVReader.sln</span></tt> and ensure with the
<li><p>In Visual Studio open <abbr title="virtual smart card reader">vpcd</abbr>s solution
<code class="file docutils literal notranslate"><span class="pre">virtualsmartcard\win32\BixVReader.sln</span></code> and ensure with the
configuration manager, that the project is built for your platform (i.e.
<tt class="docutils literal"><span class="pre">x64</span></tt> or <tt class="docutils literal"><span class="pre">x82</span></tt>).</p>
</li>
<li><p class="first">If you can successfully <em class="guilabel">Build the solution</em>, you can find
the installer (<tt class="file docutils literal"><span class="pre">BixVReaderInstaller.msi</span></tt>) in
<tt class="file docutils literal"><span class="pre">virtualsmartcard\win32\BixVReaderInstaller\bin\*Release</span></tt></p>
</li>
<li><p class="first">To install <abbr title="virtual smart card reader">vpcd</abbr>, double click <tt class="file docutils literal"><span class="pre">BixVReaderInstaller.msi</span></tt>. Since we
<code class="docutils literal notranslate"><span class="pre">x64</span></code> or <code class="docutils literal notranslate"><span class="pre">x82</span></code>).</p></li>
<li><p>If you can successfully <span class="guilabel">Build the solution</span>, you can find
the installer (<code class="file docutils literal notranslate"><span class="pre">BixVReaderInstaller.msi</span></code>) in
<code class="file docutils literal notranslate"><span class="pre">virtualsmartcard\win32\BixVReaderInstaller\bin\*Release</span></code></p></li>
<li><p>To install <abbr title="virtual smart card reader">vpcd</abbr>, double click <code class="file docutils literal notranslate"><span class="pre">BixVReaderInstaller.msi</span></code>. Since we
are currently not signing the Installer, this will yield a warning about an
unverified driver software publisher on Windows 8 and later. Click
<em class="guilabel">Install this driver software anyway</em>.</p>
</li>
<span class="guilabel">Install this driver software anyway</span>.</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="#id23" id="id25">[12]</a> for details.</p>
<p>All of Fabio&#8217;s card connectors are still available, but inactive by default
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 Ottavis UMDF Driver for a Virtual Smart Card
Reader</a> <a class="footnote-reference brackets" href="#id25" id="id27">12</a> for details.</p>
<p>All of Fabios card connectors are still available, but inactive by default
(see <a class="reference internal" href="#configuring-vpcd-on-windows">Configuring vpcd on Windows</a> below).</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"><em>Creating a Virtual Smart Card</em></a>. Here
with a different card emulator are covered in <a class="reference internal" href="api.html#virtualsmartcard-api"><span class="std std-ref">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
<tt class="file docutils literal"><span class="pre">/etc/reader.conf.d/</span></tt>. 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
<code class="file docutils literal notranslate"><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>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>
like Attempting startup of Virtual PCD 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 <tt class="docutils literal"><span class="pre">CHANNELID</span></tt> and
<tt class="docutils literal"><span class="pre">DEVICENAME</span></tt>:</p>
<div class="highlight-sh"><div class="highlight"><pre>FRIENDLYNAME <span class="s2">&quot;Virtual PCD&quot;</span>
connections. The port to open should be specified in <code class="docutils literal notranslate"><span class="pre">CHANNELID</span></code> and
<code class="docutils literal notranslate"><span class="pre">DEVICENAME</span></code>:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>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 <tt class="docutils literal"><span class="pre">DEVICENAME</span></tt> is different from <tt class="docutils literal"><span class="pre">/dev/null</span></tt>, <abbr title="virtual smart card reader">vpcd</abbr>
<p>If the first part of the <code class="docutils literal notranslate"><span class="pre">DEVICENAME</span></code> is different from <code class="docutils literal notranslate"><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 <em class="xref std std-option">--reversed</em> in this case.</p>
needs to be started with <cite>reversed</cite> 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"><em>configuration on Unix</em></a>.</p>
using the standard routine for <a class="reference internal" href="#vicc-config"><span class="std std-ref">configuration on Unix</span></a>.</p>
<p>On Mac OS X 10.10 you should have configured the generation of
<tt class="file docutils literal"><span class="pre">Info.plist</span></tt> at compile time. Now do the following for registering <abbr title="virtual smart card reader">vpcd</abbr>
<code class="file docutils literal notranslate"><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
<li><p>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>Run the following command to get the devices product and vendor ID:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>system_profiler SPUSBDataType
</pre></div>
</div>
</li>
<li><p class="first">Change <tt class="file docutils literal"><span class="pre">/usr/libexec/SmartCardServices/drivers/ifd-vpcd.bundle/Info.plist</span></tt>
to match your product and vendor ID:</p>
</li>
<li><p>Change <code class="file docutils literal notranslate"><span class="pre">/usr/local/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;
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>&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;
@@ -442,69 +392,77 @@ to match your product and vendor ID:</p>
&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;string&gt;This driver is protected by terms of the GNU General Public License version <span class="m">3</span>, 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 <tt class="docutils literal"><span class="pre">ifdFriendlyName</span></tt> can be used in the same way as <tt class="docutils literal"><span class="pre">DEVICENAME</span></tt>
<a class="reference internal" href="#vicc-config"><em>described above</em></a>.</p>
<p>Note that <code class="docutils literal notranslate"><span class="pre">ifdFriendlyName</span></code> can be used in the same way as <code class="docutils literal notranslate"><span class="pre">DEVICENAME</span></code>
<a class="reference internal" href="#vicc-config"><span class="std std-ref">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
<li><p>Restart the PC/SC service:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo killall -SIGKILL -m <span class="s1">&#39;.*com.apple.ifdreader&#39;</span>
</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>
<p>To verify the installation, execute:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>system_profiler SPSmartCardsDataType
</pre></div>
</div>
<p>In case of a problem, inspect the logs:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>log show --predicate <span class="s1">&#39;(subsystem == &quot;com.apple.CryptoTokenKit&quot;)&#39;</span> --info --debug
</pre></div>
</div>
</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 <tt class="file docutils literal"><span class="pre">BixVReader.ini</span></tt> of <abbr title="virtual smart card reader">vpcd</abbr> is installed to
<tt class="file docutils literal"><span class="pre">C:\Windows</span></tt> (<span class="target" id="index-0"></span><tt class="xref std std-envvar docutils literal"><span class="pre">%SystemRoot%</span></tt>). The user mode device driver
<p>The configuration file <code class="file docutils literal notranslate"><span class="pre">BixVReader.ini</span></code> of <abbr title="virtual smart card reader">vpcd</abbr> is installed to
<code class="file docutils literal notranslate"><span class="pre">C:\Windows</span></code> (<span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal notranslate"><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 <em class="guilabel">Bix Virtual Smart Card Reader</em>.</p>
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 <tt class="docutils literal"><span class="pre">TCP_PORT</span></tt>:</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
to open should be specified in <code class="docutils literal notranslate"><span class="pre">TCP_PORT</span></code>:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="o">[</span>Driver<span class="o">]</span>
<span class="nv">NumReaders</span><span class="o">=</span><span class="m">3</span>
<span class="o">[</span>Reader0<span class="o">]</span>
<span class="nv">RPC_TYPE</span><span class="o">=</span>0
<span class="nv">RPC_TYPE</span><span class="o">=</span><span class="m">0</span>
<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 class="hll"><span class="nv">DECIVE_UNIT</span><span class="o">=</span><span class="m">0</span>
</span>
<span class="o">[</span>Reader1<span class="o">]</span>
<span class="nv">RPC_TYPE</span><span class="o">=</span>1
<span class="nv">RPC_TYPE</span><span class="o">=</span><span class="m">1</span>
<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="nv">DECIVE_UNIT</span><span class="o">=</span><span class="m">1</span>
<span class="o">[</span>Reader2<span class="o">]</span>
<span class="nv">RPC_TYPE</span><span class="o">=</span>2
<span class="nv">RPC_TYPE</span><span class="o">=</span><span class="m">2</span>
<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
<span class="nv">TCP_PORT</span><span class="o">=</span><span class="m">35963</span>
<span class="nv">DECIVE_UNIT</span><span class="o">=</span><span class="m">2</span>
</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 <em class="xref std std-option">--reversed</em>.</p>
<abbr title="virtual smart card">vpicc</abbr> running with <cite>reversed</cite>.</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="#id30" id="id32">[15]</a> of <abbr title="virtual smart card">vpicc</abbr> include OpenPACE. The other
<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 brackets" href="#id32" id="id34">15</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 <em class="xref std std-option">--help</em> gives an overview about the command line
<p>The <abbr title="virtual smart card">vpicc</abbr> option <cite>help</cite> 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]
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>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]
[--reader READER] [--mitm MITM] [--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]
@@ -530,6 +488,8 @@ optional arguments:
Relaying a local smart card (`--type=relay`):
--reader READER number of the reader containing the card to be relayed
(default: 0)
--mitm MITM relative path to a file containing a Man-in-the-Middle
class that is supposed to be used with the relay
Emulation of German identity card (`--type=nPA`):
--ef-cardaccess EF_CARDACCESS
@@ -569,16 +529,16 @@ 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 (<em class="xref std std-option">--hostname</em> and <em class="xref std std-option">--port</em>)
<p><span class="versionmodified added">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>s configuration. <abbr title="virtual smart card">vpicc</abbr>s options should be
chosen accordingly (<cite>hostname</cite> and <cite>port</cite>)
<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"><em>Remote Smart Card Reader</em></a>.</p>
<a class="reference internal" href="../remote-reader/README.html#remote-reader"><span class="std std-ref">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="#id33" id="id34">[16]</a> and PCSC-Lite&#8217;s smart card
<strong class="command">pcsc_scan</strong> for testing. In Virtual Smart Cards 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 brackets" href="#id35" id="id36">16</a> and PCSC-Lites smart card
reader driver tester.</p>
</div>
</div>
@@ -589,102 +549,56 @@ more than welcome! Please use our <a class="reference external" href="https://gi
</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="id1" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[1]</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="id3" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id4">[2]</a></td><td><a class="reference external" href="https://pcsclite.apdu.fr/">https://pcsclite.apdu.fr/</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">[3]</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="id7" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id8">[4]</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="id9" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id10">[5]</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="id11" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id12">[6]</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="id13" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id14">[7]</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="id15" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id16">[8]</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="id17" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id18">[9]</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="id19" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id20">[10]</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="id21" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id22">[11]</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="id23" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[12]</td><td><em>(<a class="fn-backref" href="#id24">1</a>, <a class="fn-backref" href="#id25">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="id26" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id27">[13]</a></td><td><a class="reference external" href="https://msdn.microsoft.com/en-us/library/windows/hardware/ff557573">https://msdn.microsoft.com/en-us/library/windows/hardware/ff557573</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">[14]</a></td><td><a class="reference external" href="https://wixtoolset.org/releases/v3.10/stable">https://wixtoolset.org/releases/v3.10/stable</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">[15]</td><td><em>(<a class="fn-backref" href="#id31">1</a>, <a class="fn-backref" href="#id32">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="id33" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id34">[16]</a></td><td><a class="reference external" href="https://github.com/frankmorgner/OpenSC">https://github.com/frankmorgner/OpenSC</a></td></tr>
</tbody>
</table>
<dl class="footnote brackets">
<dt class="label" id="id3"><span class="brackets"><a class="fn-backref" href="#id4">1</a></span></dt>
<dd><p><a class="reference external" href="https://github.com/henryk/cyberflex-shell">https://github.com/henryk/cyberflex-shell</a></p>
</dd>
<dt class="label" id="id5"><span class="brackets"><a class="fn-backref" href="#id6">2</a></span></dt>
<dd><p><a class="reference external" href="https://pcsclite.apdu.fr/">https://pcsclite.apdu.fr/</a></p>
</dd>
<dt class="label" id="id7"><span class="brackets"><a class="fn-backref" href="#id8">3</a></span></dt>
<dd><p><a class="reference external" href="http://www.python.org/">http://www.python.org/</a></p>
</dd>
<dt class="label" id="id9"><span class="brackets"><a class="fn-backref" href="#id10">4</a></span></dt>
<dd><p><a class="reference external" href="http://pyscard.sourceforge.net/">http://pyscard.sourceforge.net/</a></p>
</dd>
<dt class="label" id="id11"><span class="brackets"><a class="fn-backref" href="#id12">5</a></span></dt>
<dd><p><a class="reference external" href="http://pycrypto.org/">http://pycrypto.org/</a></p>
</dd>
<dt class="label" id="id13"><span class="brackets"><a class="fn-backref" href="#id14">6</a></span></dt>
<dd><p><a class="reference external" href="https://www.dlitz.net/software/python-pbkdf2/">https://www.dlitz.net/software/python-pbkdf2/</a></p>
</dd>
<dt class="label" id="id15"><span class="brackets"><a class="fn-backref" href="#id16">7</a></span></dt>
<dd><p><a class="reference external" href="https://docs.python.org/3.3/library/readline.html">https://docs.python.org/3.3/library/readline.html</a></p>
</dd>
<dt class="label" id="id17"><span class="brackets"><a class="fn-backref" href="#id18">8</a></span></dt>
<dd><p><a class="reference external" href="https://pypi.python.org/pypi/pyreadline">https://pypi.python.org/pypi/pyreadline</a></p>
</dd>
<dt class="label" id="id19"><span class="brackets"><a class="fn-backref" href="#id20">9</a></span></dt>
<dd><p><a class="reference external" href="http://www.pythonware.com/products/pil/">http://www.pythonware.com/products/pil/</a></p>
</dd>
<dt class="label" id="id21"><span class="brackets"><a class="fn-backref" href="#id22">10</a></span></dt>
<dd><p><a class="reference external" href="https://github.com/frankmorgner/openpace">https://github.com/frankmorgner/openpace</a></p>
</dd>
<dt class="label" id="id23"><span class="brackets"><a class="fn-backref" href="#id24">11</a></span></dt>
<dd><p><a class="reference external" href="https://fukuchi.org/works/qrencode/">https://fukuchi.org/works/qrencode/</a></p>
</dd>
<dt class="label" id="id25"><span class="brackets">12</span><span class="fn-backref">(<a href="#id26">1</a>,<a href="#id27">2</a>)</span></dt>
<dd><p><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></p>
</dd>
<dt class="label" id="id28"><span class="brackets"><a class="fn-backref" href="#id29">13</a></span></dt>
<dd><p><a class="reference external" href="https://msdn.microsoft.com/en-us/library/windows/hardware/ff557573">https://msdn.microsoft.com/en-us/library/windows/hardware/ff557573</a></p>
</dd>
<dt class="label" id="id30"><span class="brackets"><a class="fn-backref" href="#id31">14</a></span></dt>
<dd><p><a class="reference external" href="https://wixtoolset.org/releases/v3.10/stable">https://wixtoolset.org/releases/v3.10/stable</a></p>
</dd>
<dt class="label" id="id32"><span class="brackets">15</span><span class="fn-backref">(<a href="#id33">1</a>,<a href="#id34">2</a>)</span></dt>
<dd><p><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></p>
</dd>
<dt class="label" id="id35"><span class="brackets"><a class="fn-backref" href="#id36">16</a></span></dt>
<dd><p><a class="reference external" href="https://github.com/frankmorgner/OpenSC">https://github.com/frankmorgner/OpenSC</a></p>
</dd>
</dl>
</div>
</div>
@@ -700,9 +614,9 @@ more than welcome! Please use our <a class="reference external" href="https://gi
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>
</html>

View File

@@ -1,44 +1,30 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Creating a Virtual Smart Card &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Creating a Virtual Smart Card &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/js/jquery-1.11.0.min.js"></script>
<script src="../_static/js/jquery-fix.js"></script>
<script src="../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 documentation" href="../index.html" />
<link rel="next" title="virtualsmartcard Package" href="api/virtualsmartcard.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="prev" title="USB CCID Emulator" href="../ccid/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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,7 +76,7 @@
<li class="toctree-l1"><a class="reference internal" href="../ccid/README.html">USB CCID Emulator</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="">Creating a Virtual Smart Card</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -105,7 +91,6 @@
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>
@@ -122,11 +107,7 @@
<li>
<a href="../ccid/README.html" title="Previous Chapter: USB CCID Emulator"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; USB CCID Emulato...</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 href="../ccid/README.html" title="Previous Chapter: USB CCID Emulator"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">&laquo; USB CCID Emulator</span>
</a>
</li>
@@ -158,278 +139,243 @@
<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 <tt class="docutils literal"><span class="pre">0x8C7B</span></tt>
(configurably via <tt class="file docutils literal"><span class="pre">/etc/reader.conf.d/vpcd</span></tt>). So you can connect
<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 notranslate"><span class="pre">0x8C7B</span></code>
(configurably via <code class="file docutils literal notranslate"><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">
<table class="docutils align-default" id="vpcd-commands">
<colgroup>
<col width="22%" />
<col width="34%" />
<col width="22%" />
<col width="22%" />
<col style="width: 22%" />
<col style="width: 34%" />
<col style="width: 22%" />
<col style="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>
<thead>
<tr class="row-odd"><th class="head" colspan="2"><p><abbr title="virtual smart card reader">vpcd</abbr></p></th>
<th class="head" colspan="2"><p><abbr title="virtual smart card">vpicc</abbr></p></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 class="row-even"><th class="head"><p>Length</p></th>
<th class="head"><p>Command</p></th>
<th class="head"><p>Length</p></th>
<th class="head"><p>Response</p></th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">0x00</span> <span class="pre">0x01</span></tt></td>
<td><tt class="docutils literal"><span class="pre">0x00</span></tt> (Power Off)</td>
<td>&nbsp;</td>
<td>(No Response)</td>
<tbody>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">0x00</span> <span class="pre">0x01</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x00</span></code> (Power Off)</p></td>
<td></td>
<td><p>(No Response)</p></td>
</tr>
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">0x00</span> <span class="pre">0x01</span></tt></td>
<td><tt class="docutils literal"><span class="pre">0x01</span></tt> (Power On)</td>
<td>&nbsp;</td>
<td>(No Response)</td>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">0x00</span> <span class="pre">0x01</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x01</span></code> (Power On)</p></td>
<td></td>
<td><p>(No Response)</p></td>
</tr>
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">0x00</span> <span class="pre">0x01</span></tt></td>
<td><tt class="docutils literal"><span class="pre">0x02</span></tt> (Reset)</td>
<td>&nbsp;</td>
<td>(No Response)</td>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">0x00</span> <span class="pre">0x01</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x02</span></code> (Reset)</p></td>
<td></td>
<td><p>(No Response)</p></td>
</tr>
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">0x00</span> <span class="pre">0x01</span></tt></td>
<td><tt class="docutils literal"><span class="pre">0x04</span></tt> (Get ATR)</td>
<td><tt class="docutils literal"><span class="pre">0xXX</span> <span class="pre">0xXX</span></tt></td>
<td>(ATR)</td>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">0x00</span> <span class="pre">0x01</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0x04</span></code> (Get ATR)</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0xXX</span> <span class="pre">0xXX</span></code></p></td>
<td><p>(ATR)</p></td>
</tr>
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">0xXX</span> <span class="pre">0xXX</span></tt></td>
<td>(APDU)</td>
<td><tt class="docutils literal"><span class="pre">0xXX</span> <span class="pre">0xXX</span></tt></td>
<td>(R-APDU)</td>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">0xXX</span> <span class="pre">0xXX</span></code></p></td>
<td><p>(APDU)</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0xXX</span> <span class="pre">0xXX</span></code></p></td>
<td><p>(R-APDU)</p></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
<p>Lets 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>
hook into. Here we only want to give an overview to the design.</p>
<p>Back to the cryptoflex example.
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.VirtualICC" title="virtualsmartcard.VirtualSmartcard.VirtualICC"><tt class="xref py py-class docutils literal"><span class="pre">VirtualICC</span></tt></a> provides the connection
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.VirtualICC" title="virtualsmartcard.VirtualSmartcard.VirtualICC"><code class="xref py py-class docutils literal notranslate"><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"><tt class="xref py py-class docutils literal"><span class="pre">VirtualICC</span></tt></a> an <abbr title="Application Protocol Data Unit">APDU</abbr>
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 notranslate"><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"><tt class="xref py py-class docutils literal"><span class="pre">VirtualICC</span></tt></a> to recognize a new type
<tt class="docutils literal"><span class="pre">&quot;cryptoflex&quot;</span></tt> and to load
<a class="reference internal" href="api/virtualsmartcard.cards.cryptoflex.html#virtualsmartcard.cards.cryptoflex.CryptoflexOS" title="virtualsmartcard.cards.cryptoflex.CryptoflexOS"><tt class="xref py py-class docutils literal"><span class="pre">CryptoflexOS</span></tt></a>. The
<a class="reference internal" href="api/virtualsmartcard.CardGenerator.html#module-virtualsmartcard.CardGenerator" title="virtualsmartcard.CardGenerator"><tt class="xref py py-class docutils literal"><span class="pre">CardGenerator</span></tt></a> is used to create a file system and a
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.VirtualICC" title="virtualsmartcard.VirtualSmartcard.VirtualICC"><code class="xref py py-class docutils literal notranslate"><span class="pre">VirtualICC</span></code></a> to recognize a new type
<code class="docutils literal notranslate"><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 notranslate"><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 notranslate"><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>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></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">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="kc">None</span><span class="p">,</span> <span class="n">mitmPath</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ef_cardsecurity</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ef_cardaccess</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">ca_key</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">cvca</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">disable_checks</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">esign_key</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">esign_ca_cert</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">esign_cert</span><span class="o">=</span><span class="kc">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="kn">from</span> <span class="nn">os.path</span> <span class="k">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="nb">format</span><span class="o">=</span><span class="s2">&quot;</span><span class="si">%(asctime)s</span><span class="s2"> [</span><span class="si">%(levelname)s</span><span class="s2">] </span><span class="si">%(message)s</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="n">datefmt</span><span class="o">=</span><span class="s2">&quot;</span><span class="si">%d</span><span class="s2">.%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="c1"># 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="kc">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">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Reading Data Groups from file </span><span class="si">%s</span><span class="s2">.&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="c1"># 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="s2">&quot;iso7816&quot;</span> <span class="ow">or</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s2">&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="k">elif</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s2">&quot;nPA&quot;</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">virtualsmartcard.cards.nPA</span> <span class="k">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="k">elif</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s2">&quot;cryptoflex&quot;</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">virtualsmartcard.cards.cryptoflex</span> <span class="k">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><span class="hll"> <span class="k">elif</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s2">&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="k">import</span> <span class="n">RelayOS</span>
</span> <span class="kn">from</span> <span class="nn">virtualsmartcard.cards.RelayMiddleman</span> <span class="k">import</span> <span class="n">RelayMiddleman</span>
<span class="n">mitm</span> <span class="o">=</span> <span class="n">loadMitMFromPath</span><span class="p">(</span><span class="n">mitmPath</span><span class="p">)</span> <span class="k">if</span> <span class="n">mitmPath</span> <span class="k">else</span> <span class="n">RelayMiddleman</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">RelayOS</span><span class="p">(</span><span class="n">readernum</span><span class="p">,</span><span class="n">mitm</span><span class="o">=</span><span class="n">mitm</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">card_type</span> <span class="o">==</span> <span class="s2">&quot;handler_test&quot;</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">virtualsmartcard.cards.HandlerTest</span> <span class="k">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="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">&quot;Unknown cardtype </span><span class="si">%s</span><span class="s2">. Will use standard card_type </span><span class="se">\</span>
<span class="s2"> (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="s2">&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="c1"># 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="c1"># 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="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="kc">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="kc">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">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Failed to open socket: </span><span class="si">%s</span><span class="s2">&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="s2">&quot;Is pcscd running at </span><span class="si">%s</span><span class="s2">? Is vpcd loaded? Is a </span><span class="se">\</span>
<span class="s2"> firewall blocking port </span><span class="si">%u</span><span class="s2">?&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="c1"># 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="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="s1">&#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="s1">&#39;vicc://</span><span class="si">%s</span><span class="s1">:</span><span class="si">%d</span><span class="s1">&#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="nb">print</span><span class="p">(</span><span class="s1">&#39;VICC hostname: </span><span class="si">%s</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="n">local_ip</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;VICC port: </span><span class="si">%d</span><span class="s1">&#39;</span> <span class="o">%</span> <span class="n">port</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#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="nb">print</span><span class="p">(</span><span class="s1">&#39;https://api.qrserver.com/v1/create-qr-code/?data=</span><span class="si">%s</span><span class="s1">&#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="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="kc">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">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Failed to open socket: </span><span class="si">%s</span><span class="s2">&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="s2">&quot;Is pcscd running? Is vpcd loaded and in </span><span class="se">\</span>
<span class="s2"> reversed connection mode? Is a firewall </span><span class="se">\</span>
<span class="s2"> blocking port </span><span class="si">%u</span><span class="s2">?&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">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Connected to virtual PCD at </span><span class="si">%s</span><span class="s2">:</span><span class="si">%u</span><span class="s2">&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"><tt class="xref py py-class docutils literal"><span class="pre">formatResult</span></tt></a>, which is
<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 notranslate"><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>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <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="c1"># 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="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="s2">&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="c1"># 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="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="s2">&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="n">data</span><span class="p">,</span> <span class="n">sw</span><span class="p">,</span> <span class="kc">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"><tt class="xref py py-class docutils literal"><span class="pre">Iso7816OS</span></tt></a> works.</p>
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.Iso7816OS" title="virtualsmartcard.VirtualSmartcard.Iso7816OS"><code class="xref py py-class docutils literal notranslate"><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"><tt class="xref py py-class docutils literal"><span class="pre">CryptoflexMF</span></tt></a> from
<a class="reference internal" href="api/virtualsmartcard.SmartcardFilesystem.html#virtualsmartcard.SmartcardFilesystem.MF" title="virtualsmartcard.SmartcardFilesystem.MF"><tt class="xref py py-class docutils literal"><span class="pre">MF</span></tt></a> and modify
<a class="reference internal" href="api/virtualsmartcard.cards.cryptoflex.html#virtualsmartcard.cards.cryptoflex.CryptoflexMF.create" title="virtualsmartcard.cards.cryptoflex.CryptoflexMF.create"><tt class="xref py py-class docutils literal"><span class="pre">create</span></tt></a> to our needs.</p>
<div class="highlight-python"><div class="highlight"><pre> <span class="k">def</span> <span class="nf">create</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<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 notranslate"><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 notranslate"><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 notranslate"><span class="pre">create</span></code></a> to our needs.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="k">def</span> <span class="nf">create</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">2</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&quot;</span><span class="se">\xff\xff</span><span class="s">&quot;</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">SwError</span><span class="p">(</span><span class="n">SW</span><span class="p">[</span><span class="s">&quot;ERR_INCORRECTPARAMETERS&quot;</span><span class="p">])</span>
<span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">2</span><span class="p">]</span> <span class="o">!=</span> <span class="s2">&quot;</span><span class="se">\xff\xff</span><span class="s2">&quot;</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">SwError</span><span class="p">(</span><span class="n">SW</span><span class="p">[</span><span class="s2">&quot;ERR_INCORRECTPARAMETERS&quot;</span><span class="p">])</span>
<span class="n">args</span> <span class="o">=</span> <span class="p">{</span>
<span class="s">&quot;parent&quot;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
<span class="s">&quot;filedescriptor&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s">&quot;fid&quot;</span><span class="p">:</span> <span class="n">stringtoint</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">4</span><span class="p">:</span><span class="mi">6</span><span class="p">]),</span>
<span class="s2">&quot;parent&quot;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
<span class="s2">&quot;filedescriptor&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
<span class="s2">&quot;fid&quot;</span><span class="p">:</span> <span class="n">stringtoint</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">4</span><span class="p">:</span><span class="mi">6</span><span class="p">]),</span>
<span class="p">}</span>
<span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;</span><span class="se">\x01</span><span class="s">&quot;</span><span class="p">:</span>
<span class="n">args</span><span class="p">[</span><span class="s">&quot;data&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">chr</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="o">*</span><span class="n">stringtoint</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">2</span><span class="p">:</span><span class="mi">4</span><span class="p">])</span>
<span class="n">args</span><span class="p">[</span><span class="s">&quot;filedescriptor&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">FDB</span><span class="p">[</span><span class="s">&quot;EFSTRUCTURE_TRANSPARENT&quot;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;</span><span class="se">\x01</span><span class="s2">&quot;</span><span class="p">:</span>
<span class="n">args</span><span class="p">[</span><span class="s2">&quot;data&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">bytes</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="o">*</span><span class="n">stringtoint</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">2</span><span class="p">:</span><span class="mi">4</span><span class="p">])</span>
<span class="n">args</span><span class="p">[</span><span class="s2">&quot;filedescriptor&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">FDB</span><span class="p">[</span><span class="s2">&quot;EFSTRUCTURE_TRANSPARENT&quot;</span><span class="p">]</span>
<span class="n">new_file</span> <span class="o">=</span> <span class="n">TransparentStructureEF</span><span class="p">(</span><span class="o">**</span><span class="n">args</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;</span><span class="se">\x02</span><span class="s">&quot;</span><span class="p">:</span>
<span class="k">elif</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;</span><span class="se">\x02</span><span class="s2">&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">16</span><span class="p">:</span>
<span class="n">args</span><span class="p">[</span><span class="s">&quot;maxrecordsize&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">stringtoint</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">16</span><span class="p">])</span>
<span class="n">args</span><span class="p">[</span><span class="s2">&quot;maxrecordsize&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">stringtoint</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">16</span><span class="p">])</span>
<span class="k">elif</span> <span class="n">p2</span><span class="p">:</span>
<span class="c"># if given a number of records</span>
<span class="n">args</span><span class="p">[</span><span class="s">&quot;maxrecordsize&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">stringtoint</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">2</span><span class="p">:</span><span class="mi">4</span><span class="p">])</span> <span class="o">/</span> <span class="n">p2</span><span class="p">)</span>
<span class="n">args</span><span class="p">[</span><span class="s">&quot;filedescriptor&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">FDB</span><span class="p">[</span><span class="s">&quot;EFSTRUCTURE_LINEAR_FIXED_&quot;</span>
<span class="s">&quot;NOFURTHERINFO&quot;</span><span class="p">]</span>
<span class="c1"># if given a number of records</span>
<span class="n">args</span><span class="p">[</span><span class="s2">&quot;maxrecordsize&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">stringtoint</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">2</span><span class="p">:</span><span class="mi">4</span><span class="p">])</span> <span class="o">/</span> <span class="n">p2</span><span class="p">)</span>
<span class="n">args</span><span class="p">[</span><span class="s2">&quot;filedescriptor&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">FDB</span><span class="p">[</span><span class="s2">&quot;EFSTRUCTURE_LINEAR_FIXED_&quot;</span>
<span class="s2">&quot;NOFURTHERINFO&quot;</span><span class="p">]</span>
<span class="n">new_file</span> <span class="o">=</span> <span class="n">RecordStructureEF</span><span class="p">(</span><span class="o">**</span><span class="n">args</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;</span><span class="se">\x03</span><span class="s">&quot;</span><span class="p">:</span>
<span class="n">args</span><span class="p">[</span><span class="s">&quot;filedescriptor&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">FDB</span><span class="p">[</span><span class="s">&quot;EFSTRUCTURE_LINEAR_VARIABLE_&quot;</span>
<span class="s">&quot;NOFURTHERINFO&quot;</span><span class="p">]</span>
<span class="k">elif</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;</span><span class="se">\x03</span><span class="s2">&quot;</span><span class="p">:</span>
<span class="n">args</span><span class="p">[</span><span class="s2">&quot;filedescriptor&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">FDB</span><span class="p">[</span><span class="s2">&quot;EFSTRUCTURE_LINEAR_VARIABLE_&quot;</span>
<span class="s2">&quot;NOFURTHERINFO&quot;</span><span class="p">]</span>
<span class="n">new_file</span> <span class="o">=</span> <span class="n">RecordStructureEF</span><span class="p">(</span><span class="o">**</span><span class="n">args</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;</span><span class="se">\x04</span><span class="s">&quot;</span><span class="p">:</span>
<span class="n">args</span><span class="p">[</span><span class="s">&quot;filedescriptor&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">FDB</span><span class="p">[</span><span class="s">&quot;EFSTRUCTURE_CYCLIC_NOFURTHERINFO&quot;</span><span class="p">]</span>
<span class="k">elif</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;</span><span class="se">\x04</span><span class="s2">&quot;</span><span class="p">:</span>
<span class="n">args</span><span class="p">[</span><span class="s2">&quot;filedescriptor&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">FDB</span><span class="p">[</span><span class="s2">&quot;EFSTRUCTURE_CYCLIC_NOFURTHERINFO&quot;</span><span class="p">]</span>
<span class="n">new_file</span> <span class="o">=</span> <span class="n">RecordStructureEF</span><span class="p">(</span><span class="o">**</span><span class="n">args</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s">&quot;</span><span class="se">\x38</span><span class="s">&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="mi">12</span><span class="p">]</span> <span class="o">!=</span> <span class="s">&quot;</span><span class="se">\x03</span><span class="s">&quot;</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">SwError</span><span class="p">(</span><span class="n">SW</span><span class="p">[</span><span class="s">&quot;ERR_INCORRECTPARAMETERS&quot;</span><span class="p">])</span>
<span class="k">elif</span> <span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;</span><span class="se">\x38</span><span class="s2">&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="n">data</span><span class="p">[</span><span class="mi">12</span><span class="p">]</span> <span class="o">!=</span> <span class="s2">&quot;</span><span class="se">\x03</span><span class="s2">&quot;</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">SwError</span><span class="p">(</span><span class="n">SW</span><span class="p">[</span><span class="s2">&quot;ERR_INCORRECTPARAMETERS&quot;</span><span class="p">])</span>
<span class="n">new_file</span> <span class="o">=</span> <span class="n">DF</span><span class="p">(</span><span class="o">**</span><span class="n">args</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">error</span><span class="p">(</span><span class="s">&quot;unknown type: 0x</span><span class="si">%x</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">ord</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]))</span>
<span class="k">raise</span> <span class="n">SwError</span><span class="p">(</span><span class="n">SW</span><span class="p">[</span><span class="s">&quot;ERR_INCORRECTPARAMETERS&quot;</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="s2">&quot;unknown type: 0x</span><span class="si">%x</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="nb">ord</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="mi">6</span><span class="p">]))</span>
<span class="k">raise</span> <span class="n">SwError</span><span class="p">(</span><span class="n">SW</span><span class="p">[</span><span class="s2">&quot;ERR_INCORRECTPARAMETERS&quot;</span><span class="p">])</span>
<span class="k">return</span> <span class="p">[</span><span class="n">new_file</span><span class="p">]</span>
</pre></div>
@@ -437,8 +383,8 @@ completely different when creating a file on the smart card. So we derive
<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>
read some documentation or even source code to find out where its 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>
@@ -446,45 +392,47 @@ your modifications...</p>
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"><tt class="xref py py-class docutils literal"><span class="pre">VirtualICC</span></tt></a> recognize the new type
<tt class="docutils literal"><span class="pre">&quot;relay&quot;</span></tt>. <a class="reference internal" href="api/virtualsmartcard.cards.Relay.html#virtualsmartcard.cards.Relay.RelayOS" title="virtualsmartcard.cards.Relay.RelayOS"><tt class="xref py py-class docutils literal"><span class="pre">RelayOS</span></tt></a> overwrites all
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.VirtualICC" title="virtualsmartcard.VirtualSmartcard.VirtualICC"><code class="xref py py-class docutils literal notranslate"><span class="pre">VirtualICC</span></code></a> recognize the new type
<code class="docutils literal notranslate"><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 notranslate"><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"><tt class="xref py py-class docutils literal"><span class="pre">SmartcardOS</span></tt></a>. Its functions correspond
to the <a class="reference internal" href="#vpcd-commands"><em>commands sent by vpcd</em></a>. If you know how to use
<a class="reference internal" href="api/virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="virtualsmartcard.VirtualSmartcard.SmartcardOS"><code class="xref py py-class docutils literal notranslate"><span class="pre">SmartcardOS</span></code></a>. Its functions correspond
to the <a class="reference internal" href="#vpcd-commands"><span class="std std-ref">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>
forward, but see yourself</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><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="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="n">mitm</span><span class="o">=</span><span class="n">RelayMiddleman</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="c1"># 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">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Invalid number of reader &#39;</span><span class="si">%u</span><span class="s2">&#39; (only </span><span class="si">%u</span><span class="s2"> 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="c1"># Connect to the reader and its card</span>
<span class="c1"># XXX this is a workaround, see on sourceforge bug #3083254</span>
<span class="c1"># should better use</span>
<span class="c1"># 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">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Error connecting to card: </span><span class="si">%s</span><span class="s2">&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">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Connected to card in &#39;</span><span class="si">%s</span><span class="s2">&#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="bp">self</span><span class="o">.</span><span class="n">mitm</span> <span class="o">=</span> <span class="n">mitm</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>
@@ -495,46 +443,46 @@ forward, but see yourself...</p>
<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="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">&quot;Error disconnecting from card: </span><span class="si">%s</span><span class="s2">&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="c1"># when powerDown has been called, fetching the ATR will throw an error.</span>
<span class="c1"># 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="c1"># 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">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Error getting ATR: </span><span class="si">%s</span><span class="s2">&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">return</span> <span class="s2">&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="c1"># When powerUp is called multiple times the session is valid (and the</span>
<span class="c1"># card is implicitly powered) we can check for an ATR. But when</span>
<span class="c1"># powerDown has been called, the session gets lost. In this case we</span>
<span class="c1"># 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">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Error connecting to card: </span><span class="si">%s</span><span class="s2">&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="c1"># There is no power down in the session context so we simply</span>
<span class="c1"># 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">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Error disconnecting from card: </span><span class="si">%s</span><span class="s2">&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>
@@ -542,25 +490,32 @@ forward, but see yourself...</p>
<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="c1"># sendCommandAPDU() expects a list of APDU bytes</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span><span class="nb">str</span><span class="p">):</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">else</span><span class="p">:</span>
<span class="n">apdu</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="n">apdu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">mitm</span><span class="o">.</span><span class="n">handleInPDU</span><span class="p">(</span><span class="n">apdu</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">logging</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;Error transmitting APDU: </span><span class="si">%s</span><span class="s2">&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="c1"># XXX this is a workaround, see on sourceforge bug #3083586</span>
<span class="c1"># should better use</span>
<span class="c1"># 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>
<span class="n">rapdu</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">mitm</span><span class="o">.</span><span class="n">handleOutPDU</span><span class="p">(</span><span class="n">rapdu</span><span class="p">)</span>
<span class="c1"># return the response APDU as string</span>
<span class="k">return</span> <span class="s2">&quot;&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="nb">chr</span><span class="p">,</span> <span class="n">rapdu</span><span class="p">))</span>
</pre></div>
</div>
</div>
@@ -579,7 +534,7 @@ forward, but see yourself...</p>
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CardGenerator Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CardGenerator Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -151,65 +127,62 @@
<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"/>
<div class="graphviz"><img src="../../_images/inheritance-b79d4d6bf383a10ce17d2be6db4ea696bb48cd42.png" alt="Inheritance diagram of virtualsmartcard.CardGenerator" usemap="#inheritancecb03a25959" class="inheritance graphviz" /></div>
<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">
<area shape="rect" id="node1" href="#virtualsmartcard.CardGenerator.CardGenerator" target="_top" title="This class is used to generate the SAM and filesystem for the" alt="" coords="5,5,332,31"/>
</map><span class="target" id="module-virtualsmartcard.CardGenerator"></span><dl class="py class">
<dt id="virtualsmartcard.CardGenerator.CardGenerator">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.CardGenerator.</tt><tt class="descname">CardGenerator</tt><big>(</big><em>card_type=None</em>, <em>sam=None</em>, <em>mf=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CardGenerator.</span></code><code class="sig-name descname"><span class="pre">CardGenerator</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">card_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sam</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mf</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></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 notranslate"><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">
<tt class="descname">_CardGenerator__generate_cryptoflex</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_cryptoflex" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.__generate_cryptoflex">
<code class="sig-name descname"><span class="pre">__generate_cryptoflex</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.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">
<tt class="descname">_CardGenerator__generate_ePass</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_ePass" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.__generate_ePass">
<code class="sig-name descname"><span class="pre">__generate_ePass</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.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">
<tt class="descname">_CardGenerator__generate_iso_card</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_iso_card" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.__generate_iso_card">
<code class="sig-name descname"><span class="pre">__generate_iso_card</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.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">
<tt class="descname">_CardGenerator__generate_nPA</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator._CardGenerator__generate_nPA" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.__generate_nPA">
<code class="sig-name descname"><span class="pre">__generate_nPA</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator.__generate_nPA" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.generateCard">
<tt class="descname">generateCard</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator.generateCard" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">generateCard</span></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">
<dl class="py method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.getCard">
<tt class="descname">getCard</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator.getCard" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">getCard</span></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">
<dl class="py method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.readDatagroups">
<tt class="descname">readDatagroups</tt><big>(</big><em>datasetfile</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator.readDatagroups" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">readDatagroups</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">datasetfile</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.CardGenerator.CardGenerator.setCard">
<tt class="descname">setCard</tt><big>(</big><em>mf=None</em>, <em>sam=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CardGenerator.CardGenerator.setCard" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">setCard</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mf</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sam</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></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>
@@ -229,7 +202,7 @@ optionally for the path to a photo.</p>
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ConstantDefinitions Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ConstantDefinitions Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -165,7 +141,7 @@
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CryptoUtils Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CryptoUtils Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -151,98 +127,94 @@
<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">
<span class="target" id="module-virtualsmartcard.CryptoUtils"></span><dl class="py function">
<dt id="virtualsmartcard.CryptoUtils._makesalt">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">_makesalt</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils._makesalt" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">_makesalt</span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.append_padding">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">append_padding</tt><big>(</big><em>blocklen</em>, <em>data</em>, <em>padding_class=1</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.append_padding" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">append_padding</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">blocklen</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">padding_class</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.calculate_MAC">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">calculate_MAC</tt><big>(</big><em>session_key</em>, <em>message</em>, <em>iv='\x00\x00\x00\x00\x00\x00\x00\x00'</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.calculate_MAC" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">calculate_MAC</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">session_key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">message</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iv</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">b'\x00\x00\x00\x00\x00\x00\x00\x00'</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.cipher">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">cipher</tt><big>(</big><em>do_encrypt</em>, <em>cipherspec</em>, <em>key</em>, <em>data</em>, <em>iv=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.cipher" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">cipher</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">do_encrypt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cipherspec</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iv</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></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>
cipherspec must be of the form cipher-mode”, or “cipher”</p>
</dd></dl>
<dl class="function">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.crypto_checksum">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">crypto_checksum</tt><big>(</big><em>algo</em>, <em>key</em>, <em>data</em>, <em>iv=None</em>, <em>ssc=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.crypto_checksum" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">crypto_checksum</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">algo</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iv</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ssc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>algo</strong> A string specifying the algorithm to use. Currently supported
algorithms are “MAX” “HMAC” and “CC” (Meaning a cryptographic
checksum as used by the ICAO passports)</p></li>
<li><p><strong>key</strong> They key used to computed the cryptographic checksum</p></li>
<li><p><strong>data</strong> The data for which to calculate the checksum</p></li>
<li><p><strong>iv</strong> Optional. An initialization vector. Only used by the “MAC” algorithm</p></li>
<li><p><strong>ssc</strong> Optional. A send sequence counter to be prepended to the data.
Only used by the “CC” algorithm</p></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.decrypt">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">decrypt</tt><big>(</big><em>cipherspec</em>, <em>key</em>, <em>data</em>, <em>iv=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.decrypt" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">decrypt</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cipherspec</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iv</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.encrypt">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">encrypt</tt><big>(</big><em>cipherspec</em>, <em>key</em>, <em>data</em>, <em>iv=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.encrypt" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">encrypt</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cipherspec</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iv</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.get_cipher">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">get_cipher</tt><big>(</big><em>cipherspec</em>, <em>key</em>, <em>iv=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.get_cipher" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">get_cipher</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cipherspec</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iv</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.get_cipher_blocklen">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">get_cipher_blocklen</tt><big>(</big><em>cipherspec</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.get_cipher_blocklen" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">get_cipher_blocklen</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cipherspec</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.get_cipher_keylen">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">get_cipher_keylen</tt><big>(</big><em>cipherspec</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.get_cipher_keylen" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">get_cipher_keylen</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cipherspec</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.hash">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">hash</tt><big>(</big><em>hashmethod</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.hash" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">hash</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">hashmethod</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.operation_on_string">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">operation_on_string</tt><big>(</big><em>string1</em>, <em>string2</em>, <em>op</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.operation_on_string" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">operation_on_string</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">string2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">op</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.CryptoUtils.strip_padding">
<tt class="descclassname">virtualsmartcard.CryptoUtils.</tt><tt class="descname">strip_padding</tt><big>(</big><em>blocklen</em>, <em>data</em>, <em>padding_class=1</em><big>)</big><a class="headerlink" href="#virtualsmartcard.CryptoUtils.strip_padding" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.CryptoUtils.</span></code><code class="sig-name descname"><span class="pre">strip_padding</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">blocklen</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">padding_class</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></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>
@@ -260,7 +232,7 @@ Only used by the &#8220;CC&#8221; algorithm</li>
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SEutils Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SEutils Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -151,472 +127,437 @@
<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"/>
<div class="graphviz"><img src="../../_images/inheritance-46d14c049d401c956999e7b7618e351618dbc61c.png" alt="Inheritance diagram of virtualsmartcard.SEutils" usemap="#inheritance7064aeb8f6" class="inheritance graphviz" /></div>
<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">
<area shape="rect" id="node1" href="#virtualsmartcard.SEutils.ControlReferenceTemplate" target="_top" title="Control Reference Templates are used to configure the Security" alt="" coords="5,55,360,80"/>
<area shape="rect" id="node2" href="#virtualsmartcard.SEutils.Security_Environment" target="_top" title="virtualsmartcard.SEutils.Security_Environment" alt="" coords="20,5,345,31"/>
</map><span class="target" id="module-virtualsmartcard.SEutils"></span><dl class="py class">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.SEutils.</tt><tt class="descname">ControlReferenceTemplate</tt><big>(</big><em>tag</em>, <em>config=''</em><big>)</big><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
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.SEutils.</span></code><code class="sig-name descname"><span class="pre">ControlReferenceTemplate</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tag</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">config</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<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">
<tt class="descname">_ControlReferenceTemplate__replace_tag</tt><big>(</big><em>tag</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__replace_tag" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate.__replace_tag">
<code class="sig-name descname"><span class="pre">__replace_tag</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tag</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.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">
<tt class="descname">_ControlReferenceTemplate__set_algo</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_algo" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate.__set_algo">
<code class="sig-name descname"><span class="pre">__set_algo</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>data</strong> reference to an algorithm</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_iv">
<tt class="descname">_ControlReferenceTemplate__set_iv</tt><big>(</big><em>tag</em>, <em>length</em>, <em>value</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_iv" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate.__set_iv">
<code class="sig-name descname"><span class="pre">__set_iv</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tag</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">length</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate.__set_iv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_key">
<tt class="descname">_ControlReferenceTemplate__set_key</tt><big>(</big><em>tag</em>, <em>value</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate._ControlReferenceTemplate__set_key" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate.__set_key">
<code class="sig-name descname"><span class="pre">__set_key</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tag</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate.__set_key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate.parse_SE_config">
<tt class="descname">parse_SE_config</tt><big>(</big><em>config</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate.parse_SE_config" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">parse_SE_config</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">config</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>config</strong> a TLV string containing the configuration for the CRT.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.ControlReferenceTemplate.to_string">
<tt class="descname">to_string</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.ControlReferenceTemplate.to_string" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">to_string</span></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">
<dl class="py class">
<dt id="virtualsmartcard.SEutils.Security_Environment">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.SEutils.</tt><tt class="descname">Security_Environment</tt><big>(</big><em>MF</em>, <em>SAM</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<dl class="method">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.SEutils.</span></code><code class="sig-name descname"><span class="pre">Security_Environment</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">MF</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">SAM</span></span></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 notranslate"><span class="pre">object</span></code></p>
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment._set_SE">
<tt class="descname">_set_SE</tt><big>(</big><em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment._set_SE" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_set_SE</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.compute_cryptographic_checksum">
<tt class="descname">compute_cryptographic_checksum</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.compute_cryptographic_checksum" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">compute_cryptographic_checksum</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.compute_digital_signature">
<tt class="descname">compute_digital_signature</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.compute_digital_signature" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">compute_digital_signature</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>p1</strong> Must be 0x9E = Secure Messaging class for digital signatures</p></li>
<li><p><strong>p2</strong> Must be one of 0x9A, 0xAC, 0xBC. Indicates what kind of data
is included in the data field.</p></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.decipher">
<tt class="descname">decipher</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.decipher" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">decipher</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>raw data (no TLV coding). Padding is not removed!!!</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.encipher">
<tt class="descname">encipher</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.encipher" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">encipher</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>raw data (no TLV coding).</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.generate_public_key_pair">
<tt class="descname">generate_public_key_pair</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.generate_public_key_pair" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">generate_public_key_pair</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>p1</strong> should be 0x00 (generate new key)</p></li>
<li><p><strong>p2</strong> 00 (no information provided) or reference of the key to
be generated</p></li>
<li><p><strong>data</strong> One or more CRTs associated to the key generation if
P1-P2 different from 0000</p></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.hash">
<tt class="descname">hash</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.hash" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">hash</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>raw data (no TLV coding).</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.manage_security_environment">
<tt class="descname">manage_security_environment</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.manage_security_environment" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">manage_security_environment</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>p1</strong> <p>Bitmask according to this table</p>
<table class="docutils align-default">
<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%" />
<col style="width: 4%" />
<col style="width: 4%" />
<col style="width: 4%" />
<col style="width: 4%" />
<col style="width: 4%" />
<col style="width: 4%" />
<col style="width: 4%" />
<col style="width: 4%" />
<col style="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>
<thead>
<tr class="row-odd"><th class="head"><p>b8</p></th>
<th class="head"><p>b7</p></th>
<th class="head"><p>b6</p></th>
<th class="head"><p>b5</p></th>
<th class="head"><p>b4</p></th>
<th class="head"><p>b3</p></th>
<th class="head"><p>b2</p></th>
<th class="head"><p>b1</p></th>
<th class="head"><p>Meaning</p></th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><ul class="first last simple">
<tbody>
<tr class="row-even"><td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td>1</td>
<td><ul class="first last simple">
<td><p>1</p></td>
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td>Secure messaging in command data field</td>
<td><p>Secure messaging in command data field</p></td>
</tr>
<tr class="row-odd"><td><ul class="first last simple">
<tr class="row-odd"><td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td>1</td>
<td><ul class="first last simple">
<td><p>1</p></td>
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td>Secure messaging in response data field</td>
<td><p>Secure messaging in response data field</p></td>
</tr>
<tr class="row-even"><td><ul class="first last simple">
<tr class="row-even"><td><ul class="simple">
<li></li>
</ul>
</td>
<td>1</td>
<td><ul class="first last simple">
<td><p>1</p></td>
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td>Computation, decipherment, internal
authentication and key agreement</td>
<td><p>Computation, decipherment, internal
authentication and key agreement</p></td>
</tr>
<tr class="row-odd"><td>1</td>
<td><ul class="first last simple">
<tr class="row-odd"><td><p>1</p></td>
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td>Verification, encipherment, external
authentication and key agreement</td>
<td><p>Verification, encipherment, external
authentication and key agreement</p></td>
</tr>
<tr class="row-even"><td><ul class="first last simple">
<tr class="row-even"><td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td><ul class="first last simple">
<td><ul class="simple">
<li></li>
</ul>
</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>SET</td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>1</p></td>
<td><p>SET</p></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 class="row-odd"><td><p>1</p></td>
<td><p>1</p></td>
<td><p>1</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
<td><p>STORE</p></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 class="row-even"><td><p>1</p></td>
<td><p>1</p></td>
<td><p>1</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>1</p></td>
<td><p>1</p></td>
<td><p>RESTORE</p></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 class="row-odd"><td><p>1</p></td>
<td><p>1</p></td>
<td><p>1</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
<td><p>1</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>ERASE</p></td>
</tr>
</tbody>
</table>
</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.parse_SM_CAPDU">
<tt class="descname">parse_SM_CAPDU</tt><big>(</big><em>CAPDU</em>, <em>authenticate_header</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.parse_SM_CAPDU" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">parse_SM_CAPDU</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">CAPDU</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">authenticate_header</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>CAPDU</strong> The protected CAPDU to be parsed</p></li>
<li><p><strong>authenticate_header</strong> Whether or not the header should be
included in authentication mechanisms</p></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>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Unprotected command APDU</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.perform_security_operation">
<tt class="descname">perform_security_operation</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.perform_security_operation" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">perform_security_operation</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.protect_response">
<tt class="descname">protect_response</tt><big>(</big><em>sw</em>, <em>result</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.protect_response" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">protect_response</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sw</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">result</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>the protected data and the SW bytes</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.verify_certificate">
<tt class="descname">verify_certificate</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.verify_certificate" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">verify_certificate</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.verify_cryptographic_checksum">
<tt class="descname">verify_cryptographic_checksum</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.verify_cryptographic_checksum" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">verify_cryptographic_checksum</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SEutils.Security_Environment.verify_digital_signature">
<tt class="descname">verify_digital_signature</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SEutils.Security_Environment.verify_digital_signature" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">verify_digital_signature</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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>
@@ -638,7 +579,7 @@ contain a data to sign (tag 0x9A, 0xAC or 0xBC) and a digital signature
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SWutils Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SWutils Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -151,25 +127,24 @@
<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"/>
<div class="graphviz"><img src="../../_images/inheritance-2d3c003f9dce8873984cd7de1ec63e38780a764a.png" alt="Inheritance diagram of virtualsmartcard.SWutils" usemap="#inheritancef021466e51" class="inheritance graphviz" /></div>
<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">
<area shape="rect" id="node1" href="#virtualsmartcard.SWutils.SwError" target="_top" title="virtualsmartcard.SWutils.SwError" alt="" coords="5,5,243,31"/>
</map><span class="target" id="module-virtualsmartcard.SWutils"></span><dl class="py exception">
<dt id="virtualsmartcard.SWutils.SwError">
<em class="property">exception </em><tt class="descclassname">virtualsmartcard.SWutils.</tt><tt class="descname">SwError</tt><big>(</big><em>sw</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SWutils.SwError" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></tt></p>
<dl class="attribute">
<em class="property"><span class="pre">exception</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.SWutils.</span></code><code class="sig-name descname"><span class="pre">SwError</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sw</span></span></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 notranslate"><span class="pre">Exception</span></code></p>
<dl class="py attribute">
<dt id="virtualsmartcard.SWutils.SwError.args">
<tt class="descname">args</tt><a class="headerlink" href="#virtualsmartcard.SWutils.SwError.args" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">args</span></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">
<tt class="descname">message</tt><a class="headerlink" href="#virtualsmartcard.SWutils.SwError.message" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="virtualsmartcard.SWutils.SwError.with_traceback">
<code class="sig-name descname"><span class="pre">with_traceback</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SWutils.SwError.with_traceback" title="Permalink to this definition"></a></dt>
<dd><p>Exception.with_traceback(tb)
set self.__traceback__ to tb and return self.</p>
</dd></dl>
</dd></dl>
@@ -187,7 +162,7 @@
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SmartcardSAM Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SmartcardSAM Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -151,292 +127,281 @@
<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"/>
<div class="graphviz"><img src="../../_images/inheritance-f008352fda418a6e639df3493492ecf2a1976c1b.png" alt="Inheritance diagram of virtualsmartcard.SmartcardSAM" usemap="#inheritance8b3e5dd7ee" class="inheritance graphviz" /></div>
<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">
<area shape="rect" id="node1" href="#virtualsmartcard.SmartcardSAM.SAM" target="_top" title="This class is used to store the data needed by the SAM." alt="" coords="5,5,271,31"/>
</map><span class="target" id="module-virtualsmartcard.SmartcardSAM"></span><dl class="py class">
<dt id="virtualsmartcard.SmartcardSAM.SAM">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.SmartcardSAM.</tt><tt class="descname">SAM</tt><big>(</big><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><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.SmartcardSAM.</span></code><code class="sig-name descname"><span class="pre">SAM</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="pre">PIN</span></em>, <em class="sig-param"><span class="pre">cardNumber</span></em>, <em class="sig-param"><span class="pre">mf=None</span></em>, <em class="sig-param"><span class="pre">cardSecret=None</span></em>, <em class="sig-param"><span class="pre">default_se=&lt;class</span> <span class="pre">'virtualsmartcard.SEutils.Security_Environment'&gt;</span></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 notranslate"><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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.FSdecrypt">
<tt class="descname">FSdecrypt</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.FSdecrypt" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">FSdecrypt</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.FSencrypt">
<tt class="descname">FSencrypt</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.FSencrypt" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">FSencrypt</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM._get_referenced_key">
<tt class="descname">_get_referenced_key</tt><big>(</big><em>p1</em>, <em>p2</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM._get_referenced_key" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_get_referenced_key</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></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">
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>p1</strong> Specifies the algorithm to use.</p></li>
<li><p><strong>p2</strong> <p>Specifies a reference to the key to be used for encryption.</p>
<table class="docutils align-default">
<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%" />
<col style="width: 3%" />
<col style="width: 3%" />
<col style="width: 3%" />
<col style="width: 3%" />
<col style="width: 3%" />
<col style="width: 3%" />
<col style="width: 3%" />
<col style="width: 3%" />
<col style="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>
<thead>
<tr class="row-odd"><th class="head"><p>b8</p></th>
<th class="head"><p>b7</p></th>
<th class="head"><p>b6</p></th>
<th class="head"><p>b5</p></th>
<th class="head"><p>b4</p></th>
<th class="head"><p>b3</p></th>
<th class="head"><p>b2</p></th>
<th class="head"><p>b1</p></th>
<th class="head"><p>Meaning</p></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>
<tbody>
<tr class="row-even"><td><p>0</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>0</p></td>
<td><p>No information is given</p></td>
</tr>
<tr class="row-odd"><td>0</td>
<td><ul class="first last">
<tr class="row-odd"><td><p>0</p></td>
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td>Global reference data(e.g. MF specific key)</td>
<td><p>Global reference data(e.g. MF specific key)</p></td>
</tr>
<tr class="row-even"><td>1</td>
<td><ul class="first last">
<tr class="row-even"><td><p>1</p></td>
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td>Specific reference data(e.g. DF specific
key)</td>
<td><p>Specific reference data(e.g. DF specific
key)</p></td>
</tr>
<tr class="row-odd"><td><ul class="first last">
<tr class="row-odd"><td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<li></li>
</ul>
</td>
<td><ul class="first last">
<td><ul>
<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>
<td><p>x</p></td>
<td><p>x</p></td>
<td><p>x</p></td>
<td><p>x</p></td>
<td><p>x</p></td>
<td><p>Number of the secret</p></td>
</tr>
</tbody>
</table>
<p>Any other value RFU</p>
</li>
</p></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.change_reference_data">
<tt class="descname">change_reference_data</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.change_reference_data" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">change_reference_data</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.erase_SE">
<tt class="descname">erase_SE</tt><big>(</big><em>SEID</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.erase_SE" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">erase_SE</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">SEID</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.external_authenticate">
<tt class="descname">external_authenticate</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.external_authenticate" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">external_authenticate</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.generate_public_key_pair">
<tt class="descname">generate_public_key_pair</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.generate_public_key_pair" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">generate_public_key_pair</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.get_card_number">
<tt class="descname">get_card_number</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.get_card_number" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">get_card_number</span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.get_challenge">
<tt class="descname">get_challenge</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.get_challenge" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">get_challenge</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.internal_authenticate">
<tt class="descname">internal_authenticate</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.internal_authenticate" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">internal_authenticate</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.manage_security_environment">
<tt class="descname">manage_security_environment</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.manage_security_environment" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">manage_security_environment</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.mutual_authenticate">
<tt class="descname">mutual_authenticate</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>mutual_challenge</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.mutual_authenticate" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">mutual_authenticate</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mutual_challenge</span></span></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;
Terminal Challenge | Card Challenge | Card number
and checks it for validity. If the challenge is successful
the card encrypts &#8216;Card Challenge | Terminal challenge&#8217; and
the card encrypts Card Challenge | Terminal challenge and
returns this value</p>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.parse_SM_CAPDU">
<tt class="descname">parse_SM_CAPDU</tt><big>(</big><em>CAPDU</em>, <em>header_authentication</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.parse_SM_CAPDU" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">parse_SM_CAPDU</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">CAPDU</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">header_authentication</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.perform_security_operation">
<tt class="descname">perform_security_operation</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.perform_security_operation" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">perform_security_operation</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.protect_result">
<tt class="descname">protect_result</tt><big>(</big><em>sw</em>, <em>unprotected_result</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.protect_result" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">protect_result</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sw</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">unprotected_result</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.restore_SE">
<tt class="descname">restore_SE</tt><big>(</big><em>SEID</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.restore_SE" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">restore_SE</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">SEID</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.set_MF">
<tt class="descname">set_MF</tt><big>(</big><em>mf</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.set_MF" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">set_MF</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mf</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.set_asym_algorithm">
<tt class="descname">set_asym_algorithm</tt><big>(</big><em>cipher</em>, <em>keytype</em><big>)</big><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>
<code class="sig-name descname"><span class="pre">set_asym_algorithm</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cipher</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">keytype</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.set_asym_algorithm" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>cipher</strong> Public/private key object from used for encryption</p></li>
<li><p><strong>keytype</strong> Type of the public key (e.g. RSA, DSA)</p></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.store_SE">
<tt class="descname">store_SE</tt><big>(</big><em>SEID</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.store_SE" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">store_SE</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">SEID</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.SmartcardSAM.SAM.verify">
<tt class="descname">verify</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>PIN</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.SAM.verify" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">verify</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">PIN</span></span></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>
@@ -444,9 +409,9 @@ equals zero, block the card until reset with correct PUK</p>
</dd></dl>
<dl class="function">
<dl class="py function">
<dt id="virtualsmartcard.SmartcardSAM.get_referenced_cipher">
<tt class="descclassname">virtualsmartcard.SmartcardSAM.</tt><tt class="descname">get_referenced_cipher</tt><big>(</big><em>p1</em><big>)</big><a class="headerlink" href="#virtualsmartcard.SmartcardSAM.get_referenced_cipher" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.SmartcardSAM.</span></code><code class="sig-name descname"><span class="pre">get_referenced_cipher</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></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>
@@ -465,7 +430,7 @@ string that is understood by CryptoUtils.py functions</p>
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TLVutils Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TLVutils Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -151,101 +127,101 @@
<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">
<span class="target" id="module-virtualsmartcard.TLVutils"></span><dl class="py function">
<dt id="virtualsmartcard.TLVutils.bertlv_pack">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">bertlv_pack</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.bertlv_pack" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">bertlv_pack</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.bertlv_unpack">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">bertlv_unpack</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.bertlv_unpack" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">bertlv_unpack</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.decodeDiscretionaryDataObjects">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">decodeDiscretionaryDataObjects</tt><big>(</big><em>tlv_data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeDiscretionaryDataObjects" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">decodeDiscretionaryDataObjects</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tlv_data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.decodeExtendedHeaderList">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">decodeExtendedHeaderList</tt><big>(</big><em>tlv_data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeExtendedHeaderList" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">decodeExtendedHeaderList</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tlv_data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.decodeHeaderList">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">decodeHeaderList</tt><big>(</big><em>tlv_data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeHeaderList" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">decodeHeaderList</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tlv_data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.decodeOffsetDataObjects">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">decodeOffsetDataObjects</tt><big>(</big><em>tlv_data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeOffsetDataObjects" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">decodeOffsetDataObjects</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tlv_data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.decodeTagList">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">decodeTagList</tt><big>(</big><em>tlv_data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.decodeTagList" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">decodeTagList</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tlv_data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.encodeDataOffsetObjects">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">encodeDataOffsetObjects</tt><big>(</big><em>datalist</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.encodeDataOffsetObjects" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">encodeDataOffsetObjects</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">datalist</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.encodeDiscretionaryDataObjects">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">encodeDiscretionaryDataObjects</tt><big>(</big><em>datalist</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.encodeDiscretionaryDataObjects" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">encodeDiscretionaryDataObjects</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">datalist</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.encodebertlvDatalist">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">encodebertlvDatalist</tt><big>(</big><em>tag</em>, <em>datalist</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.encodebertlvDatalist" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">encodebertlvDatalist</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tag</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">datalist</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.pack">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">pack</tt><big>(</big><em>tlv_data</em>, <em>recalculate_length=False</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.pack" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">pack</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tlv_data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">recalculate_length</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.simpletlv_pack">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">simpletlv_pack</tt><big>(</big><em>tlv_data</em>, <em>recalculate_length=False</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.simpletlv_pack" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">simpletlv_pack</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tlv_data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">recalculate_length</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.simpletlv_unpack">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">simpletlv_unpack</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.simpletlv_unpack" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">simpletlv_unpack</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.tlv_find_tag">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">tlv_find_tag</tt><big>(</big><em>tlv_data</em>, <em>tag</em>, <em>num_results=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.tlv_find_tag" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">tlv_find_tag</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tlv_data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tag</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_results</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.tlv_find_tags">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">tlv_find_tags</tt><big>(</big><em>tlv_data</em>, <em>tags</em>, <em>num_results=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.tlv_find_tags" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">tlv_find_tags</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tlv_data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tags</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_results</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.tlv_unpack">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">tlv_unpack</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.tlv_unpack" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">tlv_unpack</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py function">
<dt id="virtualsmartcard.TLVutils.unpack">
<tt class="descclassname">virtualsmartcard.TLVutils.</tt><tt class="descname">unpack</tt><big>(</big><em>data</em>, <em>with_marks=None</em>, <em>offset=0</em>, <em>include_filler=False</em><big>)</big><a class="headerlink" href="#virtualsmartcard.TLVutils.unpack" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.TLVutils.</span></code><code class="sig-name descname"><span class="pre">unpack</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">with_marks</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_filler</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.TLVutils.unpack" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
@@ -262,7 +238,7 @@ results will be returned.</p>
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>VirtualSmartcard Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>VirtualSmartcard Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -151,75 +127,75 @@
<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"/>
<div class="graphviz"><img src="../../_images/inheritance-5bf7be7aa04845faed95d6b5c8e3172a37be0df7.png" alt="Inheritance diagram of virtualsmartcard.VirtualSmartcard" usemap="#inheritance4bd50c7c14" class="inheritance graphviz" /></div>
<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">
<area shape="rect" id="node1" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS" target="_top" title="virtualsmartcard.VirtualSmartcard.Iso7816OS" alt="" coords="387,55,704,80"/>
<area shape="rect" id="node2" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS" target="_top" title="Base class for a smart card OS" alt="" coords="5,55,339,80"/>
<area shape="rect" id="node3" href="#virtualsmartcard.VirtualSmartcard.VirtualICC" target="_top" title="This class is responsible for maintaining the communication of the virtual" alt="" coords="15,5,329,31"/>
</map><span class="target" id="module-virtualsmartcard.VirtualSmartcard"></span><dl class="py class">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.VirtualSmartcard.</tt><tt class="descname">Iso7816OS</tt><big>(</big><em>mf</em>, <em>sam</em>, <em>ins2handler=None</em>, <em>extended_length=False</em><big>)</big><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"><tt class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.VirtualSmartcard.SmartcardOS</span></tt></a></p>
<dl class="attribute">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.VirtualSmartcard.</span></code><code class="sig-name descname"><span class="pre">Iso7816OS</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mf</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sam</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ins2handler</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">extended_length</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></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 notranslate"><span class="pre">virtualsmartcard.VirtualSmartcard.SmartcardOS</span></code></a></p>
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.SAM">
<tt class="descname">SAM</tt><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.SAM" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">SAM</span></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">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.execute">
<tt class="descname">execute</tt><big>(</big><em>msg</em><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<code class="sig-name descname"><span class="pre">execute</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.execute" title="Permalink to this definition"></a></dt>
<dd><p>Returns response to the given APDU as string of characters</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>msg</strong> the APDU as string of characters</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.formatResult">
<tt class="descname">formatResult</tt><big>(</big><em>seekable</em>, <em>le</em>, <em>data</em>, <em>sw</em>, <em>sm</em><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.formatResult" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">formatResult</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">seekable</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">le</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sw</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sm</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.getATR">
<tt class="descname">getATR</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.getATR" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<code class="sig-name descname"><span class="pre">getATR</span></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><p>Returns the ATR of the card as string of characters</p>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.getResponse">
<tt class="descname">getResponse</tt><big>(</big><em>p1</em>, <em>p2</em>, <em>data</em><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.getResponse" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">getResponse</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.makeATR">
<em class="property">static </em><tt class="descname">makeATR</tt><big>(</big><em>**args</em><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.makeATR" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">makeATR</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">args</span></span></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>
<div><ul class="simple">
<li><dl class="simple">
<dt>directConvention (bool): Whether to use direct convention or</dt><dd><p>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
<li><dl class="simple">
<dt>TAi, TBi, TCi (optional): Value between 0 and 0xff. Interface</dt><dd><p>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
<li><dl class="simple">
<dt>T (optional): Value between 0 and 15. Transmission Protocol.</dt><dd><p>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
<li><dl class="simple">
<dt>histChars (optional): Bitstring with 0 &lt;= len(histChars) &lt;= 15.</dt><dd><p>Historical Characters T1 to T15 (for
meaning see ISO 7816-4).</p>
</dd>
</dl>
@@ -229,142 +205,139 @@ meaning see ISO 7816-4).</p>
<p>T0, TDi and TCK are automatically calculated.</p>
</dd></dl>
<dl class="staticmethod">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.makeThirdSoftwareFunctionTable">
<em class="property">static </em><tt class="descname">makeThirdSoftwareFunctionTable</tt><big>(</big><em>commandChainging=False</em>, <em>extendedLe=False</em>, <em>assignLogicalChannel=0</em>, <em>maximumChannels=0</em><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.makeThirdSoftwareFunctionTable" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">makeThirdSoftwareFunctionTable</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">commandChainging</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">extendedLe</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">assignLogicalChannel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maximumChannels</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.mf">
<tt class="descname">mf</tt><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.mf" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">mf</span></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">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.powerDown">
<tt class="descname">powerDown</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.Iso7816OS.powerDown" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">powerDown</span></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">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.powerUp">
<tt class="descname">powerUp</tt><big>(</big><big>)</big><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">
<tt class="descname">reset</tt><big>(</big><big>)</big><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><tt class="descname">seekable</tt><big>(</big><em>ins</em><big>)</big><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><tt class="descclassname">virtualsmartcard.VirtualSmartcard.</tt><tt class="descname">SmartcardOS</tt><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Base class for a smart card OS</p>
<dl class="method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.execute">
<tt class="descname">execute</tt><big>(</big><em>msg</em><big>)</big><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">
<tt class="descname">getATR</tt><big>(</big><big>)</big><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">
<tt class="descname">powerDown</tt><big>(</big><big>)</big><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">
<tt class="descname">powerUp</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS.powerUp" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">powerUp</span></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><p>Powers up the card</p>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.reset">
<code class="sig-name descname"><span class="pre">reset</span></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><p>Performs a warm reset of the card (no power down)</p>
</dd></dl>
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.Iso7816OS.seekable">
<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">seekable</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ins</span></span></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="py class">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.VirtualSmartcard.</span></code><code class="sig-name descname"><span class="pre">SmartcardOS</span></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 notranslate"><span class="pre">object</span></code></p>
<p>Base class for a smart card OS</p>
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.execute">
<code class="sig-name descname"><span class="pre">execute</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>msg</strong> the APDU as string of characters</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.getATR">
<code class="sig-name descname"><span class="pre">getATR</span></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="py method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.powerDown">
<code class="sig-name descname"><span class="pre">powerDown</span></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="py method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.powerUp">
<code class="sig-name descname"><span class="pre">powerUp</span></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="py method">
<dt id="virtualsmartcard.VirtualSmartcard.SmartcardOS.reset">
<tt class="descname">reset</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.SmartcardOS.reset" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">reset</span></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">
<dl class="py class">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.VirtualSmartcard.</tt><tt class="descname">VirtualICC</tt><big>(</big><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><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.VirtualSmartcard.</span></code><code class="sig-name descname"><span class="pre">VirtualICC</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">datasetfile</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">card_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">host</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">port</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">readernum</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mitmPath</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ef_cardsecurity</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ef_cardaccess</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ca_key</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cvca</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">disable_checks</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">esign_key</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">esign_ca_cert</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">esign_cert</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logginglevel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">20</span></span></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 notranslate"><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">
<tt class="descname">_VirtualICC__recvFromVPICC</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC._VirtualICC__recvFromVPICC" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.__recvFromVPICC">
<code class="sig-name descname"><span class="pre">__recvFromVPICC</span></code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.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">
<tt class="descname">_VirtualICC__sendToVPICC</tt><big>(</big><em>msg</em><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC._VirtualICC__sendToVPICC" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.__sendToVPICC">
<code class="sig-name descname"><span class="pre">__sendToVPICC</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.__sendToVPICC" title="Permalink to this definition"></a></dt>
<dd><p>Send a message to the vpcd</p>
</dd></dl>
<dl class="staticmethod">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.connectToPort">
<em class="property">static </em><tt class="descname">connectToPort</tt><big>(</big><em>host</em>, <em>port</em><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.connectToPort" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">connectToPort</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">host</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">port</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.openPort">
<em class="property">static </em><tt class="descname">openPort</tt><big>(</big><em>port</em><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.openPort" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">static</span> </em><code class="sig-name descname"><span class="pre">openPort</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">port</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.run">
<tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.run" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">run</span></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">
<tt class="descname">signalHandler</tt><big>(</big><em>sig=None</em>, <em>frame=None</em><big>)</big><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">
<dl class="py method">
<dt id="virtualsmartcard.VirtualSmartcard.VirtualICC.stop">
<tt class="descname">stop</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.VirtualICC.stop" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">stop</span></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>
<dl class="py function">
<dt id="virtualsmartcard.VirtualSmartcard.loadMitMFromPath">
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.VirtualSmartcard.</span></code><code class="sig-name descname"><span class="pre">loadMitMFromPath</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.VirtualSmartcard.loadMitMFromPath" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
@@ -379,7 +352,7 @@ printed when the user presses crtl-c</p>
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HandlerTest Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HandlerTest Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -151,50 +127,54 @@
<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"/>
<div class="graphviz"><img src="../../_images/inheritance-5c600c60a9fcc658bb9a017dd609c3bff8e456b3.png" alt="Inheritance diagram of virtualsmartcard.cards.HandlerTest" usemap="#inheritancee548df9983" class="inheritance graphviz" /></div>
<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">
<area shape="rect" id="node1" href="virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.SmartcardOS" target="_top" title="Base class for a smart card OS" alt="" coords="5,5,339,31"/>
<area shape="rect" id="node2" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS" target="_top" title="This class implements the commands used for the PC/SC&#45;lite &#160;smart &#160;card" alt="" coords="387,5,736,31"/>
</map><span class="target" id="module-virtualsmartcard.cards.HandlerTest"></span><dl class="py class">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.cards.HandlerTest.</tt><tt class="descname">HandlerTestOS</tt><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"><tt class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.VirtualSmartcard.SmartcardOS</span></tt></a></p>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.cards.HandlerTest.</span></code><code class="sig-name descname"><span class="pre">HandlerTestOS</span></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 notranslate"><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="https://pcsclite.apdu.fr/">https://pcsclite.apdu.fr/</a>
reader driver tester. See <a class="reference external" href="https://salsa.debian.org/rousseau/HandlerTest">https://salsa.debian.org/rousseau/HandlerTest</a>
and handler_test(1).</p>
<dl class="method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS._HandlerTestOS__output_from_le">
<tt class="descname">_HandlerTestOS__output_from_le</tt><big>(</big><em>msg</em><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS._HandlerTestOS__output_from_le" title="Permalink to this definition"></a></dt>
<dl class="py method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.__output_from_le">
<code class="sig-name descname"><span class="pre">__output_from_le</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.__output_from_le" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.execute">
<tt class="descname">execute</tt><big>(</big><em>msg</em><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<code class="sig-name descname"><span class="pre">execute</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.execute" title="Permalink to this definition"></a></dt>
<dd><p>Returns response to the given APDU as string of characters</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>msg</strong> the APDU as string of characters</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.getATR">
<tt class="descname">getATR</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.getATR" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<code class="sig-name descname"><span class="pre">getATR</span></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><p>Returns the ATR of the card as string of characters</p>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.powerDown">
<tt class="descname">powerDown</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.powerDown" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">powerDown</span></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">
<dl class="py method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.powerUp">
<tt class="descname">powerUp</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.powerUp" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">powerUp</span></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">
<dl class="py method">
<dt id="virtualsmartcard.cards.HandlerTest.HandlerTestOS.reset">
<tt class="descname">reset</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.HandlerTest.HandlerTestOS.reset" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">reset</span></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>
@@ -214,9 +194,9 @@ and handler_test(1).</p>
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>
</html>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Relay Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Relay Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -151,51 +127,58 @@
<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"/>
<div class="graphviz"><img src="../../_images/inheritance-c92efbd974214a247217ba79cf0775fb65c344af.png" alt="Inheritance diagram of virtualsmartcard.cards.Relay" usemap="#inheritanceeed1b727ec" class="inheritance graphviz" /></div>
<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">
<area shape="rect" id="node1" href="virtualsmartcard.VirtualSmartcard.html#virtualsmartcard.VirtualSmartcard.SmartcardOS" target="_top" title="Base class for a smart card OS" alt="" coords="5,5,339,31"/>
<area shape="rect" id="node2" href="#virtualsmartcard.cards.Relay.RelayOS" target="_top" title="This class implements relaying of a (physical) smartcard. The RelayOS" alt="" coords="387,5,653,31"/>
</map><span class="target" id="module-virtualsmartcard.cards.Relay"></span><dl class="py class">
<dt id="virtualsmartcard.cards.Relay.RelayOS">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.cards.Relay.</tt><tt class="descname">RelayOS</tt><big>(</big><em>readernum</em><big>)</big><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"><tt class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.VirtualSmartcard.SmartcardOS</span></tt></a></p>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.cards.Relay.</span></code><code class="sig-name descname"><span class="pre">RelayOS</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="pre">readernum</span></em>, <em class="sig-param"><span class="pre">mitm=&lt;virtualsmartcard.cards.RelayMiddleman.RelayMiddleman</span> <span class="pre">object&gt;</span></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 notranslate"><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">
<dl class="py method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.cleanup">
<tt class="descname">cleanup</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.cleanup" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">cleanup</span></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">
<dl class="py method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.execute">
<tt class="descname">execute</tt><big>(</big><em>msg</em><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.execute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<code class="sig-name descname"><span class="pre">execute</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.execute" title="Permalink to this definition"></a></dt>
<dd><p>Returns response to the given APDU as string of characters</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>msg</strong> the APDU as string of characters</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.getATR">
<tt class="descname">getATR</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.getATR" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<code class="sig-name descname"><span class="pre">getATR</span></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><p>Returns the ATR of the card as string of characters</p>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.powerDown">
<tt class="descname">powerDown</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.powerDown" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<code class="sig-name descname"><span class="pre">powerDown</span></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><p>Powers down the card</p>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.powerUp">
<tt class="descname">powerUp</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.powerUp" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<code class="sig-name descname"><span class="pre">powerUp</span></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><p>Powers up the card</p>
</dd></dl>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.cards.Relay.RelayOS.reset">
<tt class="descname">reset</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.cards.Relay.RelayOS.reset" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<code class="sig-name descname"><span class="pre">reset</span></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><p>Performs a warm reset of the card (no power down)</p>
</dd></dl>
</dd></dl>
@@ -213,7 +196,7 @@ This class can be used to implement relay or MitM attacks.</p>
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -0,0 +1,177 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RelayMiddleman Module &#8212; vsmartcard 2021-04-28 documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="search" title="Search" href="../../search.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>
<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="../../TCardEmulator/README.html">Tizen 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="../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="#">RelayMiddleman Module</a></li>
</ul>
</ul>
</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="relaymiddleman-module">
<h1>RelayMiddleman Module<a class="headerlink" href="#relaymiddleman-module" title="Permalink to this headline"></a></h1>
<div class="graphviz"><img src="../../_images/inheritance-95149f9804291dbbbe502519b9ab8d95f3e28f93.png" alt="Inheritance diagram of virtualsmartcard.cards.RelayMiddleman" usemap="#inheritancea75424a3c7" class="inheritance graphviz" /></div>
<map id="inheritancea75424a3c7" name="inheritancea75424a3c7">
<area shape="rect" id="node1" href="#virtualsmartcard.cards.RelayMiddleman.RelayMiddleman" target="_top" title="The RelayMiddleman class serves as a base from which a user might derive" alt="" coords="5,5,403,31"/>
</map><span class="target" id="module-virtualsmartcard.cards.RelayMiddleman"></span><dl class="py class">
<dt id="virtualsmartcard.cards.RelayMiddleman.RelayMiddleman">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.cards.RelayMiddleman.</span></code><code class="sig-name descname"><span class="pre">RelayMiddleman</span></code><a class="headerlink" href="#virtualsmartcard.cards.RelayMiddleman.RelayMiddleman" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>The RelayMiddleman class serves as a base from which a user might derive
their own relay middle man class. This base class implements the simplest
Man-in-the-Middle: the NoOp.</p>
<dl class="py method">
<dt id="virtualsmartcard.cards.RelayMiddleman.RelayMiddleman.handleInPDU">
<code class="sig-name descname"><span class="pre">handleInPDU</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inPDU</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.RelayMiddleman.RelayMiddleman.handleInPDU" title="Permalink to this definition"></a></dt>
<dd><p>This method is called on each PDU that is fed into the realy (vdpu -&gt; vicc).
It may be overwritten to modify the packages send from the terminal to the
real smart card.</p>
</dd></dl>
<dl class="py method">
<dt id="virtualsmartcard.cards.RelayMiddleman.RelayMiddleman.handleOutPDU">
<code class="sig-name descname"><span class="pre">handleOutPDU</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">outPDU</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.cards.RelayMiddleman.RelayMiddleman.handleOutPDU" title="Permalink to this definition"></a></dt>
<dd><p>This method is called on each PDU that is produced by the relay (vicc -&gt; vdpu).
It may be overwritten to modify the packages send from the real smart card to the
terminal.</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-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cards Package &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>cards Package &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -155,6 +131,7 @@
<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.RelayMiddleman.html">RelayMiddleman 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>
@@ -174,7 +151,7 @@
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

File diff suppressed because it is too large Load Diff

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>virtualsmartcard Package &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>virtualsmartcard Package &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -156,6 +132,7 @@
<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.RelayMiddleman.html">RelayMiddleman 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>
@@ -194,7 +171,7 @@
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>tests Package &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>tests Package &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 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" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -90,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -114,14 +98,6 @@
<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>
@@ -173,7 +149,7 @@
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>

View File

@@ -1,44 +1,29 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>utils Module &mdash; vsmartcard 2017-01-16 documentation</title>
<link rel="stylesheet" href="../../_static/basic.css" type="text/css" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>utils Module &#8212; vsmartcard 2021-04-28 documentation</title>
<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: '2017-01-16',
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="stylesheet" type="text/css" href="../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/jquery-1.11.0.min.js"></script>
<script src="../../_static/js/jquery-fix.js"></script>
<script src="../../_static/bootstrap-3.3.7/js/bootstrap.min.js"></script>
<script src="../../_static/bootstrap-sphinx.js"></script>
<link rel="shortcut icon" href="../../_static/chip.ico"/>
<link rel="top" title="vsmartcard 2017-01-16 documentation" href="../../index.html" />
<link rel="up" title="virtualsmartcard Package" href="virtualsmartcard.html" />
<link rel="prev" title="VirtualSmartcard Module" href="virtualsmartcard.VirtualSmartcard.html" />
<link rel="search" title="Search" href="../../search.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>
</head><body>
<a href="https://github.com/frankmorgner/vsmartcard"
class="visible-desktop hidden-xs"><img
@@ -89,8 +74,8 @@
<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 class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../api.html">Creating a Virtual Smart Card</a></li>
</ul>
</ul>
</li>
@@ -113,10 +98,6 @@
<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>
@@ -146,332 +127,318 @@
<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"/>
<div class="graphviz"><img src="../../_images/inheritance-77fc397d2fc138b4798b3225bda3dcf240726e7a.png" alt="Inheritance diagram of virtualsmartcard.utils" usemap="#inheritance305ec42f0e" class="inheritance graphviz" /></div>
<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">
<area shape="rect" id="node1" href="#virtualsmartcard.utils.APDU" target="_top" title="Base class for an APDU" alt="" coords="5,31,208,56"/>
<area shape="rect" id="node2" href="#virtualsmartcard.utils.C_APDU" target="_top" title="Class for a command APDU" alt="" coords="256,5,475,31"/>
<area shape="rect" id="node3" href="#virtualsmartcard.utils.R_APDU" target="_top" title="Class for a response APDU" alt="" coords="256,55,475,80"/>
</map><span class="target" id="module-virtualsmartcard.utils"></span><dl class="py class">
<dt id="virtualsmartcard.utils.APDU">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.utils.</tt><tt class="descname">APDU</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.APDU" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.utils.</span></code><code class="sig-name descname"><span class="pre">APDU</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></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 notranslate"><span class="pre">object</span></code></p>
<p>Base class for an APDU</p>
<dl class="method">
<dl class="py method">
<dt id="virtualsmartcard.utils.APDU._deldata">
<tt class="descname">_deldata</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.APDU._deldata" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_deldata</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.APDU._format_parts">
<tt class="descname">_format_parts</tt><big>(</big><em>fields</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.APDU._format_parts" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_format_parts</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fields</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.APDU._getdata">
<tt class="descname">_getdata</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.APDU._getdata" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_getdata</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.APDU._setbyte">
<tt class="descname">_setbyte</tt><big>(</big><em>name</em>, <em>value</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.APDU._setbyte" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_setbyte</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.APDU._setdata">
<tt class="descname">_setdata</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.APDU._setdata" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_setdata</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.APDU.data">
<tt class="descname">data</tt><a class="headerlink" href="#virtualsmartcard.utils.APDU.data" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">data</span></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">
<dl class="py class">
<dt id="virtualsmartcard.utils.C_APDU">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.utils.</tt><tt class="descname">C_APDU</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><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"><tt class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.utils.APDU</span></tt></a></p>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.utils.</span></code><code class="sig-name descname"><span class="pre">C_APDU</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></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 notranslate"><span class="pre">virtualsmartcard.utils.APDU</span></code></a></p>
<p>Class for a command APDU</p>
<dl class="attribute">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.CLA">
<tt class="descname">CLA</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.CLA" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">CLA</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.INS">
<tt class="descname">INS</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.INS" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">INS</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.Lc">
<tt class="descname">Lc</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.Lc" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">Lc</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.Le">
<tt class="descname">Le</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.Le" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">Le</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.P1">
<tt class="descname">P1</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.P1" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">P1</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.P2">
<tt class="descname">P2</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.P2" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">P2</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU._deldata">
<tt class="descname">_deldata</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._deldata" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_deldata</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU._format_fields">
<tt class="descname">_format_fields</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._format_fields" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_format_fields</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU._format_parts">
<tt class="descname">_format_parts</tt><big>(</big><em>fields</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._format_parts" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_format_parts</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fields</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU._getdata">
<tt class="descname">_getdata</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._getdata" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_getdata</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU._setbyte">
<tt class="descname">_setbyte</tt><big>(</big><em>name</em>, <em>value</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._setbyte" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_setbyte</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU._setdata">
<tt class="descname">_setdata</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.C_APDU._setdata" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_setdata</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.case">
<tt class="descname">case</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.case" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">case</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.cla">
<tt class="descname">cla</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.cla" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">cla</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.data">
<tt class="descname">data</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.data" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">data</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.effective_Le">
<tt class="descname">effective_Le</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.effective_Le" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">effective_Le</span></code><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.effective_Le" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.ins">
<tt class="descname">ins</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.ins" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">ins</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.lc">
<tt class="descname">lc</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.lc" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">lc</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.le">
<tt class="descname">le</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.le" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">le</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.p1">
<tt class="descname">p1</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.p1" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">p1</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.p2">
<tt class="descname">p2</tt><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.p2" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">p2</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.parse">
<tt class="descname">parse</tt><big>(</big><em>apdu</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.parse" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">parse</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">apdu</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.C_APDU.render">
<tt class="descname">render</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.C_APDU.render" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">render</span></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">
<dl class="py class">
<dt id="virtualsmartcard.utils.R_APDU">
<em class="property">class </em><tt class="descclassname">virtualsmartcard.utils.</tt><tt class="descname">R_APDU</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><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"><tt class="xref py py-class docutils literal"><span class="pre">virtualsmartcard.utils.APDU</span></tt></a></p>
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">virtualsmartcard.utils.</span></code><code class="sig-name descname"><span class="pre">R_APDU</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></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 notranslate"><span class="pre">virtualsmartcard.utils.APDU</span></code></a></p>
<p>Class for a response APDU</p>
<dl class="attribute">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU.SW">
<tt class="descname">SW</tt><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.SW" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">SW</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU.SW1">
<tt class="descname">SW1</tt><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.SW1" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">SW1</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU.SW2">
<tt class="descname">SW2</tt><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.SW2" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">SW2</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU._deldata">
<tt class="descname">_deldata</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._deldata" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_deldata</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU._format_fields">
<tt class="descname">_format_fields</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._format_fields" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_format_fields</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU._format_parts">
<tt class="descname">_format_parts</tt><big>(</big><em>fields</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._format_parts" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_format_parts</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">fields</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU._getdata">
<tt class="descname">_getdata</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._getdata" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_getdata</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU._getsw">
<tt class="descname">_getsw</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._getsw" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_getsw</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU._setbyte">
<tt class="descname">_setbyte</tt><big>(</big><em>name</em>, <em>value</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._setbyte" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_setbyte</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU._setdata">
<tt class="descname">_setdata</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._setdata" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_setdata</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU._setsw">
<tt class="descname">_setsw</tt><big>(</big><em>value</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU._setsw" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">_setsw</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">value</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU.data">
<tt class="descname">data</tt><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.data" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">data</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU.parse">
<tt class="descname">parse</tt><big>(</big><em>apdu</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.parse" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">parse</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">apdu</span></span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU.render">
<tt class="descname">render</tt><big>(</big><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.render" title="Permalink to this definition"></a></dt>
<code class="sig-name descname"><span class="pre">render</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU.sw">
<tt class="descname">sw</tt><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.sw" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">sw</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU.sw1">
<tt class="descname">sw1</tt><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.sw1" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">sw1</span></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">
<dl class="py method">
<dt id="virtualsmartcard.utils.R_APDU.sw2">
<tt class="descname">sw2</tt><a class="headerlink" href="#virtualsmartcard.utils.R_APDU.sw2" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">property</span> </em><code class="sig-name descname"><span class="pre">sw2</span></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">
<dl class="py function">
<dt id="virtualsmartcard.utils._make_byte_property">
<tt class="descclassname">virtualsmartcard.utils.</tt><tt class="descname">_make_byte_property</tt><big>(</big><em>prop</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils._make_byte_property" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.utils.</span></code><code class="sig-name descname"><span class="pre">_make_byte_property</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prop</span></span></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">
<tt class="descclassname">virtualsmartcard.utils.</tt><tt class="descname">_unformat_hexdump</tt><big>(</big><em>dump</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils._unformat_hexdump" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dl class="py function">
<dt id="virtualsmartcard.utils.hexdump">
<tt class="descclassname">virtualsmartcard.utils.</tt><tt class="descname">hexdump</tt><big>(</big><em>data</em>, <em>indent=0</em>, <em>short=False</em>, <em>linelen=16</em>, <em>offset=0</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.hexdump" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.utils.</span></code><code class="sig-name descname"><span class="pre">hexdump</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">indent</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">short</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">linelen</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">16</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">offset</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></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>
hexdump(bA) -&gt; 0000: 00 41 .A
hexdump(bA, short=True) -&gt; 00 41 (.A)</p>
</dd></dl>
<dl class="function">
<dl class="py function">
<dt id="virtualsmartcard.utils.inttostring">
<tt class="descclassname">virtualsmartcard.utils.</tt><tt class="descname">inttostring</tt><big>(</big><em>i</em>, <em>length=None</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.inttostring" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.utils.</span></code><code class="sig-name descname"><span class="pre">inttostring</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">length</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">len_extendable</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></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">
<tt class="descclassname">virtualsmartcard.utils.</tt><tt class="descname">parse_status</tt><big>(</big><em>data</em><big>)</big><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">
<dl class="py function">
<dt id="virtualsmartcard.utils.stringtoint">
<tt class="descclassname">virtualsmartcard.utils.</tt><tt class="descname">stringtoint</tt><big>(</big><em>str</em><big>)</big><a class="headerlink" href="#virtualsmartcard.utils.stringtoint" title="Permalink to this definition"></a></dt>
<code class="sig-prename descclassname"><span class="pre">virtualsmartcard.utils.</span></code><code class="sig-name descname"><span class="pre">stringtoint</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#virtualsmartcard.utils.stringtoint" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
@@ -488,7 +455,7 @@ hexdump(&#8216;A&#8217;, short=True) -&gt; &#8216;00 41 (.A)&#8217;</p>
</p>
<p>
&copy; Copyright 2009-2017 by Dominik Oepen and Frank Morgner.<br/>
&copy; Copyright 2009-2021 by Dominik Oepen and Frank Morgner.<br/>
</p>
</div>
</footer>