working on documentation
This commit is contained in:
@@ -58,14 +58,14 @@ hook into. Here we only want to give an overview to the design, the complete
|
||||
details can be found in section `Documentation to Virtual Smart Card`_.
|
||||
|
||||
Back to the cryptoflex example.
|
||||
:class:`virtualsmartcard.VirtualSmartcard.VirtualICC` provides the connection
|
||||
:class:`~virtualsmartcard.VirtualSmartcard.VirtualICC` provides the connection
|
||||
to the virtual smart card reader. It fetches an |APDU| and other requests from
|
||||
the |vpcd|. In :class:`virtualsmartcard.VirtualSmartcard.VirtualICC` an |APDU|
|
||||
the |vpcd|. In :class:`~virtualsmartcard.VirtualSmartcard.VirtualICC` an |APDU|
|
||||
is only a buffer that is forwarded to the smart card OS. First we modify
|
||||
:class:`virtualsmartcard.VirtualSmartcard.VirtualICC` to recognize a new type
|
||||
:class:`~virtualsmartcard.VirtualSmartcard.VirtualICC` to recognize a new type
|
||||
``"cryptoflex"`` and to load
|
||||
:class:`virtualsmartcard.VirtualSmartcard.CryptoflexOS`. The
|
||||
:class:`virtualsmartcard.CardGenerator` is used to create a file system and a
|
||||
:class:`~virtualsmartcard.VirtualSmartcard.CryptoflexOS`. The
|
||||
:class:`~virtualsmartcard.CardGenerator` is used to create a file system and a
|
||||
|SAM| specific to the cryptoflex (we come back to this later).
|
||||
|
||||
.. literalinclude:: virtualsmartcard/VirtualSmartcard.py
|
||||
@@ -75,14 +75,14 @@ is only a buffer that is forwarded to the smart card OS. First we modify
|
||||
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
|
||||
:class:`virtualsmartcard.VirtualSmartcard.CryptoflexOS.formatResult`, which is
|
||||
:class:`~virtualsmartcard.VirtualSmartcard.CryptoflexOS.formatResult`, which is
|
||||
called to encode the |SWs| and the resulting data.
|
||||
|
||||
.. literalinclude:: virtualsmartcard/VirtualSmartcard.py
|
||||
:pyobject: CryptoflexOS.formatResult
|
||||
|
||||
Note that this also requires some insight knowledge about how
|
||||
:class:`virtualsmartcard.VirtualSmartcard.Iso7816OS` works (see `above
|
||||
:class:`~virtualsmartcard.VirtualSmartcard.Iso7816OS` works (see `above
|
||||
<Documentation to Virtual Smart Card>`_).
|
||||
|
||||
The previously created |SAM| handles keys, encryption, secure messaging and so
|
||||
@@ -90,9 +90,9 @@ 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 |APDU| data is
|
||||
completely different when creating a file on the smart card. So we derive
|
||||
:class:`virtualsmartcard.cards.cryptoflex.CryptoflexMF` from
|
||||
:class:`virtualsmartcard.SmartcardFilesystem.MF` and modify
|
||||
:class:`virtualsmartcard.cards.cryptoflex.CryptoflexMF.create` to our needs.
|
||||
:class:`~virtualsmartcard.cards.cryptoflex.CryptoflexMF` from
|
||||
:class:`~virtualsmartcard.SmartcardFilesystem.MF` and modify
|
||||
:class:`~virtualsmartcard.cards.cryptoflex.CryptoflexMF.create` to our needs.
|
||||
|
||||
.. literalinclude:: virtualsmartcard/cards/cryptoflex.py
|
||||
:pyobject: CryptoflexMF.create
|
||||
@@ -112,18 +112,11 @@ If you have a card entirely different to ISO 7816, you surely want to avoid all
|
||||
magic that is done while parsing a buffer (an |APDU|). As example we will
|
||||
connect to an other smart card using PC/SC and forward it to |vpcd|.
|
||||
|
||||
.. note::
|
||||
This software can actually be used in a relay attack allowing full access
|
||||
to the card... `We discussed the impact especially on the German identity
|
||||
card
|
||||
<http://media.ccc.de/browse/congress/2010/27c3-4297-de-die_gesamte_technik_ist_sicher.html>`_,
|
||||
but it generally concerns *all smart cards*.
|
||||
|
||||
As before with the cryptoflex card, we let
|
||||
:class:`virtualsmartcard.VirtualSmartcard.VirtualICC` recognize the new type
|
||||
``"relay"``. :class:`virtualsmartcard.VirtualSmartcard.RelayOS` overwrites all
|
||||
:class:`~virtualsmartcard.VirtualSmartcard.VirtualICC` recognize the new type
|
||||
``"relay"``. :class:`~virtualsmartcard.VirtualSmartcard.RelayOS` overwrites all
|
||||
main functions from the template
|
||||
:class:`virtualsmartcard.VirtualSmartcard.SmartcardOS`. Its functions correspond
|
||||
:class:`~virtualsmartcard.VirtualSmartcard.SmartcardOS`. Its functions correspond
|
||||
to the :ref:`commands sent by vpcd <vpcd-commands>`. If you know how to use
|
||||
`pyscard <http://pyscard.sourceforge.net/>`_ then the rest is pretty straight
|
||||
forward, but see yourself...
|
||||
|
||||
Reference in New Issue
Block a user