|
JMRTD 0.4.5 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sourceforge.scuba.smartcards.CardService
org.jmrtd.PassportApduService
public class PassportApduService
Low level card service for sending apdus to the passport. This service is not responsible for maintaining information about the state of the authentication or secure messaging protocols. It merely offers the basic functionality for sending passport specific apdus to the passport. Based on ICAO-TR-PKI. Defines the following commands:
GET CHALLENGEEXTERNAL AUTHENTICATEINTERNAL AUTHENTICATE (using secure messaging)SELECT FILE (using secure messaging)READ BINARY (using secure messaging)
| Field Summary |
|---|
| Fields inherited from class net.sourceforge.scuba.smartcards.CardService |
|---|
listeners, SESSION_STARTED_STATE, SESSION_STOPPED_STATE, state |
| Constructor Summary | |
|---|---|
PassportApduService(CardService service)
Creates a new passport apdu sending service. |
|
| Method Summary | |
|---|---|
void |
addAPDUListener(APDUListener l)
Adds a listener. |
void |
close()
Closes the session with the card. |
protected CommandAPDU |
createGetChallengeAPDU()
|
CommandAPDU |
createReadBinaryAPDU(int offset,
int le,
boolean longRead)
|
boolean |
isOpen()
Whether this service is open. |
void |
open()
Opens a session by connecting to the card and selecting the passport applet. |
void |
removeAPDUListener(APDUListener l)
Removes the listener l, if present. |
byte[] |
sendGetChallenge()
Sends a GET CHALLENGE command to the passport. |
byte[] |
sendGetChallenge(SecureMessagingWrapper wrapper)
Sends a GET CHALLENGE command to the passport. |
byte[] |
sendInternalAuthenticate(SecureMessagingWrapper wrapper,
byte[] rndIFD)
Sends an INTERNAL AUTHENTICATE command to the passport. |
void |
sendMSEAT(SecureMessagingWrapper wrapper,
byte[] data)
The MSE AT APDU, see EAC 1.11 spec, Section B.2 |
void |
sendMSEDST(SecureMessagingWrapper wrapper,
byte[] data)
The MSE DST APDU, see EAC 1.11 spec, Section B.2 |
void |
sendMSEKAT(SecureMessagingWrapper wrapper,
byte[] keyData,
byte[] idData)
The MSE KAT APDU, see EAC 1.11 spec, Section B.1 |
byte[] |
sendMutualAuth(byte[] rndIFD,
byte[] rndICC,
byte[] kIFD,
SecretKey kEnc,
SecretKey kMac)
Sends an EXTERNAL AUTHENTICATE command to the passport. |
void |
sendMutualAuthenticate(SecureMessagingWrapper wrapper,
byte[] signature)
Sends the EXTERNAL AUTHENTICATE commands for EAC terminal verification |
void |
sendPSOChainMode(SecureMessagingWrapper wrapper,
byte[] certBodyData,
byte[] certSignatureData)
|
void |
sendPSOExtendedLengthMode(SecureMessagingWrapper wrapper,
byte[] certBodyData,
byte[] certSignatureData)
|
byte[] |
sendReadBinary(SecureMessagingWrapper wrapper,
int offset,
int le,
boolean longRead)
Sends a READ BINARY command to the passport. |
byte[] |
sendReadBinary(short offset,
int le)
Sends a READ BINARY command to the passport. |
int |
sendSelectApplet(byte[] aid)
Sends a SELECT APPLET command to the card. |
void |
sendSelectFile(SecureMessagingWrapper wrapper,
short fid)
Sends a SELECT FILE command to the passport. |
void |
setListenersState(boolean state)
|
void |
setService(CardService service)
|
ResponseAPDU |
transmit(CommandAPDU capdu)
TO CLARIFY: If the card responds with a status word other than 0x9000, ie. an staus word indicating an error, this method does NOT throw a CardServiceException, but it returns this as error code as result. |
| Methods inherited from class net.sourceforge.scuba.smartcards.CardService |
|---|
notifyExchangedAPDU |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PassportApduService(CardService service)
throws CardServiceException
service - another service which will deal with sending the apdus to the
card
GeneralSecurityException - when the available JCE providers cannot provide the necessary
cryptographic primitives:
CardServiceException| Method Detail |
|---|
public void open()
throws CardServiceException
open in class CardServiceCardServiceExceptionpublic boolean isOpen()
isOpen in class CardServicepublic void setListenersState(boolean state)
setListenersState in class CardService
public ResponseAPDU transmit(CommandAPDU capdu)
throws CardServiceException
transmit in class CardServicecapdu - the command apdu to send.
CardServiceException - - if the card operation failedpublic void close()
CardService
close in class CardServicepublic void setService(CardService service)
public void addAPDUListener(APDUListener l)
CardService
addAPDUListener in class CardServicel - the listener to addpublic void removeAPDUListener(APDUListener l)
CardServicel, if present.
removeAPDUListener in class CardServicel - the listener to remove
public CommandAPDU createReadBinaryAPDU(int offset,
int le,
boolean longRead)
protected CommandAPDU createGetChallengeAPDU()
public int sendSelectApplet(byte[] aid)
throws CardServiceException
SELECT APPLET command to the card.
aid - the applet to select
CardServiceException
public void sendSelectFile(SecureMessagingWrapper wrapper,
short fid)
throws CardServiceException
SELECT FILE command to the passport. Secure
messaging will be applied to the command and response apdu.
wrapper - the secure messaging wrapper to usefid - the file to select
CardServiceException
public byte[] sendReadBinary(short offset,
int le)
throws CardServiceException
READ BINARY command to the passport.
offset - offset into the filele - the expected length of the file to read
le with (the specified part
of) the contents of the currently selected file
CardServiceException
public byte[] sendReadBinary(SecureMessagingWrapper wrapper,
int offset,
int le,
boolean longRead)
throws CardServiceException
READ BINARY command to the passport. Secure
messaging will be applied to the command and response apdu.
wrapper - the secure messaging wrapper to useoffset - offset into the filele - the expected length of the file to readlongRead - whether it should be a long (INS=B1) read
le with (the specified part
of) the contents of the currently selected file
CardServiceException
public byte[] sendGetChallenge()
throws CardServiceException
GET CHALLENGE command to the passport.
CardServiceException
public byte[] sendGetChallenge(SecureMessagingWrapper wrapper)
throws CardServiceException
GET CHALLENGE command to the passport.
CardServiceException
public byte[] sendInternalAuthenticate(SecureMessagingWrapper wrapper,
byte[] rndIFD)
throws CardServiceException
INTERNAL AUTHENTICATE command to the passport.
wrapper - secure messaging wrapperrndIFD - the challenge to send
CardServiceException
public byte[] sendMutualAuth(byte[] rndIFD,
byte[] rndICC,
byte[] kIFD,
SecretKey kEnc,
SecretKey kMac)
throws CardServiceException
EXTERNAL AUTHENTICATE command to the passport. The
resulting byte array has length 32 and contains rndICC
(first 8 bytes), rndIFD (next 8 bytes), their key material "
kICC" (last 16 bytes).
rndIFD - our challengerndICC - their challengekIFD - our key materialkEnc - the static encryption keykMac - the static mac key
kEnc) and verified
(using kMac)
CardServiceException
public void sendMutualAuthenticate(SecureMessagingWrapper wrapper,
byte[] signature)
throws CardServiceException
wrapper - secure messaging wrappersignature - terminal signature
CardServiceException - if the resulting status word different from 9000
public void sendMSEKAT(SecureMessagingWrapper wrapper,
byte[] keyData,
byte[] idData)
throws CardServiceException
wrapper - secure messaging wrapperkeyData - key data object (tag 0x91)idData - key id data object (tag 0x84), can be null
CardServiceException - on error
public void sendMSEDST(SecureMessagingWrapper wrapper,
byte[] data)
throws CardServiceException
wrapper - secure messaging wrapperdata - public key reference data object (tag 0x83)
CardServiceException - on error
public void sendMSEAT(SecureMessagingWrapper wrapper,
byte[] data)
throws CardServiceException
wrapper - secure messaging wrapperdata - public key reference data object (tag 0x83)
CardServiceException - on error
public void sendPSOExtendedLengthMode(SecureMessagingWrapper wrapper,
byte[] certBodyData,
byte[] certSignatureData)
throws CardServiceException
CardServiceException
public void sendPSOChainMode(SecureMessagingWrapper wrapper,
byte[] certBodyData,
byte[] certSignatureData)
throws CardServiceException
CardServiceException
|
JMRTD 0.4.5 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||