Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Openssl, engine_pkcs11, libp11/OpenSC

Friends, I have a smart card, which I want to integrate OpenSSL. Plan to do this through a system of "ENGINE" in OpenSSL. However, I have a problem with understanding. The fact that there are such things as engine_pkcs11, opensc, libp11, pkcs11-helper. Can anyone explain the relationship? What is and what to compile in the first place?

Is it enough to write me a library with external PKCS # 11 functions to connect it to openssl? I have to take the source code of the library engine_pkcs11 and modify it to fit my card? Do I need this opensc, libp11, pkcs11-helper? Why, then, need these libraries?

Also, I should note that the smart card does not support RSA-algorithm, it will be a different algorithm!!!!

Really looking forward to your answers!

like image 584
user1650740 Avatar asked Oct 18 '13 18:10

user1650740


People also ask

What is libp11?

libp11 is a helper library designed to make it easier to use PKCS#11 in applications without having to program to the PKCS#11 API.

Does OpenSSL support pkcs11?

OpenSSL HSM SupportOpenSSL does not have native support for PKCS#11. It can provide PKCS#11 support through the OpenSC's project pkcs11 engine (formerly known as engine_pkcs11 ). As such software intended to use HSMs, must utilize that engine.

What is pkcs11 engine?

PKCS11 (Public-Key Cryptography Standards), also known as “Cryptoki” or PKCS#11, is an API used to communicate with cryptographic security tokens such as smart cards, USB keys, and Hardware Security Modules (HSMs).


1 Answers

The openssl engine for pkcs#11 by OpenSC is needed to make interaction between openssl and smartcard by pkcs#11 possible.

The engine is built on top of libp11 by OpenSC, an abstraction/wrapper layer/interface, built on pkcs#11 standard API for utility purpose.

From top to bottom we have:

  • openssl (by Openssl)
  • openssl pkcs#11 engine (by OpenSC)
  • libp11 (by OpenSC)
  • pkcs#11 standard api (by RSA Laboratories)
  • pkcs#11 module (by Smartcard vendor)

So in an optimum case you have only to write the pkcs#11 module for you specific smartcard hardware and then load it using pkcs#11 engine.

The problem here is that pkcs#11 engine, at the moment, support only CKM_RSA_PKCS, so, probably, you have also to extend the current pkcs#11 openssl engine.

More info at https://github.com/OpenSC/OpenSC/wiki

like image 105
lgaggini Avatar answered Sep 18 '22 17:09

lgaggini