Attach NCryptoki to native PKCS#11 dll

Modified on 2010/11/08 17:03 by Administrator — Categorized as: Uncategorized

To attach NCryptoki to a native PKCS#11 dll you have first to locate the PKCS#11 dll of your token. In the snippets below NCryptoki is instanciated and attached to the PKCS#11 dll "smaoscki.dll". To attach it to your dll you have to change "smaoscki.dll" with the path to PKCS#11 dll of your token:

// Creates a Cryptoki object and attach it to the PKCS#11 native library smaoscki.dll 
Cryptoki cryptoki = new Cryptoki("smaoscki.dll");
int nRet = cryptoki.Initialize();
if (nRet != 0)
{
     error(nRet);
}