Package org.jmrtd
Class PACEKeySpec
- java.lang.Object
-
- org.jmrtd.PACEKeySpec
-
- All Implemented Interfaces:
Serializable
,KeySpec
,AccessKeySpec
public class PACEKeySpec extends Object implements AccessKeySpec
A key for PACE, can be CAN, MRZ, PIN, or PUK.- Version:
- $Revision: 1781 $ (Contributions by g.giorkhelidze.)
- Author:
- The JMRTD team ([email protected])
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PACEKeySpec(byte[] key, byte keyReference)
Constructs a key.PACEKeySpec(String key, byte keyReference)
Constructs a PACE key from a string value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PACEKeySpec
createCANKey(String can)
Creates a PACE key from a Card Access Number.static PACEKeySpec
createMRZKey(BACKeySpec mrz)
Creates a PACE key from relevant details from a Machine Readable Zone.static PACEKeySpec
createPINKey(String pin)
Creates a PACE key from a PIN.static PACEKeySpec
createPUKKey(String puk)
Creates a PACE key from a PUK.String
getAlgorithm()
Returns the algorithm.byte[]
getKey()
Returns the key bytes.byte
getKeyReference()
Returns the type of key, valid values areMRZ_PACE_KEY_REFERENCE
,CAN_PACE_KEY_REFERENCE
,PIN_PACE_KEY_REFERENCE
,PUK_PACE_KEY_REFERENCE
.
-
-
-
Constructor Detail
-
PACEKeySpec
public PACEKeySpec(String key, byte keyReference)
Constructs a PACE key from a string value.- Parameters:
key
- the string value containing CAN, PIN or PUKkeyReference
- indicates the type of key, valid values areMRZ_PACE_KEY_REFERENCE
,CAN_PACE_KEY_REFERENCE
,PIN_PACE_KEY_REFERENCE
,PUK_PACE_KEY_REFERENCE
-
PACEKeySpec
public PACEKeySpec(byte[] key, byte keyReference)
Constructs a key.- Parameters:
key
- CAN, MRZ, PIN, PUK password byteskeyReference
- indicates the type of key, valid values areMRZ_PACE_KEY_REFERENCE
,CAN_PACE_KEY_REFERENCE
,PIN_PACE_KEY_REFERENCE
,PUK_PACE_KEY_REFERENCE
-
-
Method Detail
-
createMRZKey
public static PACEKeySpec createMRZKey(BACKeySpec mrz) throws GeneralSecurityException
Creates a PACE key from relevant details from a Machine Readable Zone.- Parameters:
mrz
- the details from the Machine Readable Zone- Returns:
- the PACE key
- Throws:
GeneralSecurityException
- on error
-
createCANKey
public static PACEKeySpec createCANKey(String can)
Creates a PACE key from a Card Access Number.- Parameters:
can
- the Card Access Number- Returns:
- the PACE key
-
createPINKey
public static PACEKeySpec createPINKey(String pin)
Creates a PACE key from a PIN.- Parameters:
pin
- the PIN- Returns:
- the PACE key
-
createPUKKey
public static PACEKeySpec createPUKKey(String puk)
Creates a PACE key from a PUK.- Parameters:
puk
- the PUK- Returns:
- the PACE key
-
getAlgorithm
public String getAlgorithm()
Returns the algorithm.- Specified by:
getAlgorithm
in interfaceAccessKeySpec
- Returns:
- the algorithm
-
getKeyReference
public byte getKeyReference()
Returns the type of key, valid values areMRZ_PACE_KEY_REFERENCE
,CAN_PACE_KEY_REFERENCE
,PIN_PACE_KEY_REFERENCE
,PUK_PACE_KEY_REFERENCE
.- Returns:
- the type of key
-
getKey
public byte[] getKey()
Returns the key bytes.- Specified by:
getKey
in interfaceAccessKeySpec
- Returns:
- the key bytes
-
-