Commit Graph

605 Commits

Author SHA1 Message Date
Frank Morgner
002e61dadf fixed handling error cases
fixes CID 443645, thanks coverity scan

(cherry picked from commit ffea1e0e97a89e8092ffdfc4b5b006633e1500e2)
2026-06-27 15:04:00 -07:00
Frank Morgner
1df8faa540 fixed possible integer underflow
fixes CID 443646, thanks coverety scan

(cherry picked from commit 007230711693cf12ae59a8439f22399f9727cb24)
2026-06-27 15:03:59 -07:00
Christoph Honal
238ace8c46 Sign using VivoKey certificate 2024-05-23 12:29:26 -07:00
Christoph Honal
1d71760f34 Rename BixV Reader to VivoKey Smart Reader 2024-05-21 07:31:18 -07:00
Frank Morgner
29ccf47113 more compact view of macos' usb devices 2024-03-12 09:11:03 +01:00
Frank Morgner
a985e84a04 update python version
fixes https://github.com/frankmorgner/vsmartcard/issues/269
2024-03-12 08:23:13 +01:00
Frank Morgner
00f150856b virtualsmartcard: distribute install instructions for Windows 2023-10-01 18:24:52 +02:00
Frank Morgner
bb990a2995 virtualsmartcard: version bump 2023-09-27 02:53:47 +02:00
Frank Morgner
11cccf8873 virtualsmartcard: version bump 2023-09-27 02:35:38 +02:00
Frank Morgner
022931902b fixed documentation warnings 2023-09-27 02:28:03 +02:00
Frank Morgner
56dea5c853 virtualsmartcard: added missing reader.h to distribution 2023-09-27 01:56:03 +02:00
Frank Morgner
3c816b50d1 virtualsmartcard: disable build of openpace
for now, don't hassle with creating fat ssl binaries by using lipo. just
remove openpace from the binaries for now.

fixes https://github.com/frankmorgner/vsmartcard/issues/242
2023-04-12 03:54:19 +02:00
Alba Mendez
8c8116724e swap alloca for malloc 2023-03-16 11:00:15 +01:00
Alba Mendez
76e267968d send length + data at the same time 2023-03-14 17:03:35 +01:00
Frank Morgner
38709f3ad8 vicc: fixed type error in nPA generation
fixes https://github.com/frankmorgner/vsmartcard/issues/247
2023-02-14 16:22:13 +01:00
Frank Morgner
8c0e373cae add reader.h and updated ifdhandler.h to ccid-1.4.24's macOS version
as found in macOS Sierra's CCID driver version
https://opensource.apple.com/source/SmartcardCCID/SmartcardCCID-55013/ccid/ccid/MacOSX/
2023-01-17 15:40:02 +01:00
Claus Steuer
258ebe2e40 allow feature query for maximum APDU size
If the reader's maximum APDU size (dwMaxAPDUDataSize)
cannot be queried the client application must assume
that only short APDUs are supported.
Since there is no data size limit for virtual smart card communication
dwMaxAPDUDataSize can be set to the maximum APDU size of
65536 (extended APDUs).

This updates pcsclite-vpcd's reader.h/ifdhandler.h to pcsc-1.9.9
https://salsa.debian.org/rousseau/PCSC/-/blob/1.9.9/src/PCSC
2023-01-17 15:40:02 +01:00
Frank Morgner
6bcef5705e virtualsmartcard: added more information about VS and WDK dependencies
closes https://github.com/frankmorgner/vsmartcard/issues/149
2022-09-19 17:30:03 +02:00
Michael Weghorn
22edc2a228 Port from PyCrypto to PyCroptodome
As the PyCrypto website says [1]:

> PyCrypto 2.x is unmaintained, obsolete, and contains security
> vulnerabilities.

Therefore, switch to PyCryptodome, a maintained PyCrypto fork
which is listed there as the recommended alternative for
existing software that depends on PyCrypto.

Notes on the port:

1) As the PyCryptodome introduction documentation [2] says,
there are 2 alternative projects/namespaces that can be
used:

* pycryptodome, which uses the `Crypto` package
  that PyCrypto also uses, so is almost a drop-in
  replacement for Pycrypto

* pycryptodomex, which uses the `Cryptodome` package

It also mentions that the use of pycryptodome
"is therefore recommended only when you are
sure that the whole application is deployed in a virtualenv".

Since it isn't sure that the application is deployed in a
virtualenv, to make it more explicit that PyCryptodome
is being used and because Linux distros like Debian
package the `Cryptodome` package [3], the port is done to
the `pycryptodomex` library that uses the `Cryptodome`
package name.

2) As the "Compatibility with PyCrypto" page in the PyCryptodome
doc [4] says:

> The following packages, modules and functions have been removed:
>
> * Crypto.Random.OSRNG, Crypto.Util.winrandom and Crypto.Random.randpool.
>   You should use Crypto.Random only.

The `PublicKey.RSA.generate` method already uses
`Crypto.Random.get_random_bytes()` as default [5],
so just drop the second parameter using `RandomPool.getBytes`
in `virtualsmartcard/src/vpicc/virtualsmartcard/cards/cryptoflex.py`.

