nowina-solutions/nexu

No card detected under Linux

Closed this issue · 7 comments

Hello, I succesfully built the current master, but token detection is failing. No exception is raised, but log reports:

ott 21, 2015 12:25:25 PM lu.nowina.nexu.flow.TokenFlow createToken
INFORMAZIONI: 0 card detected

Platform is Ubuntu 15.10 wily, 64 bit. I have the pcscd daemon running, and opensc 0.14 succesfully gets card ATR.

I revised some smartcard.io example code i ran in the past, and found this interesting comment and code:

//ROB: On linux, you have to provide libpcsclite location in sun.security.smartcardio.library system
// property.
//From openecard project!!! - https://www.openecard.org
File libFile = LinuxLibraryFinder.getLibraryPath("pcsclite", "1");
System.setProperty("sun.security.smartcardio.library", libFile.getAbsolutePath());

Then, i tried to run nexu-app as follows:

java -Dsun.security.smartcardio.library=/usr/lib/x86_64-linux-gnu/libpcsclite.so -cp nexu-app-1.0.RC1.jar lu.nowina.nexu.NexUApp

And all worked flawlessly.

cheers,
rob

I'll integrate that on next Release Candidate. CardDectector now contains :

    try {
        if(info.getOs() == OS.LINUX) {
            logger.info("The OS is Linux, we check for Library");
            File libFile = at.gv.egiz.smcc.util.LinuxLibraryFinder.getLibraryPath("pcsclite", "1");
            if(libFile != null) {
                logger.info("Library installed is " + libFile.getAbsolutePath());
                System.setProperty("sun.security.smartcardio.library", libFile.getAbsolutePath());
            }
        }
    } catch(Exception e) {
        logger.log(Level.SEVERE, "Error while loading library for Linux", e);
    }

I guess you can simply get the file

https://github.com/ecsec/open-ecard/blob/7790df5068a7ce12a1e94f5bde13127a0980c012/common/src/main/java/org/openecard/common/util/LinuxLibraryFinder.java

And include in your codebase (giving credits, of course)? It's GPLv3 .

rob

Even easier : the file is already there since a4472c5 . We integrate work from MOCCA. With a little bit of luck, you won't even need a PKCS11 driver anymore.

Great. Regarding PKCS11, I doubt you can do without, at least for Italian cards using SM with 3DES keys embedded into the libs. Unfortunately it's common practice here.

I have written "I doubt you can do without". Should have "I doubt WE can do without". :-(

Closing this bug.