Java Code Examples for javax.smartcardio.TerminalFactory#getDefault()
The following examples show how to use
javax.smartcardio.TerminalFactory#getDefault() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestDirect.java From jdk8u60 with GNU General Public License v2.0 | 7 votes |
public static void main(String[] args) throws Exception { TerminalFactory terminalFactory = TerminalFactory.getDefault(); List<CardTerminal> cardTerminals = terminalFactory.terminals().list(); System.out.println("Terminals: " + cardTerminals); if (cardTerminals.isEmpty()) { throw new Exception("No card terminals available"); } CardTerminal cardTerminal = cardTerminals.get(0); Card card = cardTerminal.connect("DIRECT"); card.disconnect(true); System.out.println("OK."); }
Example 2
Source File: TestDefault.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); if (terminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + terminals); System.out.println("OK."); }
Example 3
Source File: TestDefault.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); System.out.println("Terminals: " + terminals); if (terminals.isEmpty()) { throw new Exception("no terminals"); } System.out.println("OK."); }
Example 4
Source File: TestDefault.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); if (terminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + terminals); System.out.println("OK."); }
Example 5
Source File: TestDefault.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); if (terminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + terminals); System.out.println("OK."); }
Example 6
Source File: TestDefault.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); System.out.println("Terminals: " + terminals); if (terminals.isEmpty()) { throw new Exception("no terminals"); } System.out.println("OK."); }
Example 7
Source File: TestDefault.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); if (terminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + terminals); System.out.println("OK."); }
Example 8
Source File: TestDefault.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); System.out.println("Terminals: " + terminals); if (terminals.isEmpty()) { throw new Exception("no terminals"); } System.out.println("OK."); }
Example 9
Source File: TestDefault.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); if (terminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + terminals); System.out.println("OK."); }
Example 10
Source File: TestDirect.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory terminalFactory = TerminalFactory.getDefault(); List<CardTerminal> cardTerminals = terminalFactory.terminals().list(); if (cardTerminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + cardTerminals); CardTerminal cardTerminal = cardTerminals.get(0); Card card = cardTerminal.connect("DIRECT"); card.disconnect(true); System.out.println("OK."); }
Example 11
Source File: TestDefault.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); if (terminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + terminals); System.out.println("OK."); }
Example 12
Source File: TestDirect.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory terminalFactory = TerminalFactory.getDefault(); List<CardTerminal> cardTerminals = terminalFactory.terminals().list(); System.out.println("Terminals: " + cardTerminals); if (cardTerminals.isEmpty()) { throw new Exception("No card terminals available"); } CardTerminal cardTerminal = cardTerminals.get(0); Card card = cardTerminal.connect("DIRECT"); card.disconnect(true); System.out.println("OK."); }
Example 13
Source File: TestDirect.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory terminalFactory = TerminalFactory.getDefault(); List<CardTerminal> cardTerminals = terminalFactory.terminals().list(); if (cardTerminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + cardTerminals); CardTerminal cardTerminal = cardTerminals.get(0); Card card = cardTerminal.connect("DIRECT"); card.disconnect(true); System.out.println("OK."); }
Example 14
Source File: TestDirect.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory terminalFactory = TerminalFactory.getDefault(); List<CardTerminal> cardTerminals = terminalFactory.terminals().list(); System.out.println("Terminals: " + cardTerminals); if (cardTerminals.isEmpty()) { throw new Exception("No card terminals available"); } CardTerminal cardTerminal = cardTerminals.get(0); Card card = cardTerminal.connect("DIRECT"); card.disconnect(true); System.out.println("OK."); }
Example 15
Source File: Main.java From openjavacard-ndef with GNU General Public License v3.0 | 5 votes |
public static final void main(String[] arguments) { PrintStream os = System.out; TerminalFactory tf = TerminalFactory.getDefault(); CardTerminals terminals = tf.terminals(); try { // default command is info String command = "info"; // check if user specified a reader as first argument if(arguments.length >= 1) { // if yes then use that reader String terminalName = arguments[0]; CardTerminal terminal = terminals.getTerminal(terminalName); if(terminal == null) { throw new RuntimeException("Could not find terminal \"" + terminalName + "\""); } // check if the user also specified a command if(arguments.length >= 2) { command = arguments[1]; } // split off the command arguments String[] commandArguments = new String[0]; if(arguments.length > 2) { commandArguments = Arrays.copyOfRange(arguments, 2, arguments.length); } // run the command runCommand(terminal, command, commandArguments); } else { // else list all readers os.println("Available terminals:"); for (CardTerminal t : terminals.list()) { os.println(" \"" + t.getName() + "\""); } } } catch (CardException e) { e.printStackTrace(); } }
Example 16
Source File: TestDirect.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory terminalFactory = TerminalFactory.getDefault(); List<CardTerminal> cardTerminals = terminalFactory.terminals().list(); if (cardTerminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + cardTerminals); CardTerminal cardTerminal = cardTerminals.get(0); Card card = cardTerminal.connect("DIRECT"); card.disconnect(true); System.out.println("OK."); }
Example 17
Source File: TestDefault.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getDefault(); System.out.println("Type: " + factory.getType()); List<CardTerminal> terminals = factory.terminals().list(); if (terminals.isEmpty()) { System.out.println("Skipping the test: " + "no card terminals available"); return; } System.out.println("Terminals: " + terminals); System.out.println("OK."); }
Example 18
Source File: PCSCUtils.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
private static ResponseAPDU transmit(CommandAPDU commandApdu) throws CardException { TerminalFactory factory = TerminalFactory.getDefault(); List<CardTerminal> terminals = factory.terminals().list(); LOG.debug("Terminals: " + terminals); Card card = null; Iterator i$ = terminals.iterator(); while(i$.hasNext()) { CardTerminal terminal = (CardTerminal)i$.next(); if (terminal.isCardPresent()) { card = terminal.connect("*"); if (card != null && matchesEidAtr(card.getATR())) { break; } } } if (card == null) { throw new CardNotPresentException("EID is not present"); } else { card.beginExclusive(); LOG.debug("card: " + card); CardChannel cardChannel = card.getBasicChannel(); ResponseAPDU responseApdu = cardChannel.transmit(commandApdu); if (108 == responseApdu.getSW1()) { LOG.debug("sleeping..."); try { Thread.sleep(10L); } catch (InterruptedException var7) { throw new be.ehealth.technicalconnector.exception.InterruptedException("Cannot sleep", var7); } responseApdu = cardChannel.transmit(commandApdu); } card.endExclusive(); card.disconnect(false); return responseApdu; } }
Example 19
Source File: PCSCUtils.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
private static ResponseAPDU transmit(CommandAPDU commandApdu) throws CardException { TerminalFactory factory = TerminalFactory.getDefault(); List<CardTerminal> terminals = factory.terminals().list(); LOG.debug("Terminals: " + terminals); Card card = null; Iterator i$ = terminals.iterator(); while(i$.hasNext()) { CardTerminal terminal = (CardTerminal)i$.next(); if (terminal.isCardPresent()) { card = terminal.connect("*"); if (card != null && matchesEidAtr(card.getATR())) { break; } } } if (card == null) { throw new CardNotPresentException("EID is not present"); } else { card.beginExclusive(); LOG.debug("card: " + card); CardChannel cardChannel = card.getBasicChannel(); ResponseAPDU responseApdu = cardChannel.transmit(commandApdu); if (108 == responseApdu.getSW1()) { LOG.debug("sleeping..."); try { Thread.sleep(10L); } catch (InterruptedException var7) { throw new be.ehealth.technicalconnector.exception.InterruptedException("Cannot sleep", var7); } responseApdu = cardChannel.transmit(commandApdu); } card.endExclusive(); card.disconnect(false); return responseApdu; } }
Example 20
Source File: PCSCUtils.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
private static ResponseAPDU transmit(CommandAPDU commandApdu) throws CardException { TerminalFactory factory = TerminalFactory.getDefault(); List<CardTerminal> terminals = factory.terminals().list(); LOG.debug("Terminals: " + terminals); Card card = null; Iterator i$ = terminals.iterator(); while(i$.hasNext()) { CardTerminal terminal = (CardTerminal)i$.next(); if (terminal.isCardPresent()) { card = terminal.connect("*"); if (card != null && matchesEidAtr(card.getATR())) { break; } } } if (card == null) { throw new CardNotPresentException("EID is not present"); } else { card.beginExclusive(); LOG.debug("card: " + card); CardChannel cardChannel = card.getBasicChannel(); ResponseAPDU responseApdu = cardChannel.transmit(commandApdu); if (108 == responseApdu.getSW1()) { LOG.debug("sleeping..."); try { Thread.sleep(10L); } catch (InterruptedException var7) { throw new be.ehealth.technicalconnector.exception.InterruptedException("Cannot sleep", var7); } responseApdu = cardChannel.transmit(commandApdu); } card.endExclusive(); card.disconnect(false); return responseApdu; } }