[1] https://www.pycrypto.org/
[2] https://www.pycryptodome.org/src/introduction
[3] https://packages.debian.org/bullseye/python3-pycryptodome
[4] https://pycryptodome.readthedocs.io/en/latest/src/vs_pycrypto.html
[5] https://pycryptodome.readthedocs.io/en/latest/src/public_key/rsa.html
2022-09-17 22:15:39 +02:00
Michael Weghorn
141509cce3 Drop unused PyCrypto imports 2022-09-17 21:32:56 +02:00
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
Michael Weghorn
c6f8011ade Drop unused SHA1 import
It is unused since commit 36970a26d7
("Replace PBKDF2 class by python stdlib implementation").

Fixes #218
2022-07-23 13:50:12 +02:00
bowb
76543ea32b Change socket fd checks against INVALID_SOCKET. Fix issue with allowing reconnects from client to a server. 2022-06-07 13:42:25 -06:00
Frank Morgner
51fb023c3b vicc: use Quad9 instead of Goolge for detecting IP 2022-06-01 10:28:33 +02:00
Frank Morgner
68ca1fb49d vpcd: add support for SCARD_ATTR_ATR_STRING
fixes https://github.com/frankmorgner/vsmartcard/issues/201
2022-06-01 10:27:56 +02:00
Frank Morgner
b57b383a1d vicc: move detailed description to APDU class for generic use 2022-05-09 22:26:58 +02:00
Frank Morgner
471abe6950 vicc: fixed error printing 2022-05-06 14:06:18 +02:00
Frank Morgner
4b872bb000 vicc: debug parsed APDU
closes https://github.com/frankmorgner/vsmartcard/pull/103/
2022-05-06 12:24:03 +02:00
Frank Morgner
fe5977bc39 vicc: use logging.critical if vicc needs exit() 2022-05-06 11:57:23 +02:00
Frank Morgner
1e5731fb0e vicc: debug incoming commands as well 2022-05-06 11:53:05 +02:00
Frank Morgner
a982efd8c5 ePass: Python 3 compatibility 2022-02-02 16:36:27 +01:00
Frank Morgner
ccb482cfe9 ePass: documented BAC test 2022-02-02 16:35:50 +01:00
Frank Morgner
98bd7a0c8e virtualsmartcard: fixed more python3 compatibility 2022-02-01 14:21:48 +01:00
Frank Morgner
0a8b6575fb fixed link to binaries as they are available for bot 32 and 64 bit 2022-01-28 18:20:12 +01:00
Frank Morgner
9367685a7b virtualsmartcard: added documentation about driver signing
fixes https://github.com/frankmorgner/vsmartcard/issues/156
2022-01-28 18:17:51 +01:00
Frank Morgner
be6d6e2f73 virtualsmartcard: added missing include
fixes https://github.com/frankmorgner/vsmartcard/issues/138
2022-01-28 00:06:56 +01:00
Frank Morgner
af028aa8c3 virtualsmartcard: fixed some python3 compatibility
fixes https://github.com/frankmorgner/vsmartcard/issues/200
2022-01-27 22:46:12 +01:00
Guinness
82c0c4fdd2 Fallback to hashlib instead of deprecated libs 2022-01-21 14:38:30 +01:00
nagyi
1f497d3d03 Added firewall rule to installer 2022-01-12 09:27:17 +01:00
Frank Morgner
9284766532 Don't use ASN.1 data as ASN.1 tuple for encoding
fixes https://github.com/frankmorgner/vsmartcard/issues/209
2021-11-02 14:14:24 +01:00
Frank Morgner
ee0929d8f3 print python location 2021-09-20 14:44:38 +02:00
Jakub Jelen
e8be94964b vpcd: Initialize variable also on Windows
This should fix the appveyor build failure:

C:\projects\vsmartcard\virtualsmartcard\src\vpcd\vpcd.c(183): error C4700: uninitialized local variable 'rfds' used [C:\projects\vsmartcard\virtualsmartcard\win32\BixVReader\BixVReader.vcxproj]
2021-08-26 10:15:39 +02:00
Jakub Jelen
8d34ee42c7 vpcd: Fix timeout calculation
Authored by Doug Engert <deengert@gmail.com>
2021-08-23 15:31:05 +02:00
Jakub Jelen
f611240fba vpcd: Initialize variables
This caused OpenSC CI failing as described in

https://github.com/OpenSC/OpenSC/issues/2390

Authored by Doug Engert <deengert@gmail.com>
2021-08-23 15:29:36 +02:00
Bowb
cebe05e78d Update vpcd.c
FIXES #193
2021-08-09 14:47:38 -06:00
Frank Morgner
4658f86108 fixed syntax error in python 2.7 2021-04-28 17:56:06 +02:00
Frank Morgner
a053f1aecd let distcheck pass 2021-04-28 16:00:15 +02:00
Frank Morgner
27b3dfb62b regenerated documentation 2021-04-28 02:13:40 +02:00
Frank Morgner
29a818c69a avoid sphinx's option warning 2021-04-28 02:12:50 +02:00
Frank Morgner
3b2b73bd22 virtualsmartcard: don't publish python API 2021-04-28 02:12:05 +02:00