Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

piv: Devices used by other processes cause an error #592

Open
robin-nitrokey opened this issue Nov 29, 2024 · 0 comments
Open

piv: Devices used by other processes cause an error #592

robin-nitrokey opened this issue Nov 29, 2024 · 0 comments
Labels

Comments

@robin-nitrokey
Copy link
Member

If a smartcard that is currently used by another process is connected while executing a PIV command, the following error occurs:

  File "/nix/store/z5yf0wjqs9963nx3429j45cg8aiw7wvb-pynitrokey-0.6.0/lib/python3.11/site-packages/pynitrokey/cli/nk3/piv.py", line 650, in write_certificate
    device = PivApp()
             ^^^^^^^^
  File "/nix/store/z5yf0wjqs9963nx3429j45cg8aiw7wvb-pynitrokey-0.6.0/lib/python3.11/site-packages/pynitrokey/nk3/piv_app.py", line 62, in __init__
    connection.connect()
  File "/nix/store/xigxrdaayzlpkqrmcv31p2b6l6xjfywk-python3.11-pyscard-2.0.9/lib/python3.11/site-packages/smartcard/CardConnectionDecorator.py", line 54, in connect
    self.component.connect(protocol, mode, disposition)
  File "/nix/store/xigxrdaayzlpkqrmcv31p2b6l6xjfywk-python3.11-pyscard-2.0.9/lib/python3.11/site-packages/smartcard/pcsc/PCSCCardConnection.py", line 123, in connect
    raise CardConnectionException(
smartcard.Exceptions.CardConnectionException: Unable to connect with protocol: T0 or T1. Sharing violation.: Sharing violation. (0x8010000B)

Steps to reproduce:

  1. Connect Nitrokey Pro
  2. Use Nitrokey Pro with GnuPG/scdaemon
  3. Connect Nitrokey 3
  4. Try to use Nitrokey 3 with nitropy nk3 piv ...

Possible solutions:

  • filter readers by Nitrokey 3 to avoid connecting to other devices
  • skip devices that raise CardConnectionException when connecting
@robin-nitrokey robin-nitrokey changed the title piv_app: Devices used by other processes cause an error piv: Devices used by other processes cause an error Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant