2016-12-28 4 views
1

ACR35를 테스트 중이며 제공된 SDK에서이 문제가 발생합니다. 나는이 파일 구조는 정말 다른 독자 (통합 NFC 리더 안드로이드 장치)와 카드에 있는지 확인한ACR35 : APDU 명령 선택 파일이 상태를 반환합니다. 82 (파일을 찾을 수 없음)

[ Master File ] 
     | 
     |___ [ AID - F222222222 (Dedicated file) ] 
        | 
        |___ [ File id - 0001 (Elementary File) ] 

:

나는 다음과 같은 파일 구조를 가진 DESFire EV1 카드가 있습니다.

이 코드로 (원조에 의해) DF를 선택하고 :

public void powerOn(){ 
    if (mReader.piccPowerOn(timeout, cardType)) { 
     Log.i(TAG, "poweron true"); 
     byte[] test = ApduCommand.HexStringToByteArray("00A4040005F222222222"); 
     /*Transmit the command to the reader with timeout: 5 sec*/ 
     mReader.piccTransmit(timeout, test); 
    }else{ 
     Log.i(TAG, "poweron false"); 
     powerOn(); 
    } 
} 

그리고 내가 여기에 응답을 기다리고 : 여기

/* Set the PICC response APDU callback. */ 
mReader.setOnPiccResponseApduAvailableListener(new AudioJackReader.OnPiccResponseApduAvailableListener() { 
    @Override 
    public void onPiccResponseApduAvailable(AudioJackReader reader, byte[] responseApdu) { 
     String resultHex = ApduCommand.ByteArrayToHexString(responseApdu); 
     Log.i(TAG, "APDU response ("+current_status+")" + resultHex); 

     if(resultHex.equals("9000")) { 
      if (current_status == STATUS_SELECT_AID) { 
       if (mReader.piccPowerOn(timeout, cardType)) { 
        Log.i(TAG, "selecting file"); 
        byte[] selFile = ApduCommand.HexStringToByteArray("00A40200020001"); 
        current_status = STATUS_SELECT_FILE; 
        mReader.piccTransmit(timeout, selFile); 
       } else { 
        Log.i(TAG, "timed out.."); 
       } 
      }else if(current_status == STATUS_SELECT_FILE) { 
       if (mReader.piccPowerOn(timeout, cardType)) { 
        Log.i(TAG, "reading binary data"); 
        byte[] readBinary = ApduCommand.HexStringToByteArray("00B0000000"); 
        current_status = STATUS_READ_DATA; 
        mReader.piccTransmit(timeout, readBinary); 
       } else { 
        Log.i(TAG, "timed out.."); 
       } 
      } 
     } 
    } 
}); 

, 나는 성공 상태를 확인 (90 00)에서 DF를 선택했지만 파일을 찾을 때 상태 (6A 82)를 찾을 수 없습니다. 같은 카드와 안드로이드 NFC 리더기 모드에서 동일한 APDU 명령을 사용하여

12-28 18:17:02.752 27298-28923/com.example.m1alesis.smartcardreader I/acrx: APDU response (0)9000 
12-28 18:17:02.752 27298-28923/com.example.m1alesis.smartcardreader I/acrx: selecting file 
12-28 18:17:03.412 27298-28949/com.example.m1alesis.smartcardreader I/acrx: APDU response (1)6A82 

잘 작동하고 내가 파일을 선택 할 수 있어요하지만, ACR35 여러처럼하지 않는 것 다음과 같이

로그인은 순차 APDU 명령.

Github에서 프로젝트 :

+0

파일을 선택하기 전에'piccPowerOn()'을 호출하는 이유가 있습니까? 그 방법이 무엇인지는 잘 모르겠지만, 전원을 끄고 다시 켜면 DESFire 애플리케이션을 더 이상 선택할 수 없습니다. –

+1

@MichaelRoland 그게 다야 !!! 지금은 완벽하게 이해됩니다. 와우 나는이 코드를 100 번이나 훑어보고 알아낼 수 없었다. 고맙습니다. 답변으로 게시하면 받아 들일 것입니다. 그것은 미래에 다른 누군가에게 유용 할 수 있습니다. – unknown

답변

0

https://github.com/rthapa/smartcardreader이 APDU의를 보내는 사이 mReader.piccPowerOn(timeout, cardType)를 호출하지 마십시오. 방법 piccPowerOn()은 리더가 DESFire 카드를 재설정하도록합니다. 결과적으로 응용 프로그램 F222222222은 FID (선택) 명령 00 A4 0200 02 0001을 실행할 때 더 이상 선택되지 않습니다.

관련 문제