DEVICE_ERROR when use newest beidpkcs11.dll

378 views
Skip to first unread message

Nhật Quang Nguyễn

unread,
Jun 10, 2015, 2:33:58 AM6/10/15
to eid-middl...@googlegroups.com

Hello,


I checkout and build Net.Pkcs11.dll from:

https://svn.code.sf.net/p/pkcs11net/code/trunk


I checkout and build beidpkcs11.dll from:

http://eid-mw.googlecode.com/svn/trunk

I use these dll for Examples project from sdk40_1306 (also read readme in Examples)


But I get an exception when run Slot[] slotlist = m.GetSlotList(true);

Net.Sf.Pkcs11.TokenException was unhandled

  HResult=-2146233088

  Message=DEVICE_ERROR

  Source=Net.Pkcs11

I use Windows 8.1 pro and VS2013

Wouter Verhelst

unread,
Jun 10, 2015, 5:08:48 AM6/10/15
to eid-middl...@googlegroups.com
Hi Nhật,

Without error logs, it's difficult to figure out what the problem is.

If you enable debug logs, you could look at that. To do so, create a
registry key HKCU\Software\BEID\logging\log_level, and set it to a
string value "debug", as well as a key
HKLM\Software\BEID\logging\log_dirname which you set to a directory in
which to create the log files (note: this should be a directory that
your user has write access to).

Also note, however, that the repository on google code is no longer
being updated. We've moved to github a while back:
https://github.com/Fedict/eid-mw

Regards,

On 10-06-15 05:52, Nhật Quang Nguyễn wrote:
> Hello,
>
>
> I checkout and build Net.Pkcs11.dll from:
>
> https://svn.code.sf.net/p/pkcs11net/code/trunk
>
>
> I checkout and build beidpkcs11.dll from:
>
> http://eid-mw.googlecode.com/svn/trunk
>
> I use these dll for Examples project from sdk40_1306 (also read readme
> in Examples)
>
>
> *But I get an exception when run** Slot[] slotlist = m.GetSlotList(true);*
>
> Net.Sf.Pkcs11.TokenException was unhandled
>
> HResult=-2146233088
>
> Message=DEVICE_ERROR
>
> Source=Net.Pkcs11
>
> I use Windows 8.1 pro and VS2013
>
> --
> You received this message because you are subscribed to the Google
> Groups "eID Middleware Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to eid-middleware-...@googlegroups.com
> <mailto:eid-middleware-...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--
Wouter Verhelst

Wouter Verhelst

