JMRTD 0.4.5

org.jmrtd
Class Util

java.lang.Object
  extended by org.jmrtd.Util

Deprecated. The visibility of this class will be changed to package.

public class Util
extends Object

Some static helper functions. Mostly dealing with low-level crypto.

Version:
$Revision: 1208 $
Author:
Cees-Bart Breunesse (ceesb@cs.ru.nl), Engelbert Hubbers (hubbers@cs.ru.nl), Martijn Oostdijk (martijn.oostdijk@gmail.com), Ronny Wichers Schreur (ronny@cs.ru.nl)

Field Summary
static int ENC_MODE
          Deprecated.  
static int MAC_MODE
          Deprecated.  
 
Method Summary
static byte[] computeKeySeed(String docNrStr, String dateOfBirthStr, String dateOfExpiryStr)
          Deprecated. Computes the static key seed, based on information from the MRZ.
static long computeSendSequenceCounter(byte[] rndICC, byte[] rndIFD)
          Deprecated.  
static SecretKey deriveKey(byte[] keySeed, int mode)
          Deprecated. Derives the ENC or MAC key from the keySeed.
static byte[] pad(byte[] in)
          Deprecated. Pads the input in according to ISO9797-1 padding method 2.
static byte[] pad(byte[] in, int offset, int length)
          Deprecated.  
static byte[] recoverMessage(int digestLength, byte[] plaintext)
          Deprecated. Recovers the M1 part of the message sent back by the AA protocol (INTERNAL AUTHENTICATE command).
static byte[] unpad(byte[] in)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENC_MODE

public static final int ENC_MODE
Deprecated. 
See Also:
Constant Field Values

MAC_MODE

public static final int MAC_MODE
Deprecated. 
See Also:
Constant Field Values
Method Detail

deriveKey

public static SecretKey deriveKey(byte[] keySeed,
                                  int mode)
                           throws GeneralSecurityException
Deprecated. 
Derives the ENC or MAC key from the keySeed.

Parameters:
keySeed - the key seed.
mode - either ENC_MODE or MAC_MODE.
Returns:
the key.
Throws:
GeneralSecurityException

computeKeySeed

public static byte[] computeKeySeed(String docNrStr,
                                    String dateOfBirthStr,
                                    String dateOfExpiryStr)
                             throws UnsupportedEncodingException,
                                    GeneralSecurityException
Deprecated. 
Computes the static key seed, based on information from the MRZ.

Parameters:
docNrStr - a string containing the document number.
dateOfBirthStr - a string containing the date of birth (YYMMDD).
dateOfExpiryStr - a string containing the date of expiry (YYMMDD).
Returns:
a byte array of length 16 containing the key seed.
Throws:
UnsupportedEncodingException
GeneralSecurityException

computeSendSequenceCounter

public static long computeSendSequenceCounter(byte[] rndICC,
                                              byte[] rndIFD)
Deprecated. 

pad

public static byte[] pad(byte[] in)
Deprecated. 
Pads the input in according to ISO9797-1 padding method 2.

Parameters:
in - input
Returns:
padded output

pad

public static byte[] pad(byte[] in,
                         int offset,
                         int length)
Deprecated. 

unpad

public static byte[] unpad(byte[] in)
Deprecated. 

recoverMessage

public static byte[] recoverMessage(int digestLength,
                                    byte[] plaintext)
Deprecated. 
Recovers the M1 part of the message sent back by the AA protocol (INTERNAL AUTHENTICATE command). The algorithm is described in ISO 9796-2:2002 9.3. Based on code by Ronny (ronny@cs.ru.nl) who presumably ripped this from Bouncy Castle.

Parameters:
digestLength - should be 20
plaintext - response from card, already 'decrypted' (using the AA public key)
Returns:
the m1 part of the message

JMRTD 0.4.5