Error n. -2147467259

6/5/2014 8:31:40 AM
Gravatar
Total Posts 8

Error n. -2147467259

Hi,

I need to created a webservice which implement ncryptoki library. For that test application i got the ncryptoki library trial version from this site. So i included that in my service. i am trying to call the service operation contract from an another application.But when i am trying to initialize the "cryptoki" with my HSM device's cryptoki.dll

cryptoki = new Cryptoki("cryptoki.dll");

 it throws an error Error n. -2147467259.

Why do that happen?

6/5/2014 10:10:43 AM
Gravatar
Total Posts 300
Ugo Chirico http://www.ugochirico.com

Re: Error n. -2147467259

When NCryptoki is used under a service (like IIS in your case) without a valid license the shareware MessageBox cannot appear (because the service is run under system user) and raises an exception 0x80004005.

With a valid license all works as expected.

6/5/2014 10:14:18 AM
Gravatar
Total Posts 8

Re: Error n. -2147467259

fine. Thanks for the replay.

6/18/2014 7:41:49 PM
Gravatar
Total Posts 1

Re: Error n. -2147467259

I'm getting this same error while running the TestNCryptoki.sln and trying to access from the full trial package.  I'm using Visual Studio 2013 and it crashes the Visual Studio IDE. 

 

It also gives me the same error while trying to access a hardware token's PKCS dll through Cryptoki Explorer. 

 

Is there a place I need to get a valid shareware license and install it?

6/25/2014 3:32:53 PM
Gravatar
Total Posts 8

Re: Error n. -2147467259

Hi,

I have added the license code and the product key to my code. But still the same error i'm getting.

The code is like this,

Cryptoki.Licensee = "lincesecode";
Cryptoki.ProductKey = "prodect key";

cryptoki = new Cryptoki("cryptoki.dll");

 

it throws the same error  "Error n. -2147467259" .

But in console application this codes works fine and it accepts the license.

6/26/2014 9:47:19 AM
Gravatar
Total Posts 300
Ugo Chirico http://www.ugochirico.com

Re: Error n. -2147467259

When the license is correctly set, this error is thrown when NCryptoki was not able to load the underlying PKCS#11.
Mainly, the LoadLibrary fails when trying to load your PKCS11 dll.

This may be do to one of the following:

1) IIS is working as a 64bit service (on a 64bit server) and you are trying to load a 32bit PKCS#11 dll

or

2) IIS doesn't have the permission to read and load your PKCS#11 dll or one of its dependencies

6/28/2014 10:48:31 AM
Gravatar
Total Posts 300
Ugo Chirico http://www.ugochirico.com

Re: Error n. -2147467259

Consider that the Web Service runs under specific IIS user.
Probably such a IIS user doesn't have the permissions to access the PKCS#11 dll or it cannot find it (did you set the absolute path or a relative path?)