Re: [eid-mw-dev] Delphi: suspecte problème de paramètres

355 views
Skip to first unread message

Frederik Vernelen

unread,
Oct 2, 2012, 11:47:03 AM10/2/12
to Olivier, eid-middl...@googlegroups.com
Hello,

The beidLib.dll is part of the eIDMW SDK 3.5
The pdf you mention is documentation of the eIDMW SDK 2.5

Both these SDK's are outdated (needed dll's are still shipped with the new eIDMW releases for backward compatibility, but we probably won't keep doing that)

The documentation of the eID SDK 3.5 (as well as the new eID SDK 4.0) can be found here : http://eid.belgium.be/fr/developper_des_applications_eid/eid_software_development_kit/

I've had a look in the old SDK's code, in the eID SDK 3.5 these functions are used to fetch the values you are after:

    BEIDSDK_API const char *getLocationOfBirth();        /**< Return Location Of Birth field */
    BEIDSDK_API const char *getValidityBeginDate();        /**< Return Validity Begin Date field */
    BEIDSDK_API const char *getValidityEndDate();        /**< Return Validity End Date field */
    BEIDSDK_API const char *getIssuingMunicipality();    /**< Return Issuing Municipality field */
    BEIDSDK_API const char *getZipCode();                /**< Return Zip Code field */

Wkr,
 Frederik


2012/10/2 Olivier <stockh...@gmail.com>
Bonjour,

Je réalise une application en Delphi pour pouvoir récupérer les infos de la carte d'identité.

J'ai créer un wrapper sur la dernière DLL beidLib.dll datant du 16/05/2012 15:32 récupérée après l’installation du "eID Viewer".

Tout se passe bien pour récupérer les infos de la carte d'identité sauf pour certaines.
J'ai trouvé un pdf (developers kit 25) avec la liste des valeurs des paramètres expliqués mais avec le passage de certains paramètres, je n'ai pas de valeur de retour !

Exemple:
 
private
mapID: IMapCollection;
certificateCheck: ICertifCheck;
plHandle: integer
...
...Init(strReaderName, 0, 0, plHandle);
...GetID(mapID, certificateCheck);
ShowMessage(mapID.GetValue('BirthLocation'))
<-- mapID.GetValue('BirthLocation') ne renvoie rien !
 
mapID.GetValue('Municipality') <-- idem: ne renvoie rien ! //Commune de délivrance de la carte
mapID.GetValue('ValidityDateBegin'); <-- idem: ne renvoie rien ! //Date de début de validité de la carte
mapID.GetValue('ValidityDateEnd'); <-- idem: ne renvoie rien ! //Date de fin de validité de la carte

Je devine un changement dans les noms des paramètres (string) à passer. (clé dans la map java vu le nom de l'interface car je suppose du java côté serveur)
A l'aveugle, j'ai testé de remplacer 'Sex' qui ne renvoyait rien par 'Gender' et la ça a fonctionné.

J'ai le même problème avec:

mapAddress: IMapCollection;
...GetAddress(mapAddress, certificateCheck);
mapAddress.GetValue('Zip'); <-- idem: ne renvoie rien ! //Code postal

Un document a été publié au moniteur Belge : http://www.ksz-bcss.fgov.be/binaries/documentation/fr/documentation/appareils_lecture_carte_sis/annexe_ar130298.pdf
et avec ces paramètres, là, ça ne fonctionne pas. Ce document contient des erreurs et la valeurs des paramètres (string) ne sont plus les bons.
Y-a-t-il une nouvelle version de ce document avec les nouvelles valeurs des paramètres ?


En résumé: Quel sont les valeurs que dois-je donner à getValue pour avoir:

1) le lieu de naissance
2) la commune de délivrance de la carte
3) la date de début de validité de la carte
4) la date de fin de validité de la carte
5) le code postal

Merci d'avance

Olivier.
 
 


Olivier

unread,
Oct 3, 2012, 4:10:27 AM10/3/12
to eid-middl...@googlegroups.com, Olivier
Hello Frederik and thank you for your help.

