Package org.jmrtd
Class PACEKeySpec
- java.lang.Object
-
- org.jmrtd.PACEKeySpec
-
- All Implemented Interfaces:
java.io.Serializable
,java.security.spec.KeySpec
,AccessKeySpec
public class PACEKeySpec extends java.lang.Object implements AccessKeySpec
A key for PACE, can be CAN, MRZ, PIN, or PUK.- Version:
- $Revision: 1816 $ (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(java.lang.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(java.lang.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(java.lang.String pin)
Creates a PACE key from a PIN.static PACEKeySpec
createPUKKey(java.lang.String puk)
Creates a PACE key from a PUK.boolean
equals(java.lang.Object obj)
java.lang.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
.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
PACEKeySpec
public PACEKeySpec(java.lang.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 java.security.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:
java.security.GeneralSecurityException
- on error
-
createCANKey
public static PACEKeySpec createCANKey(java.lang.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(java.lang.String pin)
Creates a PACE key from a PIN.- Parameters:
pin
- the PIN- Returns:
- the PACE key
-
createPUKKey
public static PACEKeySpec createPUKKey(java.lang.String puk)
Creates a PACE key from a PUK.- Parameters:
puk
- the PUK- Returns:
- the PACE key
-
getAlgorithm
public java.lang.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
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-