vletoux / GidsApplet

Generic Identity Device Specification Applet
GNU General Public License v3.0
102 stars 38 forks source link

Is it possible to create data objects in GIDS cards ? #16

Closed rayanboulares closed 2 years ago

rayanboulares commented 2 years ago

Well, this is not an issue and this may not be the most appropriate place to ask.

Is it possible using available tools (Microsoft Minidriver or OpenSC PKCS*- suite tools) to create data objects on a GIDS card? It seems I can create a file under mscp/ folder using Gemalto Minidriver tool, but I can't read or write these files using OpenSC tools.

Thank you in advance.

vletoux commented 2 years ago

The opensc utility can list files (https://github.com/OpenSC/OpenSC/blob/master/src/tools/gids-tool.c#L370) but working on files and directories is a work to do.

the api from Microsoft is easier to address. You have once a card is identified to find the mini driver dll, then load and initialize it. You can then query the file api. For example using cardreadfile (https://docs.microsoft.com/en-us/previous-versions/windows/desktop/secsmart/cardreadfile)

rayanboulares commented 2 years ago

I have been playing around with minidrivers this weekend. I found a C# wrapper for the minidriver and it worked fine (I can create and delete files and directories in your GIDS applet).

However, when I want to use raw Windows API I try to dumpbin /export the msclmd.dll library (both in System32 and in WoW64) I only find one exported function : CardAcquireContext. Is it normal? Even with OpenSC minidriver I only get this one symbol.

Where and how can I find and use all the other minidriver functions as defined in Cardmod.h and Windows Minidriver specification?

Merci d'avance

vletoux commented 2 years ago

CardAcquireContext(https://docs.microsoft.com/en-us/previous-versions/windows/desktop/secsmart/cardacquirecontext) returns a pointer to the other functions (https://docs.microsoft.com/en-us/previous-versions/windows/desktop/secsmart/card-data) They cannot be loaded using exports as usual.

vletoux commented 2 years ago

Also you’d better read the mini driver specification (https://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/sc-minidriver_specs_V6-final.docx - may not be the latest)

rayanboulares commented 2 years ago

It's much more clear now! Thank you Vincent.