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
ConstructorsModifierConstructorDescriptionprotectedDefault constructor; no instance state to initialise. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Returns the secure (LMK-protected) key bytes.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).shortReturns the clear-key length in bits.Returns the optional key name.Key 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) Sets the optional key name.voidsetKeyType(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.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Loggeable
dump, dumpModifier and TypeMethodDescriptionvoiddump(PrintStream p, String indent) Dumps a human-readable representation of this object to the print stream.default voiddump(PrintStream p, String indent, LogRenderer.Type type) Dumps a representation of this object using the specified renderer type.
-
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
protected SecureKey()Default constructor; no instance state to initialise.
-
-
Method Details
-
setKeyBytes
Sets the secure key bytes- Parameters:
keyBytes- byte[] representing the secured key bytes
-
getKeyBytes
Returns the secure (LMK-protected) key bytes.- 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- 3-byte (or longer) key check value
-
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- clear key length in bits
-
getKeyLength
Returns the clear-key length in bits.- 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- key-type label (e.g.TYPE_ZPK,TYPE_TMK)
-
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
Returns the optional key name.- Returns:
- the configured key name, or
nullif none was set
-
setKeyName
-