pkcs11-tool: check for buffer overflows

Check the subject, issuer and serialNumber will encode in the allocated
space before copying the data.

Thanks to Umberto Rustichelli for the bug report
https://sourceforge.net/p/opensc/mailman/message/32210626/
Fix memory leak, sc_pkcs15_cert_t *cert is never freed
Mention that create_slots_for_pins can be used to get opensc-onepin behavior.
Remove the bogus javacard "driver".

I had some ideas on how to improve the experience for JavaCards
but that path did not get implemented further and my approach now
is very different.

While it would be nice if OpenSC (command line) detected
somehow blank JavaCard-s and informed the user that steps a-b-c
should be taken to make use of it, it doesn't really fit in.
Set missing default create_slots_flags.

Without this pkcs11 cant be used without a configuration file
or a configfile without pkcs11 block due to the missing initialization
of default flag.
Call dlclose() only when having a valid handle.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
fixed PUK handling

Note that
`SC_PKCS15_PIN_AUTH_TYPE_PIN` is used for `sc_pkcs15_auth_info_t.auth_type`
`SC_PKCS15_TYPE_AUTH_PIN`     is used for `sc_pkcs15_object_t.type`
When setting pointers to a template, ensure they do not get out of scope prior of being used.

This was causing issues when using pkcs11-tool with opencryptoki:
https://bugzilla.redhat.com/show_bug.cgi?id=1062307

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
EstEID: match card only based on presence of application.

Contact cards have ATR-s, contactless not. Only contact
cards should be broken so that they answer 0x9000 to application
selection, so this should be failsafe.