Class SecureKey
- All Implemented Interfaces:
Serializable, Loggeable
- Direct Known Subclasses:
SecureKeyBlock, SecureVariantKey
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]Secure Key Bytesprotected byte[]The keyCheckValue allows identifying which clear key does this secure key represent.protected shortThis is the bit length of the key This can be: LENGTH_DES, LENGTH_DES3_2KEY, ...protected StringOptional key nameprotected StringKey Type is useful for stating what this key can be used for.protected KeySchemeKey scheme indicates protection metchod appiled to this key by a security module. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]byte[]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).shortoptional key nameKey Type is useful for stating what this key can be used for.abstract KeySchemeGets the key scheme used to protect this key.voidsetKeyBytes(byte[] keyBytes) Sets the secure key bytesvoidsetKeyCheckValue(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).voidsetKeyLength(short keyLength) Sets the length of the key (in bits) (when it was still clear).voidsetKeyName(String keyName) optional key namevoidsetKeyType(String keyType) Key Type is useful for stating what this key can be used for.voidKey scheme indicates protection metchod appiled to this key by the security module.
-
Field Details
-
keyBytes
Secure Key Bytes -
keyCheckValue
The keyCheckValue allows identifying which clear key does this secure key represent. -
keyLength
This is the bit length of the key This can be: LENGTH_DES, LENGTH_DES3_2KEY, ... -
keyType
-
scheme
-
keyName
-
-
Constructor Details
-
SecureKey
public SecureKey()
-
-
Method Details
-
setKeyBytes
Sets the secure key bytes- Parameters:
keyBytes- byte[] representing the secured key bytes
-
getKeyBytes
- Returns:
- The byte[] holding the secure key Bytes
-
setKeyCheckValue
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). This check value allows identifying if two secure keys map to the same clear key.- Parameters:
keyCheckValue-
-
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).- Returns:
- the keyCheckValue that was set before by setKeyCheckValue()
-
setKeyLength
Sets the length of the key (in bits) (when it was still clear). This might be different than the bit length of the secureKeyBytes.- Parameters:
keyLength-
-
getKeyLength
- Returns:
- The Length of the secure key (when it was still clear)
-
setKeyType
Key Type is useful for stating what this key can be used for. The value of Key Type specifies whether this secure key is a TYPE_TMK (Terminal Master Key), TYPE_ZPK (Zone PIN Key)....- Parameters:
keyType-
-
getKeyType
Key Type is useful for stating what this key can be used for. The value of Key Type specifies whether this secure key is a TYPE_TMK (Terminal Master Key), TYPE_ZPK (Zone PIN Key)....- Returns:
- keyType
-
setScheme
-
getScheme
-
getKeyName
optional key name -
setKeyName
-