If the EID SDK 3.5 is outdated. How use SDK 4.0 with Delphi ?
As i can see, the documentation don't explain that.
Which file, dll must be included in my project ?

Is there an exemple of code for using this sdk with Delphi ?

Best regards,
Olivier

Frederik Vernelen

unread,
Oct 3, 2012, 4:24:06 AM10/3/12
to Olivier, eid-middl...@googlegroups.com
Hello Olivier,

We do not ship Delphi examples with this SDK.

In order to use it with Delphi, you need a Delphi pkcs#11 wrapper.
Our  pkcs#11 C lib is called "beidpkcs11.dll", and you can find it in the system32 (or sysWOW64) folder.

On wikipedia (http://en.wikipedia.org/wiki/PKCS_%E2%99%AF11), there is one Delphi pkcs#11 wrapper mentioned (http://www.sdean12.org/), but I have no experience with it.

Wkr,
 Frederik

Olivier

unread,
Oct 3, 2012, 6:18:12 AM10/3/12
to eid-middl...@googlegroups.com, Olivier

Thank you again Frederik for your help.

The wrapper mentionned on wikipedia is not a wrapper but an explorer.
I have made a screenshot: See attachment

With this tool, i can't create a wrapper for the dll to include in my Delphi project.
i have searched on google for others Delphi wrapper for PKCS#11 and i have not found.

Is there any other solution for using this SDK4.0 with Delphi ?

Best regards,
Olivier


PKCS#11Explorer.png

Frank Marien

unread,
Oct 3, 2012, 6:32:59 AM10/3/12
to eid-middl...@googlegroups.com
Olivier,

To use the 4.X SDK you definitely need to be able to use PKCS#11
libraries from
your environment, there is no other way to approach it..

On the bright side:

The WP article mentions Sarah Dean's Components,
and I suspect that the explorer found there is built using
SDeanComponents, available from the same site:

http://www.sdean12.org/zipped2/SDeanComponents28900.zip

In

Components/SDeanSecurity/PKCS#11 I find what I *think* is a pkcs11 wrapper.

(If the explorer works for you, and it is built on that wrapper,
that means that wrapper must work :-))

Disclaimer: I don't know the first thing about Delphi.. So I'm really
guessing, trying to help..

-f

Frederik Vernelen

unread,
Oct 3, 2012, 7:06:51 AM10/3/12
to Olivier, eid-middl...@googlegroups.com
Hi Oliver,

I believe the pkcs11 explorer is their example on how to use the Delphi wrapper.
The wrapper itself is in "SDeanComponents28900.zip\Components\SDeanSecurity\PKCS#11"

According to their site, the explorer shows how to:

PKCS#11 Explorer is a tool for examining the contents of PKCS#11 tokens (e.g. USB tokens and smartcards), and for carrying out various simple operations on them, including (but not limited to):
  • Set and change PINs
  • List all slots offered by PKCS#11 interface
  • Show all objects stored
  • Create test keys
  • Create data objects, view existing objects and all their properties
  • Copy objects, set labels
  • Seed and generate random data
  • Initialize tokens
  • Monitor token insertion/removal
  • Show all mechanisms supported (including their properties)

Wkr,
 Frederik

Olivier

unread,
Oct 3, 2012, 7:47:02 AM10/3/12
to eid-middl...@googlegroups.com, Olivier
Thank you very much Frank and Frederik

Effectively the PKCS#11 Explorer call methods in files in Components/SDeanSecurity/PKCS#11

But how "bind" this with SDK4.0 ?

As i can see in the developers guide: http://eid.belgium.be/fr/binaries/UPD_Developers_Guide_tcm226-112228.pdf (end P5, start P6)
I have no "folder SDK" in the following directory: C:\Documents and Settings\<user>\My Documents\Belgium Identity Card SDK

I don't have a .msi when i download the latest SDK when i follow links:
http://code.google.com/p/eid-mw/wiki/SDK40
http://eid-mw.googlecode.com/files/sdk40_1306.zip
This archive does'nt contain a file .msi.

In which folder is your SDK 4.0 ?

Thanks again in advance...

Best Regards
Olivier.


Frederik Vernelen

