Reading of eID data while being logged in on Windows with another smartcard.

1,304 views
Skip to first unread message

Stijn Staelens

unread,
Jul 12, 2018, 8:28:38 AM7/12/18
to eID Middleware Dev
Hello,

When I'm logged on with a smartcard on windows and then try to read my eID data with the eID viewer no data is read.
Log:
D: CSCblogtest called Handling state transition for event TOKEN_REMOVED
D: CSCblogtest called Leaving state TOKEN_ERROR
D: CSCblogtest called Leaving state TOKEN
D: CSCblogtest called Entering state READY (target)
D: CSCbnewstate called STATE_READY
D: CSCblogtest called Entering state NO_TOKEN (parent)
D: CSCbNewSrc called EID_VWR_SRC_NONE
D: CSCblogtest called State transition for TOKEN_REMOVED complete
D: CSCblogtest called Handling state transition for event TOKEN_INSERTED
D: CSCblogtest called Leaving state READY
D: CSCblogtest called Leaving state NO_TOKEN
D: CSCblogtest called Entering state TOKEN (target)
D: CSCbnewstate called STATE_TOKEN
D: CSCblogtest called C_OpenSession(slot, 0x00000004, 0, 0, &session) returned 0x6
D: CSCblogtest called Entering state TOKEN_ID (child)
D: CSCbnewstate called STATE_TOKEN_ID
D: CSCblogtest called C_FindObjectsInit(session, &attr, 1) returned 0xb3
D: CSCblogtest called Handling state transition for event STATE_ERROR
D: CSCblogtest called Leaving state TOKEN_ID
D: CSCblogtest called C_FindObjectsFinal(session) returned 0xb3
D: CSCblogtest called Entering state TOKEN_ERROR (target)
D: CSCbnewstate called STATE_TOKEN_ERROR
D: CSCblogtest called State transition for STATE_ERROR complete
D: CSCblogtest called State transition detected, aborting handling of TOKEN_INSERTED

When I select the cardreader in the File menu. The card can be read.

