e-Contract / commons-eid

Other
14 stars 11 forks source link

Making it work on OS X #1

Closed Baco9 closed 9 years ago

Baco9 commented 9 years ago

Since Sun's smartcardio library constantly crashes on OS X with 64-bit java [1], I switched to Intarsys' alternative implementation [2]. I had to make some changes to make it work though:

  1. The handling of 0x6c ("Wrong length Le") APDU responses didn't work until I actually changed the length in the new request.
  2. I also added handling for 0x61 ("More date bytes are available") APDU responses.

Both cases are normally handled internally by the Sun's smartcardio library, so they shouldn't even occur. That's why I don't think this change will have any impact when using the default implementation, although I haven't tested this.

I'm not sure why Intarsys opted not to handle those responses internally (and therefore be more compatible with Sun's implementation), but I do know that this mechanism can be disabled in Sun's implementation as well. So for people who wish to disable it (required to make certain types of cards work [3]), this change may be useful as well.

[1] https://discussions.apple.com/message/21436263 [2] https://github.com/intarsys/smartcard-io [3] https://ridrix.wordpress.com/2009/07/12/design-error-in-javax-smartcardio/

fcorneli commented 9 years ago

I'm certainly willing to pull this patch, but is it still relevant since the availability of Oracle Java 8 on Mac OS X? I've been using Commons eID on Mac OS X 10.10.3 for quite some time now, and never experienced any crashes. (I know, this used to be the case on older Java version distributed by Apple). If you think this is still relevant, and I pull this, this will require me to test on all platforms for the 0.6.0 release. Please confirm relevance for Oracle Java 8. BTW: I just happened to have planned the 0.6.0 release today. So you're just in time with this one. I'll be working on the next release the coming days.

Baco9 commented 9 years ago

It still crashes for me (OS X 10.10.3):

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x00007fff929c39b1, pid=6417, tid=76939
#
# JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build 1.8.0_45-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libdispatch.dylib+0x19b1]  _os_object_release+0x31
fcorneli commented 9 years ago

Could you add an integration test that demonstrates this crash on Mac OS X under https://github.com/e-Contract/commons-eid/tree/master/commons-eid-tests/src/test/java/test/integ/be/fedict/commons/eid/client

Baco9 commented 9 years ago

I don't think the crash is really deterministic, but I'll look into it.