Is it possible to define PKCS15 structure from scratch?

270 Views Asked by At

I'm playing with smartcards and I'm wonderig if it is possible to define pkcs15 structure from scratch. Syntax of https://github.com/OpenSC/OpenSC/blob/master/src/pkcs15init/pkcs15.profile is undocumented, but I think I might achieve what I wan't by editing it. Do you have any clues what to start with? Also side question is, if it is possible to read/write arbitrary files with opensc?

Usecase

Lets assume that we want to initialize card with a one pregenerated private and public key where user will be only allowed to sign when authorized by PIN.

1

There are 1 best solutions below

4
On

Yes, of course it is possible to define a PKCS#15 structure from scratch. The rules for the structure are specified in the PKCS#15 standard. I think that if you get to know the standards that the options in pkcs15.profile are relatively easy to understand. Otherwise I would just start playing around with it.

OpenSC is probably not geared to writing arbitrary files, but as you can see it does allow you to set the File ID etc. per file. So it seems obvious that some kind of functionality exists, and otherwise it is easy to find it in the source code.