I developed an application that reads the data of the eID, this worked fine until I started logging in to windows with a smartcard.
I downloaded the samples from github (https://github.com/Fedict/eid-mw/tree/master/doc/sdk/examples/CS) and tried it with that code. This also failed. (My code was roughly the same as the example).
In the code there is this bit:
  Slot[] slotlist = m.GetSlotList(true);
               
if (slotlist.Length > 0)
               
{
                   
Slot slot = slotlist[0];
...

This sets the slot to use to the first slot in the array. In my case there are 2 slots in the array. The first one is the cardreader with my eID in. So this should be correct, at least I think is should be correct.
The code fails on this line:
session.FindObjectsInit(new P11Attribute[] { classAttribute, labelAttribute });
With error: Net.Sf.Pkcs11.TokenException: 'DEVICE_ERROR'

Any idea what is going wrong?

Thanks in advance.

Stijn.
Auto Generated Inline Image 1

Frederik Vernelen

unread,
Jul 12, 2018, 8:46:01 AM7/12/18
to eID Middleware Dev
Hello Stijn,

Thank you for reporting these issues.

In regards to the problems you see with the eID Viewer: 
I fixed some race conditions there recently that can explain this behaviour, but they haven't made it into an online viewer build yet.
I'll try to put one online next week.

Are you using Windows Hello for Business to log into Windows with a smart card?
These device errors are common when trying to communicate with a device that's no longer there, but we've seen them too e.g. when trying to communicate with some emulated card readers (hence my question above).

Wkr,
 Frederik









--
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.

Stijn Staelens

unread,
Jul 12, 2018, 10:11:53 AM7/12/18
to eID Middleware Dev
Hi Frederik,
Thanks for the response. I'm looking forward to the new build next week of the eID Viewer.

We're not using Windows Hello for Business. We're using a Yubico Yubikey4.

Stijn

Op donderdag 12 juli 2018 14:46:01 UTC+2 schreef fvernelen:

Stijn Staelens

unread,
Aug 13, 2018, 9:18:24 AM8/13/18
to eID Middleware Dev
Frederik,

I'm back on this. Were you able to update the eID viewer? I downloaded the new version. But I'm getting the same result.


Op donderdag 12 juli 2018 14:28:38 UTC+2 schreef Stijn Staelens:

Frederik Vernelen

unread,
Aug 27, 2018, 7:15:23 AM8/27/18
to stijn.s...@gmail.com, eID Middleware Dev
Hello Stijn,

Yes, these changes are present in version 4.4.5 of the eID Viewer, currently available as beta download.



--
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.

Stijn Staelens

unread,
Aug 29, 2018, 5:49:18 AM8/29/18
to eID Middleware Dev
Frederik,

I tried the new version, but this didn't solve my problem. If I don't select the cardreader in the e-id viewer I can't read the e-id. From code I select the first slot (the cardreader) but I still get an error.


Op donderdag 12 juli 2018 14:28:38 UTC+2 schreef Stijn Staelens:
Hello,

Frederik Vernelen

unread,
Aug 29, 2018, 10:17:07 AM8/29/18
to Stijn Staelens, eID Middleware Dev
Hello Stijn, 

Thanks for testing.
I can reproduce the issue with a bank card and found the bug.
I hope to present you with a solution next week (I have a few holidays comming up)

Wkr,
 Frederik

--

Stijn Staelens

unread,
Aug 30, 2018, 7:41:31 AM8/30/18
to eID Middleware Dev
Frederik,

Nice, thanks. I'm looking forward to it. Have a nice holiday :)

Stijn.

Op donderdag 12 juli 2018 14:28:38 UTC+2 schreef Stijn Staelens:
Hello,

Frederik Vernelen

unread,
Sep 13, 2018, 5:22:44 AM9/13/18
to Stijn Staelens, eID Middleware Dev
Hello Stijn,

I've just put the new eID Viewer online (version 4.4.7).
If you'd like to test with it?

Wkr,
 Frederik


--

Stijn Staelens

unread,
Sep 13, 2018, 6:21:55 AM9/13/18
to eID Middleware Dev
Thanks Frederik,

The eID viewer seems to work now. I copied the dll to my code, but it still isn't working.
Is there something I need to do on my end? Before I started using the yubikey, my code worked.

This is the piece of code I'm using:

 public string GetData(String label, Boolean displayBytes)
       
{
           
String value = "";
           
if (m == null)
           
{
                m
= Module.GetInstance(mFileName);
           
}
           
           
try
           
{
             
               
Info i = m.GetInfo();

               
Slot[] slotlist = m.GetSlotList(true);
               
if (slotlist.Length > 0)
               
{
                   
Slot slot = slotlist[0];

                 
                   
                   
Session session = slot.Token.OpenSession(true);

               
                   
ByteArrayAttribute classAttribute = new ByteArrayAttribute(CKA.CLASS);
                    classAttribute
.Value = BitConverter.GetBytes((uint)Net.Sf.Pkcs11.Wrapper.CKO.DATA);


                   
ByteArrayAttribute labelAttribute = new ByteArrayAttribute(CKA.LABEL);
                    labelAttribute
.Value = System.Text.Encoding.UTF8.GetBytes(label);      


                    session
.FindObjectsInit(new P11Attribute[] { classAttribute, labelAttribute });
                    P11Object
[] foundObjects = session.FindObjects(50);
                   
int counter = foundObjects.Length;
                   
Data data;
                   
while (counter > 0)
                   
{
                       
                        data
= foundObjects[counter - 1] as Data;
                       
                       
if (label != null)
                           
Console.WriteLine(label);
                       
if (data.Value.Value != null)
                       
{
       
                           
if (displayBytes == true)
                           
{
                                value
= BitConverter.ToString(data.Value.Value);
                                value
= value.Replace("-", "");
                           
}
                           
else
                           
{
                                value
= System.Text.Encoding.UTF8.GetString(data.Value.Value);
                           
}
                           
Console.WriteLine(value);
                       
}
                        counter
--;
                   
}
                    session
.FindObjectsFinal();
               
}
               
else
               
{
                   
Console.WriteLine("No card found\n");
               
}
           
}
           
finally
           
{
               
// pkcs11 finalize
                m
.Dispose();//m.Finalize_();
           
}
           
return value;
       
}




Op donderdag 13 september 2018 11:22:44 UTC+2 schreef fvernelen:
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsub...@googlegroups.com.

Frederik Vernelen

unread,
Sep 13, 2018, 7:08:59 AM9/13/18
to Stijn Staelens, eID Middleware Dev
Hi Stijn,

Yes, you need to check if the token in the slot that is returned is in fact an eID card.

In C its calling  C_GetTokenInfo(*slotID, &tokenInfo) and checking if the return code is not CKR_TOKEN_NOT_RECOGNIZED
  

I'll update our C# examples when I find the time, but you can check this by asking for the tokeninfo (if it returns token not recognized, you know its not an eID card).

Don't you get a TokenException(CKR_TOKEN_NOT_RECOGNIZED) thrown now when you try to open a session with this non-eID card?
Session session = slot.Token.OpenSession(true)  
So if you catch this exception (perhaps in a new function where you try this opensession or GetTokenInfo) or the one from "public CK_TOKEN_INFO GetTokenInfo(uint slotID)", you know it was not an eID card, and you can try the next token found.

Wkr,
 Frederik


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.

Stijn Staelens

unread,
Sep 13, 2018, 8:15:19 AM9/13/18
to eID Middleware Dev
Frederik,

Well, I'm not getting an error with the slot.Token.OpenSession(true) line. If I try to get the token info from the slot (var o=    slot.Token.TokenInfo;) I get a DEVICE ERROR. When I do m.GetSlotList(true)[0].Token.TokenInfo.Label.Trim(); I get CRYPTOKI_NOT_INITIALIZED.
As you can see in the screenshot below, the slot is in fact the cardreader.

I just built a new version for the Pkcs11 (from https://github.com/Fedict/eid-mw/tree/master/doc/sdk/wrappers/C%23%20pkcs11wrappers/pkcs11net) to make sure I used the latest version.
Any Ideas?

Stijn.


Op donderdag 13 september 2018 13:08:59 UTC+2 schreef fvernelen:
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.

Stijn Staelens

unread,
Sep 13, 2018, 8:56:34 AM9/13/18
to eID Middleware Dev
 Extra info:
P11Module.GetTokenInfo(0); also gives me a DEVICE ERROR
CRYPTOKI_NOT_INITIALIZED would mean that the pkcs11 module is not initialized, but when I initialized, I got the error that it was already initialized.

So DEVICE ERROR is the error I'm getting.


Stijn.

Stijn Staelens

unread,
Sep 14, 2018, 4:54:12 AM9/14/18
to eID Middleware Dev
Frederik,

Sorry to put some pressure on this, but were starting to see that some of our customers are having the same problem.
Any idea what could be wrong? 

Stijn.

Op donderdag 13 september 2018 14:56:34 UTC+2 schreef Stijn Staelens:

Frederik Vernelen

unread,
Sep 14, 2018, 5:11:57 AM9/14/18
to Stijn Staelens, eID Middleware Dev
Hello Stijn,

I'll have a look at it and see if I can reproduce it in our C# samples

--
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.

Frederik Vernelen

unread,
Sep 14, 2018, 5:39:58 AM9/14/18
to Stijn Staelens, eID Middleware Dev
Hello,

Just tested this with a 4.4.7 pkcs11 (allthough not a _ff_ version).
We get indeed the exception TOKEN_NOT_RECOGNIZED thrown as expected when trying to open a session with a non-eID card.

                Slot[] slotlist = m.GetSlotList(true);
                if (slotlist.Length > 0)
                {
                    Slot slot = slotlist[0];
                    Session session = slot.Token.OpenSession(true); -> EXCEPTION TOKEN_NOT_RECOGNIZED  thrown

So when we handle this exception (in a separate function), we can prevent this

                Slot[] slotlist = m.GetSlotList(true);
                if (slotlist.Length > 0)
                {
                    Slot slot = slotlist[0];
                    Session session = CreateSession(slot);
                    if (session != null)
                    {

        private Session CreateSession (Slot slot )
        {
            try
            {
                return slot.Token.OpenSession(true);
            }
            catch
            {
                return null;
            }       
        }

Wkr,
 Frederik

Stijn Staelens

unread,
Sep 14, 2018, 5:52:06 AM9/14/18
to eID Middleware Dev
Hmm,

I must be using a wrong version of the pkcs11 then. Because I can create a session. I'm not getting an error on the creation of the session. I'm getting the error when doing this line of code:
session.FindObjectsInit(new P11Attribute[] { classAttribute, labelAttribute });

Can you provice me with a link to the correct version of pkcs11? I built the PKCS11 from here: https://github.com/Fedict/eid-mw/tree/master/doc/sdk/wrappers/C%23%20pkcs11wrappers
Is that all I need to do? Or do I need some other dll from somewhere else?


Stijn.

Op vrijdag 14 september 2018 11:39:58 UTC+2 schreef fvernelen:
To unsubscribe from this group and stop receiving emails from it, send an email to eid-middleware-dev+unsub...@googlegroups.com.

Frederik Vernelen

unread,
Sep 14, 2018, 6:30:04 AM9/14/18
to Stijn Staelens, eID Middleware Dev
I'm using the build version from the SDK (nothing changed in the C# library (the C# wrapper around out pkcs11 lib))
 eid-mw-master\doc\sdk\wrappers\C# pkcs11wrappers\pkcs11net\build\x64

I did rebuild our pkcs#11 library (eid-mw-master\cardcomm\pkcs11\VS_2015)
But you could test against the pkcs11 library that comes with the new Viewer as well (will need to rename it, and keep in mind it does some tweaks like preloading the certificates)


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.

Stijn Staelens

unread,
Sep 14, 2018, 7:31:12 AM9/14/18
to eID Middleware Dev
Ok, So I'm now trying to get the sample working.
I installed the latest version of the Viewer.
I changed the constructor to:
    public ReadData()
       
{
           
            mFileName
= "beid_ff_pkcs11.dll";
           
       
}
to use the new pkcs11.dll
With the line
  Session session = slot.Token.OpenSession(true);
I'm not getting an error. (So no TOKEN_NOT_RECOGNIZED error).
It's when I try to read the data:
 ByteArrayAttribute classAttribute = new ByteArrayAttribute(CKA.CLASS);
                    classAttribute
.Value = BitConverter.GetBytes((uint)Net.Sf.Pkcs11.Wrapper.CKO.DATA);


                   
ByteArrayAttribute labelAttribute = new ByteArrayAttribute(CKA.LABEL);

                    labelAttribute
.Value = System.Text.Encoding.UTF8.GetBytes("surname");      


                    session
.FindObjectsInit(new P11Attribute[] { classAttribute, labelAttribute });
I'm getting a DEVICE ERROR on the last line.
So I guess I'm reading the correct card, but something still is going wrong.
Any ideas?
We tried the same code on a pc without the yubikey (also with the latest version of the eidviewer, and this doesn't give a problem.

Stijn.

Op vrijdag 14 september 2018 12:30:04 UTC+2 schreef fvernelen:
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.

Frederik Vernelen

unread,
Sep 14, 2018, 8:09:27 AM9/14/18
to Stijn Staelens, eID Middleware Dev
Did you put the beid_ff_pkcs11.dll that came with the viewer in a directory so that it will be picked up by your application?
(i.e. next to your application, or in the system folder syswow64 (to replace the older beid_ff_pkcs11.dll that comes installed with the eID middleware))

I forgot to mention this before, but as the eID Viewer is at the moment still a 32-bit application, we only ship a 32-bit beid_FF_pkcs11.dll with it, so please make your application 32-bit for this test.


 

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.

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.

Stijn Staelens

unread,
Sep 14, 2018, 8:23:57 AM9/14/18
to eID Middleware Dev
Frederik,

I have overwritten the one in the syswow64 folder. The application was build for "any cpu", I changed this to x86, still the same.
I now tried it putting the dll next to my application. I changed the path to this path and still the same. DEVICE ERROR.


Op vrijdag 14 september 2018 14:09:27 UTC+2 schreef fvernelen:
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.

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.

Frederik Vernelen

unread,
Sep 14, 2018, 10:06:24 AM9/14/18
to Stijn Staelens, eID Middleware Dev
Hello Stijn,

Could you provide me with some pkcs11 logs?

My tests here were with a bank card inserted before I started the application, and I get the same results with the new and older pkcs11's. (TOKEN_NOT_RECOGNIZED error)
(improvement of the new pkcs11 is mainly when switching cards




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.

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.

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.

Stijn Staelens

unread,
Sep 17, 2018, 2:00:16 AM9/17/18
to eID Middleware Dev
Frederik,
I attached the logs

Op vrijdag 14 september 2018 16:06:24 UTC+2 schreef fvernelen:
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.

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.

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.
p11.log
.BEID_0.log

Frederik Vernelen

unread,
Sep 17, 2018, 10:17:20 AM9/17/18
to Stijn Staelens, eID Middleware Dev
Thanks for the logs,

They show that the reading (of the surname) is in fact correctly attempted at the eID card (and not the ubikey).
When asking for the slotlist, our pkcs11 finds both cards (eID card first) and identifies them as eID card and ubikey.
But when doing a trivial select file (of the identity file) on the eID card afterwards,  PCSC returns error (0x16) on scardtransmit.

ERROR_BAD_COMMAND

22 (0x16)

The device does not recognize the command.


I tried to reproduce this setup with our C# getData example, using an eID card and a bank card.
My log is quite similar to yours: first both cards are detected (first eID, then bank, then reading from the eID), but the PCSC error is not triggered here.
(tried with the beid_ff_pkcs11 version 4.2.8, 4.3.2 and 4.4.7 and beidpkcs11 v4.3.2)







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.

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.

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.

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.

Stijn Staelens

unread,
Sep 24, 2018, 2:54:22 AM9/24/18
to eID Middleware Dev
Frederik,

Okay, so how do we go further from here?

Stijn.

Op maandag 17 september 2018 16:17:20 UTC+2 schreef fvernelen:
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.

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.

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.

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.

Jeroen Cuppens

unread,
May 20, 2019, 6:56:48 AM5/20/19
to eID Middleware Dev
Hi all

Did anyone find a solution for this issue?
We're facing the same issue with one of our customers.

Our application is making the call to the correct card reader, but also returns the 'DEVICE_ERROR' exception.
I'm using the latest version of github and I'm testing with the EidSample in github.

.BEID_0.log
-----------------
2019-05-20 11:47:03 - 16104|16804 - cardlayer - DEBUG:     SCardEstablishContext(): 0x0
2019-05-20 11:47:03 - 16104|16804 - cardlayer - DEBUG:     SCardListReaders(): 0x0
2019-05-20 11:47:03 - 16104|16804 - cardlayer - DEBUG:     SCardConnect(ACS CCID USB Reader 0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardBeginTransaction(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:       SCardTransmit(00 A4 04 0C 0C A0 00 00 01 77 .. 43 53 2D 31 35)
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:         SCardTransmit(): SW12 = 90 00
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardBeginTransaction(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:       SCardTransmit(80 E4 00 00 1C)
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:         SCardTransmit(): SW12 = 90 00
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardEndTransaction(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardEndTransaction(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - INFO:  Connected to BE eID card in reader ACS CCID USB Reader 0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     ReaderStatus(): card inserted
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardConnect(Windows Hello for Business 14): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardBeginTransaction(0x1): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:       SCardTransmit(00 A4 04 0C 0C A0 00 00 01 77 .. 43 53 2D 31 35)
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:         SCardTransmit(): SW12 = 6A 82
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:       SCardTransmit(00 A4 04 00 0F A0 00 00 00 30 .. 13 10 01 01 FF)
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:         SCardTransmit(): SW12 = 6A 82
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardEndTransaction(0x1): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - INFO:  Connected to unknown card in reader Windows Hello for Business 14
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     ReaderStatus(): card inserted
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardStatus(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     ReaderStatus(): card stil present
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardStatus(0x1): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     ReaderStatus(): card stil present
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardStatus(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     ReaderStatus(): card stil present
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardStatus(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardStatus(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardBeginTransaction(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:       SCardTransmit(00 A4 02 0C 02 40 31)
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:         SCardTransmit(): 0x16
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardEndTransaction(0x0): 0x0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardDisconnect(0x0): 0x0 ; mode: 0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - INFO:  Disconnected from card in reader ACS CCID USB Reader 0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - DEBUG:     SCardDisconnect(0x1): 0x0 ; mode: 0
2019-05-20 11:47:04 - 16104|16804 - cardlayer - INFO:  Disconnected from card in reader Windows Hello for Business 14


p11.log
-----------------
16104 16804 20.05.2019 11:47:03 C_Initialize()             | I: enter pReserved = 0000000000000000
16104 16804 20.05.2019 11:47:03 C_Initialize()             | S: Initialize this PKCS11 Module
16104 16804 20.05.2019 11:47:03 C_Initialize()             | S: =============================
16104 16804 20.05.2019 11:47:03 C_Initialize()             | I: leave, ret = 0
16104 16804 20.05.2019 11:47:03 C_GetFunctionList()        | I: enter
16104 16804 20.05.2019 11:47:03 C_GetFunctionList()        | S: C_GetFunctionList()
16104 16804 20.05.2019 11:47:03 C_GetFunctionList()        | I: leave, CKR_OK
16104 16804 20.05.2019 11:47:03 C_GetSlotList()            | I: enter
16104 16804 20.05.2019 11:47:03 C_GetSlotList()            | I: p11_lock() acquired
16104 16804 20.05.2019 11:47:03 C_GetSlotList()            | S: C_GetSlotList()
16104 16804 20.05.2019 11:47:03 C_GetSlotList()            | I: h=0
16104 16804 20.05.2019 11:47:03 C_GetSlotList()            | I: h=0
16104 16804 20.05.2019 11:47:03 C_GetSlotList()            | I: slot[0]: ACS CCID USB Reader 0
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: cal_token_present
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: h=1
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: slot[1]: Windows Hello for Business 14
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: cal_token_present
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: p11_unlock()
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: leave, ret = 0
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: enter
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: p11_lock() acquired
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | S: C_GetSlotList()
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: h=0
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: h=0
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: slot[0]: ACS CCID USB Reader 0
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: cal_token_present
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: h=1
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: slot[1]: Windows Hello for Business 14
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: cal_token_present
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: p11_unlock()
16104 16804 20.05.2019 11:47:04 C_GetSlotList()            | I: leave, ret = 0
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | I: enter
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | S: C_GetFunctionList()
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | I: leave, CKR_OK
16104 16804 20.05.2019 11:47:04 C_GetSlotInfo()            | I: enter
16104 16804 20.05.2019 11:47:04 C_GetSlotInfo()            | S: C_GetSlotInfo(slot 0)
16104 16804 20.05.2019 11:47:04 C_GetSlotInfo()            | I: leave, ret = 0
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | I: enter
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | S: C_GetFunctionList()
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | I: leave, CKR_OK
16104 16804 20.05.2019 11:47:04 C_OpenSession()            | I: enter
16104 16804 20.05.2019 11:47:04 C_OpenSession()            | S: C_OpenSession (slot 0)
16104 16804 20.05.2019 11:47:04 C_OpenSession()            | S: Open session (slot 0: hsession = 1 )
16104 16804 20.05.2019 11:47:04 C_OpenSession()            | I: leave, ret = 0
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | I: enter
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | S: C_GetFunctionList()
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | I: leave, CKR_OK
16104 16804 20.05.2019 11:47:04 C_FindObjectsInit()        | I: enter
16104 16804 20.05.2019 11:47:04 C_FindObjectsInit()        | S: C_FindObjectsInit(session 1)
16104 16804 20.05.2019 11:47:04 I: Search template:        | I:size = 2

Attribute type : CKA_CLASS
Attribute Value: CKO_DATA

Attribute type : CKA_LABEL
Attribute Value: surname
16104 16804 20.05.2019 11:47:04 cal_read_ID_files()        | E: MiddlewareException thrown: 0xe1d00200
16104 16804 20.05.2019 11:47:04 C_FindObjectsInit()        | E: cal_read_ID_files() returned 48
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | I: enter
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | S: C_GetFunctionList()
16104 16804 20.05.2019 11:47:04 C_GetFunctionList()        | I: leave, CKR_OK
16104 16804 20.05.2019 11:47:04 C_Finalize()               | I: enter
16104 16804 20.05.2019 11:47:04 C_Finalize()               | I: p11_free_lock()
16104 16804 20.05.2019 11:47:04 C_Finalize()               | I: leave, ret = 0


Thanks in advance!

Frederik Vernelen

unread,
May 20, 2019, 7:56:27 AM5/20/19
to eID Middleware Dev
Hello Jeroen,

As it happens I just fixed another issue regarding usage of a ubikey last week.

I just tried the readData example you mentioned and ran into the issue you're having when using a setup resembling yours.
When I use the pkcs11 dll with last weeks fix, I no longer run into the issue.

If you like, I can provide you with a copy for testing?
or otherwise you can build the pkcs11 library yourself with the head of the 4.4 branch:
-) (buildscripts (and readme) can be found in  \eid-mw-v4.4\scripts\windows\
-) or just use the VS solution at eid-mw-v4.4\VS_2017 , but you might want to run the versioning script first: \eid-mw-v4.4\scripts\windows\set_eidmw_version.cmd


Wkr,
 Frederik


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.

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.

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.

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.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/eid-middleware-dev/ae190981-9624-4826-8470-113bf53badcf%40googlegroups.com.

Jeroen Cuppens

unread,
May 21, 2019, 4:25:11 AM5/21/19
to eID Middleware Dev
Hello Fredirik

It would be nice if you can provide me the patched version of the dll.
Than I'm sure I didn't do something wrong with the build configuration.

Thanks in advance!

Kind regards,
Jeroen


On Monday, May 20, 2019 at 1:56:27 PM UTC+2, fvernelen wrote:
Hello Jeroen,

As it happens I just fixed another issue regarding usage of a ubikey last week.

I just tried the readData example you mentioned and ran into the issue you're having when using a setup resembling yours.
When I use the pkcs11 dll with last weeks fix, I no longer run into the issue.

If you like, I can provide you with a copy for testing?
or otherwise you can build the pkcs11 library yourself with the head of the 4.4 branch:
-) (buildscripts (and readme) can be found in  \eid-mw-v4.4\scripts\windows\
-) or just use the VS solution at eid-mw-v4.4\VS_2017 , but you might want to run the versioning script first: \eid-mw-v4.4\scripts\windows\set_eidmw_version.cmd


Wkr,
 Frederik


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.

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.

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.

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.

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