0

I am using redhat 8.3 with java 1.7
smart card readers ACS ACR122U and Identive CLOUD 2700 R
java cannot detect smart card readers

My Os Version
$>cat /etc/redhat-release
Red Hat Enterprise Linux release 8.3 (Ootpa)

Attached Card Readers

$> lsusb
...
Bus 003 Device 003: ID 04e6:5810 SCM Microsystems, Inc. uTrust 2700 R Smart Card Reader
Bus 003 Device 004: ID 072f:2200 Advanced Card Systems, Ltd ACR122U

Installed Pcsc driver version

$>pcscd --version
pcsc-lite version 1.8.23.
Copyright (C) 1999-2002 by David Corcoran <corcoran@musclecard.com>.
Copyright (C) 2001-2015 by Ludovic Rousseau <ludovic.rousseau@free.fr>.
Copyright (C) 2003-2004 by Damien Sauveron <sauveron@labri.fr>.
Report bugs to <pcsclite-muscle@lists.alioth.debian.org>.
Enabled features: Linux x86_64-redhat-linux-gnu libsystemd serial usb libudev usbdropdir=/usr/lib64/pcsc/drivers ipcdir=/var/run/pcscd configdir=/etc/reader.conf.d
Bus 003 Device 004: ID 072f:2200 Advanced Card Systems, Ltd ACR122U

Started pcscd service

$>service pcscd status
Redirecting to /bin/systemctl status pcscd.service
● pcscd.service - PC/SC Smart Card Daemon
Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled)
Active: active (running) since Fri 2021-01-01 15:46:49 +0530; 39min ago
Main PID: 5649 (pcscd)
Tasks: 6 (limit: 48503)
Memory: 1.9M
CGroup: /system.slice/pcscd.service
└─5649 /usr/sbin/pcscd --foreground --auto-exit

Jan 01 15:46:49 localhost.localdomain systemd[1]: Started PC/SC Smart Card Daemon.

Java version

$>java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)

Sample Java program

import java.util.List;
import javax.smartcardio.*;

public class PCSCTest {

public static void main(String[] args) {
try {

TerminalFactory factory = TerminalFactory.getDefault();
List<CardTerminal> terminals = factory.terminals().list();
System.out.println("Terminals list size ->"+terminals.size());
//System.out.println(terminals.get(0));

} catch(Exception e) {
e.printStackTrace();
}
}

}

The Result is

terminals size-->0

Dinesh Appuhami
  • 710
  • 1
  • 11
  • 24
  • If `pcsc_scan` command lists your readers (i.e. your readers are ok for pcscd) than you might want to check [this question](https://stackoverflow.com/q/12376257/5128464) – vlp Jan 02 '21 at 15:38

1 Answers1

1

Java has problems to find the libpcsclite shared object, just submit the path manually

java -Dsun.security.smartcardio.library=/lib/x86_64-linux-gnu/libpcsclite.so.1 -jar Yourjarfile 
gavz
  • 11
  • 2
  • Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, **can you [edit] your answer to include an explanation of what you're doing** and why you believe it is the best approach? – Jeremy Caney Jan 03 '22 at 01:03