Package javax.smartcardio

Examples of javax.smartcardio.CardTerminals


  final static private byte LOG_OP_ISSUE      = (byte0x33;

  // CONSTRUCTOR
  public TopUpTerminal(){
    TerminalFactory    tf;
    CardTerminals      ct;
    List<CardTerminal> cs;
    Card card;

    loadBlacklist();
    CARD_LEGIT=false;
    cID="0";
    sg = Signature.getInstance(Signature.ALG_DES_MAC8_ISO9797_M2, false);
    try {
      cp = Cipher.getInstance("AES/ECB/NoPadding");
    } catch (Exception e) {
      Utilities.writeToLogs(home,"[E] "+e.toString());     
    }
    try {
      tf = TerminalFactory.getDefault();
      ct = tf.terminals();
      cs = ct.list(CardTerminals.State.CARD_PRESENT);
      if (cs.isEmpty()){
        Utilities.writeToLogs(home,"[E] No terminal with a card found!");
        System.out.println("[-] No terminal with a card found!");
        return;
      }
View Full Code Here


  final static private byte LOG_OP_ISSUE      = (byte0x33;

  // CONSTRUCTOR
  public PaymentTerminal(){
    TerminalFactory    tf;
    CardTerminals      ct;
    List<CardTerminal> cs;
    Card card;

    loadBlacklist();
    CARD_LEGIT=false;
    cID="0";
    sg = Signature.getInstance(Signature.ALG_DES_MAC8_ISO9797_M2, false);
    try {
      cp = Cipher.getInstance("AES/ECB/NoPadding");
    } catch (Exception e) {
      Utilities.writeToLogs(home,"[E] "+e.toString());     
    }
    try {
      tf = TerminalFactory.getDefault();
      ct = tf.terminals();
      cs = ct.list(CardTerminals.State.CARD_PRESENT);
      if (cs.isEmpty()){
        Utilities.writeToLogs(home,"[E] No terminal with a card found!");
        System.out.println("[-] No terminal with a card found!");
        return;
      }
View Full Code Here

    protected void initCT()
    {
      try
      {
        TerminalFactory terminalFactory = TerminalFactory.getDefault();
        CardTerminals terminals = terminalFactory.terminals();
        if (terminals == null)
          throw new HBCI_Exception("Kein Kartenleser gefunden");
       
        List<CardTerminal> list = terminals.list();
        if (list == null || list.size() == 0)
          throw new HBCI_Exception("Kein Kartenleser gefunden");
       
        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
        {
View Full Code Here

    }
   
    protected void initCT() {
        try {
            TerminalFactory terminalFactory = TerminalFactory.getDefault();
            CardTerminals terminals = terminalFactory.terminals();
            if (terminals == null)
                throw new HBCI_Exception("Kein Kartenleser gefunden");
           
            List<CardTerminal> list = terminals.list();
            if (list == null || list.size() == 0)
                throw new HBCI_Exception("Kein Kartenleser gefunden");
           
            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);
View Full Code Here

            // show the list of available terminals
            TerminalFactory factory = TerminalFactory.getDefault();
            System.out.println("TerminalFactory: " + factory);

            CardTerminals terminals = factory.terminals();

            List<CardTerminal> terminalList = terminals.list();
            if(terminalList.size() == 0) {
                System.out.println("No terminals found");
                return;
            }
            System.out.println("Terminal list: " + terminalList);
View Full Code Here

    public synchronized void detach() {
        terminals = null;
    }

    public synchronized List<CardTerminal> getTerminals() throws CardException {
        CardTerminals term = attach();
        if(term != null) {
            return term.list();
        }
        return new LinkedList<CardTerminal>();
    }
View Full Code Here

     * Возвращает терминалы со вставленной картой
     * @return
     * @throws CardException
     */
    public synchronized List<CardTerminal> getTerminalsWithCard() throws CardException {
        CardTerminals term = attach();
        if(term != null) {
            return term.list(CardTerminals.State.CARD_PRESENT);
        }
        return new LinkedList<CardTerminal>();
    }
View Full Code Here

     * @param timeout время в миллисекундах
     * @return список терминалов со вставленной картой
     * @throws CardException
     */
    public List<CardTerminal> waitForEvent(long timeout) throws CardException {
        CardTerminals term = attach();
        if (term != null && term.waitForChange(timeout)) {
            try {
                List<CardTerminal> all = new ArrayList<CardTerminal>();
                List<CardTerminal> inserted = term.list(CardTerminals.State.CARD_INSERTION);
                List<CardTerminal> removed = term.list(CardTerminals.State.CARD_REMOVAL);
                if(inserted != null) {
                    for (CardTerminal cardTerminal : inserted) {
                        System.out.println("insert card in: " + cardTerminal.getName());
                    }
                    all.addAll(inserted);
View Full Code Here

TOP

Related Classes of javax.smartcardio.CardTerminals

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.