JMRTD 0.4.5

org.jmrtd
Class PassportPersoService

java.lang.Object
  extended by net.sourceforge.scuba.smartcards.CardService
      extended by org.jmrtd.PassportPersoService
All Implemented Interfaces:
Serializable

public class PassportPersoService
extends CardService

Service for initializing blank passport reference applets.

Author:
Cees-Bart Breunesse (ceesb@cs.ru.nl)
See Also:
Serialized Form

Field Summary
static String EC_CURVE_NAME
          The name of the EC curve for DH key pair generation (this is the only one that our passport applet supports.
 
Fields inherited from class net.sourceforge.scuba.smartcards.CardService
listeners, SESSION_STARTED_STATE, SESSION_STOPPED_STATE, state
 
Constructor Summary
PassportPersoService(CardService service)
           
 
Method Summary
 void burnPassport(ZipFile passportData)
          Burns a passport
 void close()
          Closes the session with the card.
 void createFile(short fid, short length)
          Sends a CREATE_FILE APDU to the card.
 void dumpPassport(File f)
          Dumps the content of a passport as a zip file
static KeyPair generateAAKeyPair()
          Deprecated. Leave this responsibility to the client
 boolean isOpen()
           
 void lockApplet()
          Locks the passport applet so that no data may be written to it.
 void open()
          Opens a session with the card.
 void putCVCertificate(org.jmrtd.cert.CardVerifiableCertificate certificate)
          Sends a PUT_DATA command to the card to set the root cv certificate for Extended Access Control.
 void putPrivateEACKey(PrivateKey privKey)
          Sends a PUT_DATA command to the card to set the private key used for Extended Access Control.
 void putPrivateKey(PrivateKey key)
          Sends a PUT_DATA command to the card to set the private keys used for Active Authentication.
 void selectFile(short fid)
          Selects a file on the applet.
 void setBAC(String documentNumber, Date dateOfBirth, Date dateOfExpiry)
          Initiates the passport with MRZ data
 ResponseAPDU transmit(CommandAPDU apdu)
          Sends and apdu to the card.
 void writeFile(short fid, InputStream i)
          Writes a DataGroup in the passport
 
Methods inherited from class net.sourceforge.scuba.smartcards.CardService
addAPDUListener, notifyExchangedAPDU, removeAPDUListener, setListenersState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EC_CURVE_NAME

public static final String EC_CURVE_NAME
The name of the EC curve for DH key pair generation (this is the only one that our passport applet supports.

See Also:
Constant Field Values
Constructor Detail

PassportPersoService

public PassportPersoService(CardService service)
                     throws CardServiceException
Throws:
CardServiceException
Method Detail

generateAAKeyPair

public static KeyPair generateAAKeyPair()
                                 throws GeneralSecurityException,
                                        NoSuchAlgorithmException
Deprecated. Leave this responsibility to the client

Generates an RSA keypair fit for Active Authentication.

Returns:
a KeyPair
Throws:
GeneralSecurityException
NoSuchAlgorithmException - when BouncyCastle provider cannot be found.

putPrivateKey

public void putPrivateKey(PrivateKey key)
                   throws CardServiceException
Sends a PUT_DATA command to the card to set the private keys used for Active Authentication.

Parameters:
key - holding the private key data.
Throws:
IOException - on error.
CardServiceException

putPrivateEACKey

public void putPrivateEACKey(PrivateKey privKey)
                      throws CardServiceException
Sends a PUT_DATA command to the card to set the private key used for Extended Access Control.

Parameters:
privKey - holding the private key data.
Throws:
CardServiceException - on error.

putCVCertificate

public void putCVCertificate(org.jmrtd.cert.CardVerifiableCertificate certificate)
                      throws CardServiceException
Sends a PUT_DATA command to the card to set the root cv certificate for Extended Access Control.

Parameters:
certificate - card verifiable certificate
Throws:
CardServiceException - on error.

createFile

public void createFile(short fid,
                       short length)
                throws CardServiceException
Sends a CREATE_FILE APDU to the card.

Parameters:
fid - (file identifier) of the new file.
length - of the new file.
Throws:
CardServiceException

writeFile

public void writeFile(short fid,
                      InputStream i)
               throws CardServiceException
Writes a DataGroup in the passport

Parameters:
fid - the fid of the file to write
i - the inputstream of the file to write
Throws:
CardServiceException

setBAC

public void setBAC(String documentNumber,
                   Date dateOfBirth,
                   Date dateOfExpiry)
            throws CardServiceException
Initiates the passport with MRZ data

Parameters:
documentNumber - the passport document number
dateOfBirth - the date of birth of the holder
dateOfExpiry - the date of expiry of the passport
Throws:
CardServiceException

lockApplet

public void lockApplet()
                throws CardServiceException
Locks the passport applet so that no data may be written to it.

Throws:
CardServiceException

selectFile

public void selectFile(short fid)
                throws CardServiceException
Selects a file on the applet.

Parameters:
fid - the file ID to select
Throws:
CardServiceException

burnPassport

public void burnPassport(ZipFile passportData)
                  throws CardServiceException,
                         IOException
Burns a passport

Parameters:
passportData -
Throws:
CardServiceException
IOException

dumpPassport

public void dumpPassport(File f)
                  throws IOException
Dumps the content of a passport as a zip file

Throws:
IOException

close

public void close()
Description copied from class: CardService
Closes the session with the card. Disconnects from the card and reader. Notifies any interested apduListeners.

Specified by:
close in class CardService

isOpen

public boolean isOpen()
Specified by:
isOpen in class CardService

open

public void open()
          throws CardServiceException
Description copied from class: CardService
Opens a session with the card. Selects a reader. Connects to the card. Notifies any interested apduListeners.

Specified by:
open in class CardService
Throws:
CardServiceException

transmit

public ResponseAPDU transmit(CommandAPDU apdu)
                      throws CardServiceException
Description copied from class: CardService
Sends and apdu to the card. Notifies any interested apduListeners. This method does not throw a CardServiceException if the ResponseAPDU is status word indicating error.

Specified by:
transmit in class CardService
Parameters:
apdu - the command apdu to send.
Returns:
the response from the card, including the status word.
Throws:
CardServiceException - - if the card operation failed

JMRTD 0.4.5