2015-06-11 36 views
0

我可以從PB的Tactivo智能卡讀卡器上讀取智能卡,但我不熟悉驗證過程。這裏是什麼,我要讀取輸入的例子:如何使用Precise Biometrics的輸入驗證智能卡/ CAC卡Tactivo

... 
channel = card.getBasicChannel(); 

     // See www.globalplatform.org for more information about this command. 
     // CLA = 0x80 
     // INS = 0xCa 
     // P1 = 0x9F 
     // P2 = 0x7F 
     // Le = 0x00 
     CommandAPDU GET_DATA_CardProductionLifeCycle = new CommandAPDU(0x80, 0xCA, 0x9F, 0x7F, 0x00); 

     ResponseAPDU cardResponse; 

     // Send the command to the card 
     cardResponse = channel.transmit(GET_DATA_CardProductionLifeCycle); 

     // Check SW1 if we provided wrong Le 
     if (cardResponse.getSW1() == 0x6C) { 
      // Modify the command with correct Le reported by the card in SW2. 
      GET_DATA_CardProductionLifeCycle = new CommandAPDU(0x80, 0xCA, 0x9F, 0x7F, cardResponse.getSW2()); 
      // Re-send the command but now with correct Le 
      cardResponse = channel.transmit(GET_DATA_CardProductionLifeCycle); 
     } 

     // Check if the card has data for us to collect 
     if (cardResponse.getSW1() == 0x61) { 
      // Issue a GET RESPONSE command using SW2 as Le 
      CommandAPDU GET_RESPONSE = new CommandAPDU(0x00, 0xC0, 0x00, 0x00, cardResponse.getSW2()); 
      cardResponse = channel.transmit(GET_RESPONSE); 
     } 

     // Check the final result of the GET DATA CPLC command 
     if (cardResponse.getSW() != 0x9000) { 
      // The card does not support Global Platform 
      System.out.println(String.format("8Card responded with SW:%04x", cardResponse.getSW()));// some sort of SW from the card here... Read as "SW: 6a82 
      System.out.println("9This card does not support the Global Platform " + "GET CPLC command"); 

      return; 
     } 

     // we do not validate the data in this example - we assume that it is 
     // correct... 
... 

如果任何人有智能卡/ CAC卡valitaion /認證,請給我一些指導,比如,什麼關的工作經驗。因爲這裏有很少的文檔。

更新: 我有一個Android應用程序,我想用智能卡來保護。我能夠使用Precise Biometrics Tactivo智能卡讀卡器讀取任何智能卡的輸入。我如何驗證/驗證此輸入以僅允許某些用戶訪問該應用程序?

+1

我不明白android標籤。請同時嘗試讓您的問題更具體,以避免投票或關閉請求:它是讀者,CAC應用程序,一般的智能卡?你指什麼輸入(PIN,指紋)?你認爲什麼是驗證? – guidot

+0

查看更新。我所說的輸入是我將智能卡插入讀卡器時所獲得的輸入。我可以得到一個輸入:'String UID = card.getATR()。toString();'我怎樣才能驗證這個?或者這是首先驗證的錯誤變量? – hunterInt

回答

1

ATR不適合任何類型的驗證,因爲它通常由數千張卡共享。

雖然卡片具有唯一標識符(製造商特定),但在找到有效卡片後可以很容易僞造。

需要一定的卡的典型裝置(如雙因素授權的組分,加入東西,你有東西喲知道例如PIN,口令)是外部認證的執行。既然你需要在卡上存儲你自己的密鑰,它不會成爲你剛纔擁有的卡的選項。

+0

親愛的guidot,因爲上帝請改變你的頭像爲更友好的圖片:(一個岩石的人,他的臉因酸雨而毀了?:(爲什麼?(臨時評論) – Abraham