Package javax.smartcardio

Examples of javax.smartcardio.CardTerminal


import org.nfctools.examples.TerminalUtils;

public class HceDemo {

  public void run() {
    CardTerminal cardTerminal = TerminalUtils.getAvailableTerminal().getCardTerminal();
    HostCardEmulationTagScanner tagScanner = new HostCardEmulationTagScanner(cardTerminal);
    tagScanner.run();
  }
View Full Code Here


        HBCIUtils.log("found card terminals:",HBCIUtils.LOG_INFO);
        for (CardTerminal t:list) {
            HBCIUtils.log("  "+t.getName(),HBCIUtils.LOG_INFO);
        }

        CardTerminal terminal = null;

        // Checken, ob der User einen konkreten Kartenleser vorgegeben hat
        String name = HBCIUtils.getParam(getParamHeader()+".pcsc.name",null);
        if (name != null)
        {
          HBCIUtils.log("explicit terminal name given, trying to open terminal: " + name,HBCIUtils.LOG_DEBUG);
          terminal = terminals.getTerminal(name);
          if (terminal == null)
            throw new HBCI_Exception("Kartenleser \"" + name + "\" nicht gefunden");
        }
        else
        {
          HBCIUtils.log("open first available card terminal",HBCIUtils.LOG_DEBUG);
          terminal = list.get(0);
        }
        HBCIUtils.log("using card terminal " + terminal.getName(),HBCIUtils.LOG_DEBUG);

        // wait for card
        if (!terminal.waitForCardPresent(60 * 1000L))
          throw new HBCI_Exception("Keine Chipkarte in Kartenleser " + terminal.getName() + " gefunden");

        // Hier kann man gemaess
        // http://download.oracle.com/javase/6/docs/jre/api/security/smartcardio/spec/javax/smartcardio/CardTerminal.html#connect%28java.lang.String%29
        // auch "T=0" oder "T=1" angeben. Wir wissen allerdings noch nicht, von welchem
        // Typ die Karte ist. Daher nehmen wir "*" fuer jedes verfuegbare. Wenn wir die
        // Karte geoeffnet haben, kriegen wir dann auch das Protokoll raus.
        this.smartCard = terminal.connect("*");
        String type = this.smartCard.getProtocol();
        HBCIUtils.log(" card type: " + type,HBCIUtils.LOG_INFO);
       
        // Card-Service basierend auf dem Kartentyp erzeugen
        if (type == null || type.indexOf("=") == -1)
View Full Code Here

          {
            List<CardTerminal> terminals = TerminalFactory.getDefault().terminals().list();
            // Eigentlich koennen wir hier pauschal den ersten gefundenen nehmen
            if (terminals != null && terminals.size() > 0)
            {
              CardTerminal terminal = terminals.get(0);
              String name = terminal.getName();
              temp.setPCSCName(name);
              PassportHandle handle = new PassportHandleImpl(temp);
              handle.open();
              handle.close(); // nein, nicht im finally, denn wenn das Oeffnen
View Full Code Here

            HBCIUtils.log("found card terminals:", HBCIUtils.LOG_INFO);
            for (CardTerminal t : list) {
                HBCIUtils.log("  " + t.getName(), HBCIUtils.LOG_INFO);
            }

            CardTerminal terminal = null;

            // Checken, ob der User einen konkreten Kartenleser vorgegeben hat
            String name = HBCIUtils.getParam(getParamHeader() + ".pcsc.name", null);
            if (name != null) {
                HBCIUtils.log("explicit terminal name given, trying to open terminal: " + name, HBCIUtils.LOG_DEBUG);
                terminal = terminals.getTerminal(name);
                if (terminal == null)
                    throw new HBCI_Exception("Kartenleser \"" + name + "\" nicht gefunden");
            } else {
                HBCIUtils.log("open first available card terminal", HBCIUtils.LOG_DEBUG);
                terminal = list.get(0);
            }
            HBCIUtils.log("using card terminal " + terminal.getName(), HBCIUtils.LOG_DEBUG);

            // wait for card
            if (!terminal.waitForCardPresent(60 * 1000L))
              throw new HBCI_Exception("Keine Chipkarte in Kartenleser " + terminal.getName() + " gefunden");

            this.smartCard = terminal.connect("T=1");
           
            this.cardService = new RSACardService();
            HBCIUtils.log(" using: " + this.cardService.getClass().getName(),HBCIUtils.LOG_INFO);
            this.cardService.init(this.smartCard);
           
View Full Code Here

                return;
            }
            System.out.println("Terminal list: " + terminalList);
           
            // get the first terminal
            CardTerminal terminal = terminalList.get(0);
            System.out.println("present: " + terminal.isCardPresent());

            //seviceTest();

            // establish a connection with the card
            if(!terminal.waitForCardPresent(500)) {
                System.out.println("no card inserted");
                return;
            }
            Card card = terminal.connect("*");
          
            try {

                System.out.println("card: " + card);
                System.out.println("proto: " + card.getProtocol());
View Full Code Here

TOP

Related Classes of javax.smartcardio.CardTerminal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.