unread,
Oct 3, 2012, 8:39:34 AM10/3/12
to Olivier, eid-middl...@googlegroups.com
You're welcome.

Its best not to look at the older developers guide anymore (it doesn't contain info about the SDK 4.0)
Our SDK (docs + some C and C# examples) is the zip you mention: http://eid-mw.googlecode.com/files/sdk40_1306.zip

The lib you want to link with is "beidpkcs.dll", which you can find in your windows/system32 folder (on a 64 bit system, you can find the 32 bit version in windows/sysWOW64).

How to link the wrapper with beidpkcs11.dll you can find in the "pkcs11 explorer" example. (as seen in your screenshot, which contained methods, info, and api from our pkcs11)

Wkr,
 Frederik

Olivier

unread,
Oct 3, 2012, 11:33:59 AM10/3/12
to eid-middl...@googlegroups.com, Olivier
Again thanks you for your help.

The wrapper for pkcs#11 you have found on http://www.sdean12.org/ is for Delphi 2007.
I have talking with a collegue programmer, and there is a lot of changement to do in this code for use it with my version of Delph: Delphi XE.

Then, i keep my first version of my program with SDK 3.5

I just need some information that are missing because i don't known which value for the parameter string i must given.

In response with the first message from Frederik in this topic:



    BEIDSDK_API const char *getLocationOfBirth();        /**< Return Location Of Birth field */
    BEIDSDK_API const char *getValidityBeginDate();        /**< Return Validity Begin Date field */
    BEIDSDK_API const char *getValidityEndDate();        /**< Return Validity End Date field */
    BEIDSDK_API const char *getIssuingMunicipality();    /**< Return Issuing Municipality field */
    BEIDSDK_API const char *getZipCode();                /**< Return Zip Code field */
I can't get access to these functions because in Delphi i can't use this DLL.

Then i will be grateful if you could give me the value i must put in my string for have a value in return.
All work except this 5 cases: Location Of Birth, Validity Begin Date, Issuing Municipality field, Zip Code

Exemple who work: (idem than code in first post)

mapID.GetValue('BirthDate'); // return the date of birth
mapID.GetValue('CardNumber'); // return the card number

signature of the method: getValue(const strKey: WideString)
I have found all others values on the "old" documentation : http://www.uvcw.be/no_index/e-communes/dossier_eid/Belgian_eid_run-time_developers_kit%2025.pdf
on pages 6 and 7.

Best Regards,
Olivier





Olivier

unread,
Oct 3, 2012, 11:59:58 AM10/3/12
to eid-middl...@googlegroups.com
if there is an "edit button" for posts, i don't find it, sorry...

If
there is a pdf or other document to show me the correct value to put in the settings, could you give me a link to this.


Thank you,

Best regards,
Olivier

Frederik Vernelen

unread,
Oct 3, 2012, 1:54:06 PM10/3/12
to Olivier, eid-middl...@googlegroups.com
Are these working?

BirthDate
IssuingMunicipality
EndValidityDate
BeginValidityDate
BirthPlace
ZIPCode

From: http://code.google.com/p/eid-mw/source/browse/branches/4_0_4/eid-mw/_src/beid-2.6/doc/DeveloperGuide.doc

Olivier

unread,
Oct 4, 2012, 3:53:46 AM10/4/12
to eid-middl...@googlegroups.com, Olivier
Thanks you Frederik, it's work with these values of parameter.
I have a good result and a functional solution.

Now, i wonder how make a solution for use the last SDK 4.0.

Maybe create a C# DLL(that use SDK 4.0 and write methods to get: name, surname, address and picture, ...(certificate not needed)) and call it from my Delphi application. I don't know if it is possible... I search about it on Google...

Best regards.
Olivier

Olivier

unread,
Oct 5, 2012, 11:49:04 AM10/5/12
to eid-middl...@googlegroups.com, Olivier
Ok, I stop devlopment here.
I will use SDK 3.5.
SDK4.0 will take too much time with adaptation for Delphi.
I hope there will be soon a support and exmples of code for SDK4.0 and Delphi XE.

Best regards,
Olivier
Reply all
Reply to author
Forward
0 new messages