cryptnox-id-cli 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. cryptnox_id_cli-1.0.2/LICENSE +165 -0
  2. cryptnox_id_cli-1.0.2/PKG-INFO +227 -0
  3. cryptnox_id_cli-1.0.2/README.md +179 -0
  4. cryptnox_id_cli-1.0.2/pyproject.toml +106 -0
  5. cryptnox_id_cli-1.0.2/setup.cfg +4 -0
  6. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/__init__.py +22 -0
  7. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/__main__.py +6 -0
  8. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/__init__.py +2 -0
  9. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/fido/__init__.py +7 -0
  10. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/fido/authdata.py +81 -0
  11. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/fido/constants.py +155 -0
  12. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/fido/ctap.py +430 -0
  13. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/fido/errors.py +90 -0
  14. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/fido/pinproto.py +166 -0
  15. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/genuine/__init__.py +12 -0
  16. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/genuine/constants.py +32 -0
  17. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/genuine/genuine.py +85 -0
  18. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/genuine/verify.py +150 -0
  19. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/mifare/__init__.py +10 -0
  20. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/mifare/desfire.py +353 -0
  21. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/mifare/ev2.py +421 -0
  22. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/__init__.py +9 -0
  23. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/admin.py +182 -0
  24. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/apt.py +58 -0
  25. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/constants.py +66 -0
  26. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/keyimport.py +244 -0
  27. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/objects.py +126 -0
  28. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/perso.py +138 -0
  29. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/piv.py +171 -0
  30. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/preperso.py +174 -0
  31. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/profiles.py +486 -0
  32. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/applets/piv/slots.py +44 -0
  33. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/__init__.py +1 -0
  34. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/__init__.py +1 -0
  35. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/apdu.py +123 -0
  36. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/doctor.py +144 -0
  37. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/factory.py +312 -0
  38. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/fido.py +729 -0
  39. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/genuine.py +192 -0
  40. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/info.py +94 -0
  41. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/mifare.py +998 -0
  42. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/piv.py +2558 -0
  43. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/readers.py +64 -0
  44. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/report.py +217 -0
  45. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/commands/shell.py +130 -0
  46. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/context.py +71 -0
  47. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/dryrun.py +181 -0
  48. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/cli/main.py +117 -0
  49. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/crypto/__init__.py +1 -0
  50. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/crypto/attestation.py +169 -0
  51. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/crypto/csr.py +135 -0
  52. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/crypto/piv_objects.py +79 -0
  53. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/crypto/x509util.py +37 -0
  54. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/output/__init__.py +5 -0
  55. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/output/render.py +106 -0
  56. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/secrets/__init__.py +5 -0
  57. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/secrets/redaction.py +141 -0
  58. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/secrets/resolver.py +93 -0
  59. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/state/__init__.py +19 -0
  60. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/state/detector.py +273 -0
  61. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/state/model.py +147 -0
  62. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/transport/__init__.py +28 -0
  63. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/transport/apdu.py +72 -0
  64. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/transport/elevation.py +165 -0
  65. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/transport/errors.py +185 -0
  66. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/transport/pcsc.py +351 -0
  67. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/transport/scp02.py +247 -0
  68. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/transport/scp03.py +213 -0
  69. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/trust/__init__.py +90 -0
  70. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/trust/genuine/cryptnox-attestation-ca.pem +18 -0
  71. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/trust/genuine/cryptnox-dlt-cards-ca.pem +17 -0
  72. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/trust/genuine/cryptnox-genuineness-ca.pem +18 -0
  73. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/trust/genuine/cryptnox-intermediate-ca-2.pem +19 -0
  74. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/trust/genuine/cryptnox-intermediate-ca.pem +19 -0
  75. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/trust/genuine/cryptnox-root-ca.pem +19 -0
  76. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/util/__init__.py +1 -0
  77. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/util/hexutil.py +36 -0
  78. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli/util/tlv.py +144 -0
  79. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli.egg-info/PKG-INFO +227 -0
  80. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli.egg-info/SOURCES.txt +82 -0
  81. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli.egg-info/dependency_links.txt +1 -0
  82. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli.egg-info/entry_points.txt +4 -0
  83. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli.egg-info/requires.txt +15 -0
  84. cryptnox_id_cli-1.0.2/src/cryptnox_id_cli.egg-info/top_level.txt +1 -0
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,227 @@
1
+ Metadata-Version: 2.4
2
+ Name: cryptnox-id-cli
3
+ Version: 1.0.2
4
+ Summary: Polished CLI for the Cryptnox multi-applet smartcard (PIV / FIDO2 / MIFARE DESFire EV2)
5
+ Author: Cryptnox
6
+ License: LGPL-3.0-or-later
7
+ Project-URL: Homepage, https://cryptnox.com/
8
+ Project-URL: Documentation, https://docs.cryptnox.com/cryptnox-id-cli/
9
+ Project-URL: Repository, https://github.com/cryptnox/cryptnox-id-cli
10
+ Project-URL: Issues, https://github.com/cryptnox/cryptnox-id-cli/issues
11
+ Project-URL: Changelog, https://github.com/cryptnox/cryptnox-id-cli/blob/main/CHANGELOG.md
12
+ Keywords: smartcard,pcsc,piv,fido2,ctap,desfire,openfips201
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
18
+ Classifier: Operating System :: Microsoft :: Windows
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Operating System :: MacOS :: MacOS X
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Programming Language :: Python :: 3.14
27
+ Classifier: Topic :: Security :: Cryptography
28
+ Classifier: Topic :: System :: Hardware
29
+ Classifier: Typing :: Typed
30
+ Requires-Python: >=3.10
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+ Requires-Dist: pyscard>=2.0
34
+ Requires-Dist: click>=8.1
35
+ Requires-Dist: rich>=13.0
36
+ Requires-Dist: cryptography>=41.0
37
+ Requires-Dist: cbor2<6,>=5.4
38
+ Requires-Dist: asn1crypto>=1.5
39
+ Requires-Dist: pyyaml>=6.0
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest>=7.4; extra == "dev"
42
+ Requires-Dist: ruff>=0.4; extra == "dev"
43
+ Requires-Dist: mypy>=1.8; extra == "dev"
44
+ Requires-Dist: pyinstaller>=6.0; extra == "dev"
45
+ Requires-Dist: build>=1.0; extra == "dev"
46
+ Requires-Dist: twine>=5.0; extra == "dev"
47
+ Dynamic: license-file
48
+
49
+ <p align="center">
50
+ <img src="https://github.com/user-attachments/assets/6ce54a27-8fb6-48e6-9d1f-da144f43425a"/>
51
+ </p>
52
+
53
+ <h3 align="center">cryptnox-id-cli</h3>
54
+ <p align="center">CLI for managing Cryptnox multi-applet ID smart cards</p>
55
+
56
+ <br/>
57
+ <br/>
58
+
59
+ [![PyPI](https://img.shields.io/pypi/v/cryptnox-id-cli.svg)](https://pypi.org/project/cryptnox-id-cli/)
60
+ [![Python versions](https://img.shields.io/pypi/pyversions/cryptnox-id-cli.svg)](https://pypi.org/project/cryptnox-id-cli/)
61
+ [![docs](https://github.com/cryptnox/cryptnox-id-cli/actions/workflows/docs.yml/badge.svg)](https://github.com/cryptnox/cryptnox-id-cli/actions/workflows/docs.yml)
62
+ [![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)
63
+
64
+ `cryptnox-id-cli` is a command-line interface for managing the **Cryptnox ID**
65
+ multi-applet smart card: **PIV** identity credentials, **FIDO2** passkeys, and
66
+ **MIFARE DESFire** contactless applications — three independent functions on
67
+ one physical card, driven by one tool.
68
+
69
+ ---
70
+
71
+ ## Supported hardware
72
+
73
+ ### Cryptnox ID smart cards
74
+
75
+ One card, four applets, reachable over two interfaces:
76
+
77
+ | Function | Interface | Notes |
78
+ |----------|-----------|-------|
79
+ | **PIV** (SP 800-73 keys + X.509 certificates) | Contact (admin), contact/contactless (use) | All personalization is contact-only |
80
+ | **FIDO2 / CTAP 2.1** (passkeys / WebAuthn) | Contactless (NFC) | Windows requires an Administrator terminal |
81
+ | **MIFARE DESFire** (incl. EV3 Secure Dynamic Messaging) | Contactless (NFC) | Needs a DESFire-capable reader |
82
+ | **Genuineness** (factory attestation) | Contact | Read-only; proves the card is genuine Cryptnox hardware |
83
+
84
+ ### Smart card readers
85
+
86
+ Works with Cryptnox readers and any other standard PC/SC smart card reader:
87
+
88
+ | Reader | Type | Interface |
89
+ |--------|------|-----------|
90
+ | [Cryptnox® Smartcard Reader](https://shop.cryptnox.com/product/cryptnox-smartcard-reader/) | Contact (ID-1 + SIM) | USB-A |
91
+ | [Compact USB Mini Smartcard Reader](https://shop.cryptnox.com/product/mini-smartcard-reader/) | Contact (ID-1) | USB-A |
92
+ | [Cryptnox NFC Contactless Reader](https://shop.cryptnox.com/product/cryptnox-contactless-reader/) | Contactless (NFC/ISO 14443) | USB-C |
93
+
94
+ Verified third-party readers: ACS ACR39U (contact), ACS ACR1252 (contactless,
95
+ native DESFire OK). The HID OMNIKEY 5422CL does **not** support DESFire.
96
+
97
+ > [!IMPORTANT]
98
+ > MIFARE DESFire requires a contactless reader that passes *native* DESFire
99
+ > commands — not all contactless readers do.
100
+
101
+ ---
102
+
103
+ ## Installation
104
+
105
+ > [!IMPORTANT]
106
+ > This is only a minimal setup. Additional packages may be required depending
107
+ > on your operating system. See
108
+ > [Installation](https://docs.cryptnox.com/cryptnox-id-cli/installation.html)
109
+ > in the documentation.
110
+
111
+ Requirements: Python 3.10+ and a PC/SC stack (built into Windows and macOS; on
112
+ Linux install `pcscd` + `libccid`).
113
+
114
+ ### From PyPI
115
+
116
+ Recommended: [pipx](https://pipx.pypa.io/) — makes `cryptnox-id` available
117
+ globally while keeping its dependencies isolated, and works on current Linux
118
+ distributions where installing into the system Python is blocked (PEP 668):
119
+
120
+ ```bash
121
+ pipx install cryptnox-id-cli
122
+ ```
123
+
124
+ Plain pip also works where the environment allows it (e.g. Windows):
125
+
126
+ ```bash
127
+ pip install cryptnox-id-cli
128
+ ```
129
+
130
+ A virtual environment works too, but the command is then only available while
131
+ the venv is activated — fine for development, not for day-to-day use.
132
+
133
+ Three interchangeable console commands are installed: `cryptnox-id`, the short
134
+ `cnx-id`, and `cryptnox-id-card`.
135
+
136
+ ### From source
137
+
138
+ ```bash
139
+ git clone https://github.com/cryptnox/cryptnox-id-cli.git
140
+ cd cryptnox-id-cli
141
+ pip install .
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Quick usage examples
147
+
148
+ > [!TIP]
149
+ > The examples below are only a subset of available commands. The complete list
150
+ > of commands and detailed usage instructions is described in the
151
+ > [official documentation](https://docs.cryptnox.com/cryptnox-id-cli/).
152
+
153
+ ### 1. Inspect the card
154
+
155
+ ```bash
156
+ cryptnox-id readers # list readers, card presence, ATR
157
+ cryptnox-id info # detect the card + all functions on one screen
158
+ cryptnox-id doctor # PC/SC service, reader, per-function reachability
159
+ ```
160
+
161
+ `info` and `doctor` are read-only and safe to run any time.
162
+
163
+ ### 2. Provision a PIV credential
164
+
165
+ 1. Run `cryptnox-id piv quickstart` on a contact reader.
166
+ 2. The card gets a key, a certificate, a CHUID and a CCC — usable by standard
167
+ PIV tooling (`yubico-piv-tool`, OpenSC, OS smart-card stacks).
168
+
169
+ ### 3. Create a passkey and prove the whole loop
170
+
171
+ 1. Run `cryptnox-id fido credential self-test` — registers a credential,
172
+ requests an assertion, and verifies the returned signature: the full
173
+ WebAuthn round trip against the real authenticator.
174
+ 2. For a resident, PIN-verified credential: `cryptnox-id fido pin set`, then
175
+ re-run the self-test with `--rk`. On Windows, run from an Administrator
176
+ terminal.
177
+
178
+ ### 4. Prove the card is genuine
179
+
180
+ 1. Run `cryptnox-id genuine verify` on a contact reader.
181
+ 2. The card signs a fresh nonce and the on-card certificate is chained to the
182
+ pinned Cryptnox root — the verdict is **GENUINE** only when both checks pass.
183
+
184
+ ### 5. Work interactively
185
+
186
+ ```bash
187
+ cryptnox-id shell # run subcommands without re-typing the prefix
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Documentation
193
+
194
+ The full **User & Developer documentation** is available at the
195
+ [Cryptnox ID CLI Documentation](https://docs.cryptnox.com/cryptnox-id-cli/). It
196
+ covers installation and setup, quick starts and usage guides for every card
197
+ function (PIV, FIDO2, MIFARE DESFire, genuineness), the complete CLI command
198
+ reference, JSON output and exit codes, and factory/provisioning notes.
199
+
200
+ ---
201
+
202
+ ## Development
203
+
204
+ ```bash
205
+ pip install -e ".[dev]"
206
+ ruff check src tests && ruff format --check src tests
207
+ mypy
208
+ pytest -q -m "not real_card"
209
+ ```
210
+
211
+ Unit tests use a mock transport — no reader or card required. Real-card tests
212
+ are opt-in (`-m real_card`) and never run in CI.
213
+
214
+ ---
215
+
216
+ ## License
217
+
218
+ `cryptnox-id-cli` is dual-licensed:
219
+
220
+ - **LGPL-3.0** for open-source projects and proprietary projects that comply
221
+ with LGPL requirements (see [`LICENSE`](LICENSE))
222
+ - **Commercial license** for projects that require a proprietary license
223
+ without LGPL obligations (see [`COMMERCIAL.md`](COMMERCIAL.md) for details)
224
+
225
+ The documentation is licensed CC BY-NC-ND 4.0.
226
+
227
+ For commercial inquiries, contact: contact@cryptnox.com
@@ -0,0 +1,179 @@
1
+ <p align="center">
2
+ <img src="https://github.com/user-attachments/assets/6ce54a27-8fb6-48e6-9d1f-da144f43425a"/>
3
+ </p>
4
+
5
+ <h3 align="center">cryptnox-id-cli</h3>
6
+ <p align="center">CLI for managing Cryptnox multi-applet ID smart cards</p>
7
+
8
+ <br/>
9
+ <br/>
10
+
11
+ [![PyPI](https://img.shields.io/pypi/v/cryptnox-id-cli.svg)](https://pypi.org/project/cryptnox-id-cli/)
12
+ [![Python versions](https://img.shields.io/pypi/pyversions/cryptnox-id-cli.svg)](https://pypi.org/project/cryptnox-id-cli/)
13
+ [![docs](https://github.com/cryptnox/cryptnox-id-cli/actions/workflows/docs.yml/badge.svg)](https://github.com/cryptnox/cryptnox-id-cli/actions/workflows/docs.yml)
14
+ [![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)
15
+
16
+ `cryptnox-id-cli` is a command-line interface for managing the **Cryptnox ID**
17
+ multi-applet smart card: **PIV** identity credentials, **FIDO2** passkeys, and
18
+ **MIFARE DESFire** contactless applications — three independent functions on
19
+ one physical card, driven by one tool.
20
+
21
+ ---
22
+
23
+ ## Supported hardware
24
+
25
+ ### Cryptnox ID smart cards
26
+
27
+ One card, four applets, reachable over two interfaces:
28
+
29
+ | Function | Interface | Notes |
30
+ |----------|-----------|-------|
31
+ | **PIV** (SP 800-73 keys + X.509 certificates) | Contact (admin), contact/contactless (use) | All personalization is contact-only |
32
+ | **FIDO2 / CTAP 2.1** (passkeys / WebAuthn) | Contactless (NFC) | Windows requires an Administrator terminal |
33
+ | **MIFARE DESFire** (incl. EV3 Secure Dynamic Messaging) | Contactless (NFC) | Needs a DESFire-capable reader |
34
+ | **Genuineness** (factory attestation) | Contact | Read-only; proves the card is genuine Cryptnox hardware |
35
+
36
+ ### Smart card readers
37
+
38
+ Works with Cryptnox readers and any other standard PC/SC smart card reader:
39
+
40
+ | Reader | Type | Interface |
41
+ |--------|------|-----------|
42
+ | [Cryptnox® Smartcard Reader](https://shop.cryptnox.com/product/cryptnox-smartcard-reader/) | Contact (ID-1 + SIM) | USB-A |
43
+ | [Compact USB Mini Smartcard Reader](https://shop.cryptnox.com/product/mini-smartcard-reader/) | Contact (ID-1) | USB-A |
44
+ | [Cryptnox NFC Contactless Reader](https://shop.cryptnox.com/product/cryptnox-contactless-reader/) | Contactless (NFC/ISO 14443) | USB-C |
45
+
46
+ Verified third-party readers: ACS ACR39U (contact), ACS ACR1252 (contactless,
47
+ native DESFire OK). The HID OMNIKEY 5422CL does **not** support DESFire.
48
+
49
+ > [!IMPORTANT]
50
+ > MIFARE DESFire requires a contactless reader that passes *native* DESFire
51
+ > commands — not all contactless readers do.
52
+
53
+ ---
54
+
55
+ ## Installation
56
+
57
+ > [!IMPORTANT]
58
+ > This is only a minimal setup. Additional packages may be required depending
59
+ > on your operating system. See
60
+ > [Installation](https://docs.cryptnox.com/cryptnox-id-cli/installation.html)
61
+ > in the documentation.
62
+
63
+ Requirements: Python 3.10+ and a PC/SC stack (built into Windows and macOS; on
64
+ Linux install `pcscd` + `libccid`).
65
+
66
+ ### From PyPI
67
+
68
+ Recommended: [pipx](https://pipx.pypa.io/) — makes `cryptnox-id` available
69
+ globally while keeping its dependencies isolated, and works on current Linux
70
+ distributions where installing into the system Python is blocked (PEP 668):
71
+
72
+ ```bash
73
+ pipx install cryptnox-id-cli
74
+ ```
75
+
76
+ Plain pip also works where the environment allows it (e.g. Windows):
77
+
78
+ ```bash
79
+ pip install cryptnox-id-cli
80
+ ```
81
+
82
+ A virtual environment works too, but the command is then only available while
83
+ the venv is activated — fine for development, not for day-to-day use.
84
+
85
+ Three interchangeable console commands are installed: `cryptnox-id`, the short
86
+ `cnx-id`, and `cryptnox-id-card`.
87
+
88
+ ### From source
89
+
90
+ ```bash
91
+ git clone https://github.com/cryptnox/cryptnox-id-cli.git
92
+ cd cryptnox-id-cli
93
+ pip install .
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Quick usage examples
99
+
100
+ > [!TIP]
101
+ > The examples below are only a subset of available commands. The complete list
102
+ > of commands and detailed usage instructions is described in the
103
+ > [official documentation](https://docs.cryptnox.com/cryptnox-id-cli/).
104
+
105
+ ### 1. Inspect the card
106
+
107
+ ```bash
108
+ cryptnox-id readers # list readers, card presence, ATR
109
+ cryptnox-id info # detect the card + all functions on one screen
110
+ cryptnox-id doctor # PC/SC service, reader, per-function reachability
111
+ ```
112
+
113
+ `info` and `doctor` are read-only and safe to run any time.
114
+
115
+ ### 2. Provision a PIV credential
116
+
117
+ 1. Run `cryptnox-id piv quickstart` on a contact reader.
118
+ 2. The card gets a key, a certificate, a CHUID and a CCC — usable by standard
119
+ PIV tooling (`yubico-piv-tool`, OpenSC, OS smart-card stacks).
120
+
121
+ ### 3. Create a passkey and prove the whole loop
122
+
123
+ 1. Run `cryptnox-id fido credential self-test` — registers a credential,
124
+ requests an assertion, and verifies the returned signature: the full
125
+ WebAuthn round trip against the real authenticator.
126
+ 2. For a resident, PIN-verified credential: `cryptnox-id fido pin set`, then
127
+ re-run the self-test with `--rk`. On Windows, run from an Administrator
128
+ terminal.
129
+
130
+ ### 4. Prove the card is genuine
131
+
132
+ 1. Run `cryptnox-id genuine verify` on a contact reader.
133
+ 2. The card signs a fresh nonce and the on-card certificate is chained to the
134
+ pinned Cryptnox root — the verdict is **GENUINE** only when both checks pass.
135
+
136
+ ### 5. Work interactively
137
+
138
+ ```bash
139
+ cryptnox-id shell # run subcommands without re-typing the prefix
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Documentation
145
+
146
+ The full **User & Developer documentation** is available at the
147
+ [Cryptnox ID CLI Documentation](https://docs.cryptnox.com/cryptnox-id-cli/). It
148
+ covers installation and setup, quick starts and usage guides for every card
149
+ function (PIV, FIDO2, MIFARE DESFire, genuineness), the complete CLI command
150
+ reference, JSON output and exit codes, and factory/provisioning notes.
151
+
152
+ ---
153
+
154
+ ## Development
155
+
156
+ ```bash
157
+ pip install -e ".[dev]"
158
+ ruff check src tests && ruff format --check src tests
159
+ mypy
160
+ pytest -q -m "not real_card"
161
+ ```
162
+
163
+ Unit tests use a mock transport — no reader or card required. Real-card tests
164
+ are opt-in (`-m real_card`) and never run in CI.
165
+
166
+ ---
167
+
168
+ ## License
169
+
170
+ `cryptnox-id-cli` is dual-licensed:
171
+
172
+ - **LGPL-3.0** for open-source projects and proprietary projects that comply
173
+ with LGPL requirements (see [`LICENSE`](LICENSE))
174
+ - **Commercial license** for projects that require a proprietary license
175
+ without LGPL obligations (see [`COMMERCIAL.md`](COMMERCIAL.md) for details)
176
+
177
+ The documentation is licensed CC BY-NC-ND 4.0.
178
+
179
+ For commercial inquiries, contact: contact@cryptnox.com
@@ -0,0 +1,106 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cryptnox-id-cli"
7
+ version = "1.0.2"
8
+ description = "Polished CLI for the Cryptnox multi-applet smartcard (PIV / FIDO2 / MIFARE DESFire EV2)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "LGPL-3.0-or-later" }
12
+ authors = [{ name = "Cryptnox" }]
13
+ keywords = ["smartcard", "pcsc", "piv", "fido2", "ctap", "desfire", "openfips201"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: System Administrators",
19
+ "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
20
+ "Operating System :: Microsoft :: Windows",
21
+ "Operating System :: POSIX :: Linux",
22
+ "Operating System :: MacOS :: MacOS X",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14",
29
+ "Topic :: Security :: Cryptography",
30
+ "Topic :: System :: Hardware",
31
+ "Typing :: Typed",
32
+ ]
33
+ dependencies = [
34
+ "pyscard>=2.0",
35
+ "click>=8.1",
36
+ "rich>=13.0",
37
+ "cryptography>=41.0",
38
+ # Cap below 6: cbor2 6.x is a Rust build with no Intel-macOS wheel, so a plain
39
+ # `pip install` fails there without a Rust toolchain. Our CBOR use is trivial
40
+ # (CTAP dumps/loads) and 5.x ships wheels everywhere.
41
+ "cbor2>=5.4,<6",
42
+ "asn1crypto>=1.5",
43
+ "pyyaml>=6.0",
44
+ ]
45
+
46
+ [project.urls]
47
+ Homepage = "https://cryptnox.com/"
48
+ Documentation = "https://docs.cryptnox.com/cryptnox-id-cli/"
49
+ Repository = "https://github.com/cryptnox/cryptnox-id-cli"
50
+ Issues = "https://github.com/cryptnox/cryptnox-id-cli/issues"
51
+ Changelog = "https://github.com/cryptnox/cryptnox-id-cli/blob/main/CHANGELOG.md"
52
+
53
+ [project.optional-dependencies]
54
+ dev = [
55
+ "pytest>=7.4",
56
+ "ruff>=0.4",
57
+ "mypy>=1.8",
58
+ "pyinstaller>=6.0",
59
+ # Release tooling: `python -m build` produces the wheel/sdist, twine uploads them.
60
+ "build>=1.0",
61
+ "twine>=5.0",
62
+ ]
63
+
64
+ [project.scripts]
65
+ cryptnox-id = "cryptnox_id_cli.cli.main:main"
66
+ cnx-id = "cryptnox_id_cli.cli.main:main"
67
+ cryptnox-id-card = "cryptnox_id_cli.cli.main:main"
68
+
69
+ [tool.setuptools.packages.find]
70
+ where = ["src"]
71
+
72
+ # Bundle pinned attestation trust anchors (PEM) into the wheel: the Cryptnox root plus
73
+ # the intermediates. See src/cryptnox_id_cli/trust/genuine/README.md.
74
+ [tool.setuptools.package-data]
75
+ cryptnox_id_cli = ["trust/genuine/*.pem"]
76
+
77
+ [tool.ruff]
78
+ line-length = 100
79
+ target-version = "py310"
80
+ src = ["src", "tests"]
81
+
82
+ [tool.ruff.lint]
83
+ select = ["E", "F", "W", "I", "UP", "B", "C4", "SIM"]
84
+ ignore = ["B008"] # click uses callables as defaults
85
+
86
+ [tool.mypy]
87
+ python_version = "3.10"
88
+ packages = ["cryptnox_id_cli"]
89
+ mypy_path = "src"
90
+ warn_unused_ignores = true
91
+ no_implicit_optional = true
92
+ check_untyped_defs = true
93
+
94
+ # pyscard ships no type stubs; yaml stubs are an optional dev extra.
95
+ [[tool.mypy.overrides]]
96
+ module = ["smartcard.*", "yaml", "asn1crypto.*"]
97
+ ignore_missing_imports = true
98
+
99
+ [tool.pytest.ini_options]
100
+ testpaths = ["tests"]
101
+ pythonpath = ["src"]
102
+ markers = [
103
+ "real_card: test requires a physical card on the ACS reader (opt-in)",
104
+ "destructive: test mutates the card; requires CRYPTNOX_ALLOW_DESTRUCTIVE_TESTS=1",
105
+ ]
106
+ addopts = "-ra"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+