문제

Smart Card Reader와 함께 Maestro/Mastercard에서 계정 번호를 읽어야합니다. Java 1.6과 Javax.smartcardio 패키지를 사용하고 있습니다. PAN 번호를 위해 Card의 칩에 저장된 EMV 응용 프로그램을 요청하는 APDU 명령을 보내야합니다. 문제는 필요한 데이터를 어디서나 반환 할 APDU 명령을 구성 할 일반 바이트 배열을 찾을 수 없다는 것입니다 ...

도움이 되었습니까?

해결책

APDU를 더 포장 할 필요는 없습니다. API 층은이를 처리해야합니다.

0x6D00 응답은 응용 프로그램이 INS를 지원하지 않았 음을 의미합니다.

지금 문제 해결 만하면 마스터 카드 응용 프로그램을 선택하여 시작했습니다.

즉, 다음과 같은 것 :

void selectApplication(CardChannel channel) throws CardException {
  byte[] masterCardRid = new byte[]{0xA0, 0x00, 0x00, 0x00, 0x04};
  CommandAPDU command = new CommandAPDU(0x00, 0xA4, 0x04, 0x00, masterCardRid);
  ResponseAPDU response = channel.transmit(command);
  return response.getData();
}

다른 팁

다음은 작업 예입니다.

CardChannel channel = card.getBasicChannel(); 

 byte[] selectMaestro={(byte)0x00, (byte)0xA4,(byte)0x04,(byte)0x00 ,(byte)0x07 ,(byte)0xA0 ,(byte)0x00 ,(byte)0x00 ,(byte)0x00 ,(byte)0x04 ,(byte)0x30 ,(byte)0x60 ,(byte)0x00};
  byte[] getProcessingOptions={(byte)0x80,(byte)0xA8,(byte)0x00,(byte)0x00,(byte)0x02,(byte)0x83,(byte)0x00,(byte)0x00};
  byte[] readRecord={(byte)0x00,(byte)0xB2,(byte)0x02,(byte)0x0C,(byte)0x00};

  ResponseAPDU r=null;

   try {
     ATR atr = card.getATR(); //reset kartice

      CommandAPDU capdu=new CommandAPDU( selectMaestro   );

       r=card.getBasicChannel().transmit( capdu );

      capdu=new CommandAPDU(getProcessingOptions);
      r=card.getBasicChannel().transmit( capdu );


      capdu=new CommandAPDU(readRecord);
      r=card.getBasicChannel().transmit( capdu );

이것은 Maestro Card와 함께 작동합니다. PAN 번호를 읽을 수 있지만 이제 MasterCard의 PAN 번호를 읽어야합니다. 읽기 레코드 APDU를 변경하거나 응용 프로그램 APDU를 선택 해야하는지 모르겠습니다. Apdus에 익숙한 사람이 있습니까?

atr = open();
prints(atr);

prints("[Step 1] Select 1PAY.SYS.DDF01 to get the PSE directory");
cmd = new ISOSelect(ISOSelect.SELECT_AID, EMV4_1.AID_1PAY_SYS_DDF01);
card_response = execute(cmd);
prints(card_response);
SFI = NumUtil.hex2String((byte)((1 < < 3) | 4));

// try SFI 1 record 1
prints("[Step 2] Send READ RECORD with 0 to find out where the record is");
read = new EMVReadRecord(SFI, "01", "00");
card_response = execute(read);
prints(card_response);
byte_size = NumUtil.hex2String(card_response.getStatusWord().getSw2());

prints("[Step 3] Send READ RECORD with 1C to get the PSE data");
read = new EMVReadRecord(SFI, "01", byte_size);
card_response = execute(read);
prints(card_response);
// the AID is A0000000031010
prints("[Step 4] Now that we know the AID, select the application");

cmd = new ISOSelect(ISOSelect.SELECT_AID, "A0000000031010");
card_response = execute(cmd);
prints(card_response);
prints("[Step 5] Send GET PROCESSING OPTIONS command");

cmd = new EMVGetProcessingOptions();
card_response = execute(cmd);
prints(card_response);

// SFI for the first group of AFL is 0C

prints("[Step 6] Send READ RECORD with 0 to find out where the record is");
read = new EMVReadRecord("0C", "01", "00");
card_response = execute(read);
prints(card_response);
byte_size = NumUtil.hex2String(card_response.getStatusWord().getSw2());

prints("[Step 7] Use READ RECORD with the given number of bytes to retrieve the data");
read = new EMVReadRecord("0C", "01", byte_size);
card_response = execute(read);
prints(card_response);

data = new TLV(card_response.getData());

close();

CommandApdu 객체를 구성하고 전송 ()-명령으로 전달해야합니다.

스마트 카드의 문서에서 정확한 명령을 찾을 수 있어야하지만 다음은 다음과 같습니다.

byte[] readFile(CardChannel channel) throws CardException {
  CommandAPDU command = new CommandAPDU(0xB0, 0x60, 0x10, 0x00);
  ResponseAPDU response = channel.transmit(command);
  return response.getData();
}

당신은 당신의 문서에서 0x6d00이 의미하는 바를 찾아 보셨습니까? 봉투 명령이 지원되지 않는 것 같습니다. t = 1 대신 t = 0 프로토콜을 사용해 보셨습니까?

내 예제가 당신의 카드에서 작동하지 않을 것입니다. 나는 어떤 Apdus가 Maestro/Mas

명령에 다음과 같은 명시 적 예상 길이를 제공하십시오.

byte[] readPan(CardChannel channel) throws CardException {
  CommandAPDU command = new CommandAPDU(0x00, 0xB2, 0x5a, 0x14, 250);
  ResponseAPDU response = channel.transmit(command);
  return response.getData();
}

스캐너 사용, 카드 사진 가져 오기, 좋은 Java OCR 라이브러리로 사진 내용을 스캔하는 것은 어떻습니까? http://ocr4j.sourceforge.net/ 예를 들어) 및 (일반적으로) 16 자리 시퀀스 xxxx-xxxx-xxxx-xxxx를 검색하면 Java를 사용하여 모든 EMV 카드에서 팬을 얻게됩니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top