Guest User

Untitled

a guest
Nov 17th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. TerminalFactory factory = TerminalFactory.getDefault();
  2. List<CardTerminal> terminals = factory.terminals().list();
  3. System.out.println("Terminals: " + terminals);
  4. // get the first terminal
  5. CardTerminal terminal = terminals.get(0);
  6. // establish a connection with the card
  7. Card card = terminal.connect("*");
  8. System.out.println("card: " + card);
  9. CardChannel channel = card.getBasicChannel();
  10. byte[] INIT_UPDATE = { (byte) 0x80, (byte) 0x50, (byte) 0x00,
  11. (byte) 0x00, (byte) 0x08, (byte) 0x11, (byte) 0x22,
  12. (byte) 0x33, (byte) 0x44, (byte) 0x55, (byte) 0x66,
  13. (byte) 0x77, (byte) 0x88 };
  14.  
  15. ResponseAPDU r = channel.transmit(new CommandAPDU( INIT_UPDATE));
  16. System.out.println("response: " + Hex.encodeHexString(r.getBytes()));
  17. // disconnect
  18. card.disconnect(false);
Add Comment
Please, Sign In to add comment