Hi,
the error 209 (0xD1) means CKR_TEMPLATE_INCONSISTENT (you can see all the error codes in the class CryptokiException)
This error means that the template you used in the call to GenerateKeyPair has some invalid or missing attributes.
The sample code I supply together with NCryptoki shows how to call GenerateKeyPair for a generic token/HSM with a minimum set of attributes, but each token/HSM wants a specific set of attributes in the tamplate (for example CKA_SENSITIVE set to true or CKA_MODIFIABLE set to true).
Read the documentation of your HSM to know what attributes are needed.
Regards,
Ugo Chirico