unread,
Jun 10, 2015, 5:09:29 AM6/10/15
to eid-middl...@googlegroups.com
Er, that should both be under HKCU, of course (or HKLM, which works too,
but it's better to be consistent)

Nhật Quang Nguyễn

unread,
Jun 10, 2015, 5:36:23 AM6/10/15
to eid-middl...@googlegroups.com
Hi Wouter,
Thanks for your answer.

I checkout code from https://github.com/Fedict/eid-mw, but i cannot build because it miss beidversions.h.

Frederik Vernelen

unread,
Jun 10, 2015, 6:02:57 AM6/10/15
to eID Middleware Dev
Hello,

You can generate the versions file with following script:
eid-mw\scripts\windows\create_eidmw_version_files.cmd

Wkr,
 Frederik



> For more options, visit https://groups.google.com/d/optout.

--
Wouter Verhelst

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-...@googlegroups.com.

Nhật Quang Nguyễn

unread,
Jun 10, 2015, 6:29:14 AM6/10/15
to eid-middl...@googlegroups.com

Thanks fvernelen, I get file “beidpkcs11D.dll” after build it success, but still DEVICE_ERROR.

I try enable debug logs follow link http://test.eid.belgium.be/faq/faq_nl.htm#Hoe_kan_ik_logging_in_de_middleware_configureren.3F, but I don’t see BEID in Software.


Could you tell me something I miss.

> For more options, visit https://groups.google.com/d/optout.

--
Wouter Verhelst

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsub...@googlegroups.com.

Wouter Verhelst

unread,
Jun 10, 2015, 6:37:28 AM6/10/15
to eid-middl...@googlegroups.com
Hi Nhật,

That's possible; the installer does not create these registry entries.
If they don't exist, you'll need to create them yourself.

Regards,

On 10-06-15 12:29, Nhật Quang Nguyễn wrote:
> Thanks fvernelen, I get file “beidpkcs11D.dll” after build it success,
> but still DEVICE_ERROR.
>
> I try enable debug logs follow link
> http://test.eid.belgium.be/faq/faq_nl.htm#Hoe_kan_ik_logging_in_de_middleware_configureren.3F,
> but I don’t see BEID in Software.
>
> Could you tell me something I miss.
>
>
> On Wednesday, June 10, 2015 at 5:02:57 PM UTC+7, fvernelen wrote:
>
> Hello,
>
> You can generate the versions file with following script:
> eid-mw\scripts\windows\create_eidmw_version_files.cmd
>
> Wkr,
> Frederik
>
>
>
> On Wed, Jun 10, 2015 at 11:36 AM, Nhật Quang Nguyễn
> <quang.s...@gmail.com <javascript:>> wrote:
>
> Hi Wouter,
> Thanks for your answer.
>
> I checkout code from https://github.com/Fedict/eid-mw
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FFedict%2Feid-mw&sa=D&sntz=1&usg=AFQjCNGh26m6u1-upf5xEhhIF9rqkdsOGA>,
> > an email to eid-middleware-...@googlegroups.com
> > <mailto:eid-middleware-...@googlegroups.com>.
> > For more options, visit
> https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
> --
> Wouter Verhelst
>
> --
> You received this message because you are subscribed to the
> Google Groups "eID Middleware Dev" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to
> eid-middleware-...@googlegroups.com <javascript:>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "eID Middleware Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to eid-middleware-...@googlegroups.com
> <mailto:eid-middleware-...@googlegroups.com>.

Nhật Quang Nguyễn

unread,
Jun 10, 2015, 6:44:43 AM6/10/15
to eid-middl...@googlegroups.com

Thanks Wouter, I get error logs.


2015-06-10 17:40:40 - 5044|4756 - cardlayer - DEBUG:     SCardEstablishContext(): 0x0

2015-06-10 17:40:40 - 5044|4756 - cardlayer - DEBUG:     SCardListReaders(): 0x0

2015-06-10 17:40:40 - 5044|4756 - cardlayer - DEBUG:     SCardConnect(ACS CCID USB Reader 0): 0x0

2015-06-10 17:40:40 - 5044|4756 - cardlayer - DEBUG:     SCardBeginTransaction(0xea010000): 0x0

2015-06-10 17:40:40 - 5044|4756 - cardlayer - DEBUG:       SCardTransmit(00 A4 04 0C 0C A0 00 00 01 77 .. 43 53 2D 31 35)

2015-06-10 17:40:42 - 5044|4756 - cardlayer - DEBUG:         SCardTransmit(): 0x8010002f

2015-06-10 17:40:42 - 5044|4756 - cardlayer - DEBUG:     SCardEndTransaction(0xea010000): 0x0

2015-06-10 17:40:42 - 5044|4756 - cardlayer - INFO:  Connected to unknown card in reader ACS CCID USB Reader 0

2015-06-10 17:40:42 - 5044|4756 - cardlayer - DEBUG:     ReaderStatus(): card inserted

>              > an email to eid-middleware-dev+unsub...@googlegroups.com
>              > <mailto:eid-middleware-dev+unsub...@googlegroups.com>.
>              > For more options, visit
>             https://groups.google.com/d/optout
>             <https://groups.google.com/d/optout>.
>
>             --
>             Wouter Verhelst
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "eID Middleware Dev" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         eid-middleware-dev+unsub...@googlegroups.com <javascript:>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "eID Middleware Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to eid-middleware-dev+unsub...@googlegroups.com
> <mailto:eid-middleware-dev+unsub...@googlegroups.com>.

Frederik Vernelen

unread,
Jun 11, 2015, 5:33:41 AM6/11/15
to eID Middleware Dev
Hello Nhat,

Thank you for the error log,

About error 0x8010002f:
// A communications error with the smart card has been detected. Retry the operation.
#define SCARD_E_COMM_DATA_LOST           _HRESULT_TYPEDEF_(0x8010002FL)

It appears like the card did not respond to the seect BELPIC AID APDU.
Is it well placed within the card reader?
Can you read the card's contents with the eID Viewer?




>              > an email to eid-middleware-...@googlegroups.com
>              > <mailto:eid-middleware-...@googlegroups.com>.
>              > For more options, visit
>             https://groups.google.com/d/optout
>             <https://groups.google.com/d/optout>.
>
>             --
>             Wouter Verhelst
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "eID Middleware Dev" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         eid-middleware-...@googlegroups.com <javascript:>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "eID Middleware Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> For more options, visit https://groups.google.com/d/optout.

--
Wouter Verhelst

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-...@googlegroups.com.

Nhật Quang Nguyễn

unread,
Jun 15, 2015, 7:15:39 AM6/15/15
to eid-middl...@googlegroups.com

Thank you for answer,

This error occur when I put the card not BEID.
Now, I put BEID card then an error occur:

Exception Type: Net.Sf.Pkcs11.TokenException

Exception Message: CRYPTOKI_NOT_INITIALIZED

Stack Trace:    at Net.Sf.Pkcs11.Wrapper.Pkcs11Module.GetSlotList(Boolean tokenPresent)

   at Net.Sf.Pkcs11.Module.GetSlotList(Boolean onlyTokenPresent)

>              > an email to eid-middleware-dev+unsub...@googlegroups.com
>              > <mailto:eid-middleware-dev+unsub...@googlegroups.com>.
>              > For more options, visit
>             https://groups.google.com/d/optout
>             <https://groups.google.com/d/optout>.
>
>             --
>             Wouter Verhelst
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "eID Middleware Dev" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         eid-middleware-dev+unsub...@googlegroups.com <javascript:>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "eID Middleware Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> For more options, visit https://groups.google.com/d/optout.

--
Wouter Verhelst

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsub...@googlegroups.com.

Frederik Vernelen

unread,
Jun 16, 2015, 4:58:21 AM6/16/15
to eID Middleware Dev
hello Nhat,

Could you describe the case where you see this CRYPTOKI_NOT_INITIALIZED exception?

Normally this means that the pkcs11 module isn't initialzied yet, so could it have been finalized after the exception raised by the other smart card that did not answer?

Wkr,
 Frederik

>              > an email to eid-middleware-...@googlegroups.com
>              > <mailto:eid-middleware-...@googlegroups.com>.
>              > For more options, visit
>             https://groups.google.com/d/optout
>             <https://groups.google.com/d/optout>.
>
>             --
>             Wouter Verhelst
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "eID Middleware Dev" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         eid-middleware-...@googlegroups.com <javascript:>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "eID Middleware Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> For more options, visit https://groups.google.com/d/optout.

--
Wouter Verhelst

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-...@googlegroups.com.

Nhật Quang Nguyễn

unread,
Jun 17, 2015, 10:14:30 PM6/17/15
to eid-middl...@googlegroups.com

Thank your quickly response,

Exactly, it have been disposed before I call GetSlotList.

>              > an email to eid-middleware-dev+unsub...@googlegroups.com
>              > <mailto:eid-middleware-dev+unsub...@googlegroups.com>.
>              > For more options, visit
>             https://groups.google.com/d/optout
>             <https://groups.google.com/d/optout>.
>
>             --
>             Wouter Verhelst
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "eID Middleware Dev" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         eid-middleware-dev+unsub...@googlegroups.com <javascript:>.
>         For more options, visit https://groups.google.com/d/optout
>         <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "eID Middleware Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> For more options, visit https://groups.google.com/d/optout.

--
Wouter Verhelst

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "eID Middleware Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages