Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions Adding-a-new-card-driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,35 @@

## Preconditions when writing a new card driver

- Identify the card. A useful tool is to check the card's ATR (`opensc-tool -a`) against the database located at https://smartcard-atr.apdu.fr/
- Identify the card. A useful tool is to check the card's ATR (`opensc-tool -a`) against the database located at <https://smartcard-atr.apdu.fr/>
- Most useful is the developer documentation with the APDUs that the card is capable of processing.
- Even if no documentation is available, it is possible to spy the APDUs which the card accepts using a possibly proprietary card driver (e.g. PKCS#11 module).
- To receive the debug log of pcscd on Linux (including APDUs), you can run `pcscd` in the foreground with debugging enabled:

```bash
sudo pcscd --foreground --debug --apdu
```

Or, if managed by systemd, you can configure `PCSCD_ARGS="--debug --apdu"` in `/etc/default/pcscd` (or via a systemd drop-in) and view logs via:

```bash
journalctl -u pcscd --follow
```

- To watch APDUs on macOS, you can enable smart card logging and use the `log` command:

```bash
sudo defaults write /Library/Preferences/com.apple.security.smartcard Logging -bool yes
log stream --predicate '(subsystem == "com.apple.CryptoTokenKit") && (category == "APDULog")'
```
- On Windows, you can use the [APDUTrace](https://www.mysmartlogon.com/download#APDUTrace) tool. Refer to the user documentation at https://www.mysmartlogon.com/download#APDUTrace

- On Windows, you can use the [APDUTrace](https://www.mysmartlogon.com/download#APDUTrace) tool. Refer to the user documentation at <https://www.mysmartlogon.com/download#APDUTrace>

## Card driver programming

### Investigation

If (some previous version of) the card already has a driver in OpenSC, it may only be needed to add the ATR map to your new card and change some minor details to the card driver. Most cards are based on the ISO/IEC 7816 Specification, which is used by most card drivers in OpenSC as base implementation for card driver specific modifications. Ideally, you keep changes to OpenSC small and managable. Only when your card deviates from some existing card-driver implementation too much, create a new card driver
If (some previous version of) the card already has a driver in OpenSC, it may only be needed to add the ATR map to your new card and change some minor details to the card driver. Most cards are based on the ISO/IEC 7816 Specification, which is used by most card drivers in OpenSC as base implementation for card driver specific modifications. Ideally, you keep changes to OpenSC small and manageable. Only when your card deviates from some existing card-driver implementation too much, create a new card driver

### Creating a new card driver

Expand All @@ -43,9 +49,9 @@ Creating the skeleton card driver:

PKCS#15 driver hookup:

* PKCS#15 card formats should need minimal or no modifications, to allow `sc_pkcs15_bind` to scan the card and populate in-memory structures,
* non-PKCS#15 cards need to create a `pkcs15-example.c`, hook it to `builtin_emulators` list in `pkcs15-syn.c` and add to lists in `Makefile.am` and `Makefile.mak`,
* `pkcs15-example.c` creates the in-memory structure by linking right objects with their counterparts based on ID codes or whatever information that is necessary.
- PKCS#15 card formats should need minimal or no modifications, to allow `sc_pkcs15_bind` to scan the card and populate in-memory structures,
- non-PKCS#15 cards need to create a `pkcs15-example.c`, hook it to `builtin_emulators` list in `pkcs15-syn.c` and add to lists in `Makefile.am` and `Makefile.mak`,
- `pkcs15-example.c` creates the in-memory structure by linking right objects with their counterparts based on ID codes or whatever information that is necessary.

### AI Assistance

Expand All @@ -55,9 +61,9 @@ Even if no detailed documentation is available for a new card, AI tools like Cha

Use OpenSC's command line tools to verify your implementation:

* `opensc-tool -n` shows the name of the card
* `pkcs15-tool -D` dumps the card's profile with certificates, keys and PINs
* `pkcs11-tool --test --login` performs basic signature validation tests with the card
- `opensc-tool -n` shows the name of the card
Comment thread
frankmorgner marked this conversation as resolved.
Resolved
- `pkcs15-tool -D` dumps the card's profile with certificates, keys and PINs
- `pkcs11-tool --test --login` performs basic signature validation tests with the card

For more elaborated tests, see [Smart Card Release Testing](Smart-Card-Release-Testing).

Expand All @@ -74,4 +80,4 @@ When a given ATR string A is compared to the ATR supplied in `pbAtr`, it matches

## Examples

* [New card driver: EnterSafe card example](New-card-driver-EnterSafe-card-example)
- [New card driver: EnterSafe card example](New-card-driver-EnterSafe-card-example)
10 changes: 6 additions & 4 deletions Aventra-MyEID-PKI-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ Aventra participates in development and testing of OpenSC, keeping MyEID support

The MyEID applet implements all the basic functionality of a Public Key Infrastructure (PKI) token specified in the most common international PKI standards, such as ISO 7816-15. MyEID supports authentication with alphanumeric and challenge/response PIN codes. It can emulate a PIV/CIV card by mapping the ISO 7816-15 (PKCS#15) structure to the PIV/CIV command interface.

> Aventra’s MyEID PKI Smart Card has evolved into version 5, based on NXP’s SmartMX3 microcontroller and JCOP 4 Java Card platform.
> Aventra’s MyEID PKI Smart Card has evolved into version 5, based on NXP’s SmartMX3 microcontroller and JCOP 4 Java Card platform.
MyEID 5.0.0 is certified to Common Criteria EAL4+ level.

### New in MyEID 5

EEPROM storage space is increased to 180 kilobytes. New features include:

* Secure Messaging as specified in [NIST SP 800-73-5](https://csrc.nist.gov/pubs/sp/800/73/pt2/5/final)
* Extended length APDUs
* Challenge/response PINs with AES algorithm
* Brainpool ECC curves
* on-card PSS and OAEP padding


### Technical details

#### Platform
Expand Down Expand Up @@ -104,11 +105,12 @@ pkcs15-init --generate-key ec:prime256v1 --auth-id 01 --so-pin 12345678 --pin 11

```

When done creating PIN codes, finalize (activate) the card. After this all access conditions (PINs) are in effect. This is not mandatory, but before this is done card elements can be accessed without satisfying specified access conditions (without entering PIN codes).
When done creating PIN codes, finalize (activate) the card. After this all access conditions (PINs) are in effect. This is not mandatory, but before this is done card elements can be accessed without satisfying specified access conditions (without entering PIN codes).

```bash
pkcs15-init -F
```

**NOTE:** Since MyEID 5, cryptographic operations such as signature creation are not allowed before the card is finalized. This is to prevent accidentally forgetting the card in unfinalized state. Crypto-operations can be explicitly enabled in creation (unfinalized) state, see the reference manual for details.

### Smart card reader configuration
Expand Down Expand Up @@ -161,5 +163,5 @@ Aventra offers a complete portfolio of card products ranging from simple plastic
## Notes

* Card requires a PUK code when creating a PIN code (fails to create a PIN without a PUK).
* A minidriver is available for download [here](https://aventra.fi/downloads/).
* A minidriver is available from the [Aventra downloads page](https://aventra.fi/downloads/).
* You can **not** upload custom Java-Applets like the openpgpcard-applet to the Aventra MyEID-card because the card is locked and Aventra refuses to hand out the required PIN. Please contact Aventra if you have any special needs or requests.
1 change: 0 additions & 1 deletion CVE-2025-49010.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ Originally reported by Oss-fuzz.
Patches provided by Frank Morgner.

CVSS:3.1[/AV:P/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L](https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:P/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L) (3.8)

1 change: 0 additions & 1 deletion CVE-2025-66038.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ Originally reported by Harrison Green, from CMU. This testcase was discovered by
Patches provided by Jakub Jelen.

CVSS:3.1[/AV:P/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L](https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:P/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L) (3.9)

4 changes: 2 additions & 2 deletions Linux-Distributions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ A general and current overview is shown on [repology.org](https://repology.org/m
| Arch Linux | <https://archlinux.org/packages/extra/x86_64/opensc/> |
| Debian | <https://packages.debian.org/search?keywords=opensc> |
| Fedora | <https://src.fedoraproject.org/rpms/opensc> |
| RHEL/CentOS | |
| RHEL/CentOS | |
| Gentoo Linux | <https://packages.gentoo.org/packages/dev-libs/opensc> |
| SUSE LINUX | |
| SUSE LINUX | |
| Rock Linux | <http://www.rocklinux.net/packages/opensc.html> |
| OpenSuse | <https://software.opensuse.org/package/opensc> |
| Ubuntu | <https://packages.ubuntu.com/search?keywords=opensc> |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Microsoft Windows systems use CryptoAPI in native win32 applications that deal w
The situation is comparable to OpenSC itself, where the OpenSC framework takes care of the annoying parts and to support a new smart card, just a card specific driver needs to be implemented.

The smart card minidriver offers a shortcut compared to building a traditional cryptographic service provider (CSP). It does this by handling most of the complicated cryptographic tasks behind the scenes, saving the developer time and effort.
Available specifications can be found [here](https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn631754(v=vs.85)). The versions are:
Available specifications can be found in the [Microsoft smart card minidriver documentation](https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn631754(v=vs.85)). The versions are:

* version 5 of the minidriver specification applies to Windows XP (and Windows Vista),
* version 6 applies to Windows Vista,
Expand Down
2 changes: 1 addition & 1 deletion MaskTech-cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Features include:
- decrypt,
- digital signing.

More information can be found [here](http://masktech.com/Products/MTCOS-Professional/11/en).
More information can be found on the [MTCOS Professional product page](http://masktech.com/Products/MTCOS-Professional/11/en).
4 changes: 2 additions & 2 deletions OpenSC-@-FOSDEM-2011.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

| **Topic** | **Slides** | **Video** |
| --------- | ---------- | ------- |
| Setup, short introduction of presenters | [slides](./attachments/wiki/FOSDEM2011/FOSDEM_INTRO.pdf) | [video](http://video.fosdem.org/2011/devrooms/security/security_1300__intro__paljak.webm) |
| Setup, short introduction of presenters | [slides](./attachments/wiki/FOSDEM2011/FOSDEM_INTRO.pdf) | [video](http://video.fosdem.org/2011/devrooms/security/security_1300__intro__paljak.webm) |
| Smart card jungle | [slides](./attachments/wiki/FOSDEM2011/01_jean-michel.pdf) | [video](http://video.fosdem.org/2011/devrooms/security/security_1315__smartcard__poure.webm) |
| SSH libraries: SSH vs TLS; libssh | [slides](./attachments/wiki/FOSDEM2011/SSH_libraries.pdf) | [video](http://video.fosdem.org/2011/devrooms/security/security_1345__ssh__adamantiadis.webm) |
| libcurl: Supporting seven SSL libraries and one SSH library | | [video](http://video.fosdem.org/2011/devrooms/security/security_1415__libcurl__stenberg.webm) |
Expand All @@ -19,4 +19,4 @@

## Video Recordings

The videos can be downloaded one by one [here](https://video.fosdem.org/2011/devrooms/security/).
The videos can be downloaded one by one from the [FOSDEM 2011 video archive](https://video.fosdem.org/2011/devrooms/security/).
2 changes: 1 addition & 1 deletion OpenSC-@-FOSDEM-2012.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@

## Video Recordings

Videos can be downloaded one by one [here](https://video.fosdem.org/2012/devrooms/security/).
Videos can be downloaded one by one from the [FOSDEM 2012 video archive](https://video.fosdem.org/2012/devrooms/security/).
1 change: 1 addition & 0 deletions OpenSC-Release-Howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Optionally, discuss changes to `NEWS` by opening a [new issue](https://github.co
6. Wait for [artifacts to build](#build-and-test-binaries)
7. [Create a new release](#build-and-test-binaries)
8. Write [announcement](#announcement)

## Maintenance tasks

### Clean up old nightly builds repository
Expand Down
2 changes: 1 addition & 1 deletion OpenSSH-and-smart-cards-PKCS#11.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ...

## Interim "stable" X509/PKCS#11 solution

Alon Bar-Lev has a patch against OpenSSH which implements both X509 and PKCS#11 support. The patch was [not accepted to OpenSSH](https://bugzilla.mindrot.org/show_bug.cgi?id=1371) but is available from [here](http://sites.google.com/site/alonbarlev/openssh-pkcs11). The patch depends on `pkcs11-helper` (also by Alon Bar-Lev) and needs to be activated on compile time with `--with-pkcs11`.
Alon Bar-Lev has a patch against OpenSSH which implements both X509 and PKCS#11 support. The patch was [not accepted to OpenSSH](https://bugzilla.mindrot.org/show_bug.cgi?id=1371) but is available from [Alon Bar-Lev's openssh-pkcs11 page](http://sites.google.com/site/alonbarlev/openssh-pkcs11). The patch depends on `pkcs11-helper` (also by Alon Bar-Lev) and needs to be activated on compile time with `--with-pkcs11`.

Basic usage looks like this:

Expand Down
2 changes: 1 addition & 1 deletion Pinpad-Readers.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Class 3 readers have pinpad and a display.
| ------ | -- | ---- | -------------- | -------- |
| Smartboard G83-6700 | Win32 | Class2 PS/2 | CTMGR.DLL | A keyboard integrated reader which uses the keyboard for pin entry. Buggy CT-API driver, I got it working but not without patching OpenCT. No known Unix support |
| Gemalto | | | | |
| IDBridge CT700/710 (PC Pinpad) | Win32 & Linux | Class3 USB | PC/SC, ?? | CCID compliant. No special actions was needed to get it working on Linux and Win32. (Don't know if it's important - on Windows 'Gemalto Access' middleware was installed. --VTA) |
| IDBridge CT700/710 (PC Pinpad) | Win32 & Linux | Class3 USB | PC/SC, ?? | CCID compliant. No special actions was needed to get it working on Linux and Win32. (Don't know if it's important - on Windows 'Gemalto Access' middleware was installed. --VTA) |
| Reiner SCT | | | | |
| cyberJack keyboard | Win32 | Class2 PS/2 | CTRSCT32.DLL | A cheap class 2 solution. It uses the keyboard for pin entry. No known Unix support. |
| cyberJack pinpad | Win32 | Class2 USB | CTRSCT32.DLL | cyberJack {basic, pinpad, e-com 2.0} are [discontinued](https://www.reiner-sct.com/lang/en/alte-Treiber.html) |
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
This is an OpenSC wiki. Authoritative source for the wiki rendered on Github
OpenSC repository:

https://github.com/OpenSC/OpenSC/wiki
<https://github.com/OpenSC/OpenSC/wiki>

## Why?

It used to be accessible for everyone to edit, until we got some malicious
actors trying to sneak in malware download links.

Now, it lives in separate repository https://github.com/OpenSC/Wiki where
Now, it lives in separate repository <https://github.com/OpenSC/Wiki> where
we accept contributions through pull requests.

## How to update wiki
Expand All @@ -31,11 +31,14 @@ button on the wiki.
Once the commit is merged to this repository, it needs to be manually pushed
to the OpenSC wiki. Recommended approach is to configure the opensc wiki
remote in your git client:
```

```bash
git remote add opensc.wiki git@github.com:OpenSC/OpenSC.wiki.git
```

and once there is a change, pull it locally and push it to the opensc.wiki
```

```bash
git pull origin master
git push opensc.wiki
```
Expand Down
Loading
Loading