public abstract class SecureKey extends java.lang.Object implements java.io.Serializable, Loggeable
A SecureKey is typically a key encrypted under one of the secret keys that are
protected by the security module itself (Local Master Keys --LMK for short).
SecureKey just holds:
1- Secure Key: a byte[] holding the key in the secure proprietary format
of your security module. This is typically the clear key encrypted under LMK.
2- Key Type: identifies what this key can be used for (e.g. TYPE_ZPK
(Zone PIN Key), TYPE_ZMK (Zone Master Key)...
3- Key Length (in bits): also called key size. e.g. LENGTH_DES, LENGTH_DES3_2KEY,...etc.
This is not necessarily deducible from the length of the byte[] holding
the secure key bytes, since encryption under LMK is proprietary to the
security module.
NOTE: The security of SecureKey is totally dependent on the security of the used security module.
SMAdapter
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected byte[] |
keyBytes
Secure Key Bytes
|
protected byte[] |
keyCheckValue
The keyCheckValue allows identifying which clear key does this
secure key represent.
|
protected short |
keyLength
This is the bit length of the key
This can be: LENGTH_DES, LENGTH_DES3_2KEY, ...
|
protected java.lang.String |
keyName
Optional key name
|
protected java.lang.String |
keyType
Key Type is useful for stating what this key can be used for.
|
protected KeyScheme |
scheme
Key scheme indicates protection metchod appiled to this key by
a security module.
|
Constructor and Description |
---|
SecureKey() |
Modifier and Type | Method and Description |
---|---|
byte[] |
getKeyBytes() |
byte[] |
getKeyCheckValue()
The Key Check Value is typically a 24-bits (3 bytes) formed by encrypting a
block of zeros under the secure key when the secure key is clear
(not in this class, but inside the security module).
|
short |
getKeyLength() |
java.lang.String |
getKeyName()
optional key name
|
java.lang.String |
getKeyType()
Key Type is useful for stating what this key can be used for.
|
abstract KeyScheme |
getScheme()
Gets the key scheme used to protect this key.
|
void |
setKeyBytes(byte[] keyBytes)
Sets the secure key bytes
|
void |
setKeyCheckValue(byte[] keyCheckValue)
The Key Check Value is typically a 24-bits (3 bytes) formed by encrypting a
block of zeros under the secure key when the secure key is clear
(not in this class, but inside the security module).
|
void |
setKeyLength(short keyLength)
Sets the length of the key (in bits) (when it was still clear).
|
void |
setKeyName(java.lang.String keyName)
optional key name
|
void |
setKeyType(java.lang.String keyType)
Key Type is useful for stating what this key can be used for.
|
void |
setScheme(KeyScheme scheme)
Key scheme indicates protection metchod appiled to this key by
the security module.
|
protected byte[] keyBytes
protected byte[] keyCheckValue
protected short keyLength
protected java.lang.String keyType
protected KeyScheme scheme
protected java.lang.String keyName
public void setKeyBytes(byte[] keyBytes)
keyBytes
- byte[] representing the secured key bytespublic byte[] getKeyBytes()
public void setKeyCheckValue(byte[] keyCheckValue)
keyCheckValue
- public byte[] getKeyCheckValue()
public void setKeyLength(short keyLength)
keyLength
- public short getKeyLength()
public void setKeyType(java.lang.String keyType)
keyType
- public java.lang.String getKeyType()
public void setScheme(KeyScheme scheme)
scheme
- key scheme used to protect this key.public abstract KeyScheme getScheme()
public java.lang.String getKeyName()
public void setKeyName(java.lang.String keyName)
keyName
- string