Files
vsmartcard/virtualsmartcard
Michael Weghorn 468e01d164 Correct hmac import from Python stdlib
Commit 82c0c4fdd2
("Fallback to hashlib instead of deprecated libs")
had changed the hmac import to try the import from
the hashlib module, but there appears to be 'hmac'
underneath hashlib in neither Python 2 nor Python 3, but
it's a separate module.

Test on Debian testing with Python 2.7.18:

    $ python2
    Python 2.7.18 (default, Aug  1 2022, 06:23:55)
    [GCC 12.1.0] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    Jedi is not installed, falling back to readline
    >>> from hashlib import hmac as HMAC
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: cannot import name hmac
    >>> import hmac as HMAC
    >>>

The same with Python 3.10.6:

    $ python3
    Python 3.10.6 (main, Aug 10 2022, 11:19:32) [GCC 12.1.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    Using Jedi for tab completion.
    >>> from hashlib import hmac as HMAC
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: cannot import name 'hmac' from 'hashlib' (/usr/lib/python3.10/hashlib.py)
    >>> import hmac as HMAC
    >>>

Even the official Python 3.10.6 documentation for the hashlib
module use plain hmac import [1] in its example:

    >>> import hmac, hashlib
    >>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)
    >>> m.update(b'message')
    >>> m.hexdigest()
    'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'

Therefore, revert that change to the import and use the direct hmac
import again to make the case where PyCrypto is not installed work
again.

[1] https://docs.python.org/3/library/hashlib.html

Fixes: #223
2022-08-29 22:42:18 +02:00
..
2022-02-02 16:35:50 +01:00
2014-03-31 22:59:59 +02:00
2021-02-09 19:36:42 +01:00
2022-01-12 09:27:17 +01:00
2021-09-20 14:44:38 +02:00
2009-08-22 08:01:54 +00:00
2016-10-10 10:33:05 +02:00
2016-10-10 10:33:09 +02:00
2021-04-17 18:19:47 +02:00
2016-10-08 01:14:41 +02:00

Virtual Smart Card

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:

  • Generic ISO-7816 smart card including secure messaging
  • German electronic identity card (nPA) with complete support for EAC (PACE, TA, CA)
  • Electronic passport (ePass/MRTD) with support for BAC
  • Cryptoflex smart card (incomplete)

The vpcd is a smart card reader driver for PCSC-Lite and the windows smart card service. It allows smart card applications to access the vpicc through the PC/SC API. By default vpcd opens slots for communication with multiple vpicc's on localhost on port 35963 and port 35964. But the |vpicc| does not need to run on the same machine as the vpcd, they can connect over the internet for example.

Although the Virtual Smart Card is a software emulator, you can use pcsc-relay to make it accessible to an external contact-less smart card reader.

Please refer to our project's website for more information.