C++ library for performing cryptographic operations with electronic identification (eID) cards.
Currently supports Finnish, Estonian, Latvian and Lithuanian eID cards. Please submit an issue if you want to request support for your country's eID card.
If possible, communicates with the eID card directly via PC/SC using APDUs according to the card specification.
When APDU communication is not possible (e.g. Lithuanian eID), uses PKCS#11 and requires the corresponding PKCS#11 module to be installed.
Example how to automatically select and connect to a supported eID card, and read the authentication certificate:
const auto cardInfo = autoSelectSupportedCard();
std::cout << "Reader " << cardInfo->reader().name << " has supported card "
<< cardInfo->eid().name();
const auto certificateBytes = cardInfo->eid().getCertificate(CertificateType::AUTHENTICATION);
See more examples in tests.
apt install build-essential pkg-config cmake libgtest-dev valgrind libpcsclite-dev
sudo bash -c 'cd /usr/src/googletest && cmake . && cmake --build . --target install'
cd build
cmake .. # optionally with -DCMAKE_BUILD_TYPE=Debug
cmake --build . # optionally with VERBOSE=1
Build as described above, then run inside build
directory:
ctest # or 'valgrind --leak-check=full ctest'
ctest
runs tests that use the libscard-mock library to mock PC/SC API calls.
There are also integration tests that use the real operating system PC/SC
service, run them inside build
directory with:
./libpcsc-cpp-test-integration
- Format code with
scripts/clang-format.sh
before committing - See docs/DEVELOPMENT.md