Class SecureKeyBlock
- All Implemented Interfaces:
Serializable, Loggeable
In addition to standard Key Chcek Value and Key Schema, specifies the key block header, optional key block header, encrypted key and key block MAC.
The SecureKeyBlock instance can come from HSM (generate, import,
translate) or from the key store. And this is an integral whole.
Therefore, manipulation of key block values is not desirable. This is the
reason why the key block setters methods are not available. Use the
SecureKeyBlockBuilder to create the key block structure.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AlgorithmThe cryptographic algorithm with which the key contained in key block will be used.protected ExportabilityThe conditions under which the key can be exported outside the cryptographic domain.protected intEntire key block length after encoding (header, optional header, encrypted confidential data, and MAC).protected byte[]The key block MAC ensures the integrity of the key block, and is calculated over the Header, Optional Header Blocks and the encrypted Key Data.protected charIdentifies the method by which the key block is cryptographically protected and the content layout of the block.protected KeyUsageThe primary usage of the key contained in the key block.protected StringVersion number to optionally indicate that the contents of the key block is a component (key part), or to prevent re-injection of an old key.protected ModeOfUseThe operation that the key contained in the key block can perform.The TR-31 Key Block format allows a key block to contain up to 99 Optional Header Blocks which can be used to include additional (optional) data within the Key Block.protected StringThis element is not specified by TR-31 (should contain two ASCII zeros).Fields inherited from class SecureKey
keyBytes, keyCheckValue, keyLength, keyName, keyType, schemeModifier 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 TypeMethodDescriptionvoiddump(PrintStream p, String indent) Dumps SecureKeyBlock basic informationThe cryptographic algorithm with which the key contained in key block will be used.The conditions under which the key can be exported outside the cryptographic domain.intEntire key block length after encoding (header, optional header, encrypted confidential data, and MAC).byte[]The key block MAC ensures the integrity of the key block.charIdentifies the method by which the key block is cryptographically protected and the content layout of the block.shortReturns the clear-key length in bits.Key Type is useful for stating what this key can be used for.The primary usage of the key contained in the key block.Version number to optionally indicate that the contents of the key block is a component (key part), or to prevent re-injection of an old key.The operation that the key contained in the key block can perform.The key blok Optional Header Blocks.This element is not specified by TR-31 (should contain two ASCII zeros).Gets the key scheme used to protect this key.voidsetKeyLength(short keyLength) Sets the length of the key (in bits) (when it was still clear).voidsetKeyType(String keyType) Key Type is useful for stating what this key can be used for.Methods inherited from class SecureKey
getKeyBytes, getKeyCheckValue, getKeyName, setKeyBytes, setKeyCheckValue, setKeyName, setSchemeModifier 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).Returns the optional key name.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).voidsetKeyName(String keyName) Sets the optional key name.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
dumpModifier and TypeMethodDescriptiondefault voiddump(PrintStream p, String indent, LogRenderer.Type type) Dumps a representation of this object using the specified renderer type.
-
Field Details
-
keyBlockVersion
Identifies the method by which the key block is cryptographically protected and the content layout of the block. -
keyBlockLength
Entire key block length after encoding (header, optional header, encrypted confidential data, and MAC). -
keyUsage
-
algorithm
-
modeOfUse
-
keyVersion
Version number to optionally indicate that the contents of the key block is a component (key part), or to prevent re-injection of an old key. -
exportability
The conditions under which the key can be exported outside the cryptographic domain. -
reserved
-
optionalHeaders
The TR-31 Key Block format allows a key block to contain up to 99 Optional Header Blocks which can be used to include additional (optional) data within the Key Block. -
keyBlockMAC
The key block MAC ensures the integrity of the key block, and is calculated over the Header, Optional Header Blocks and the encrypted Key Data.
-
-
Constructor Details
-
SecureKeyBlock
protected SecureKeyBlock()Constructs an SecureKeyBlock.It can be used internally by e.g:
SecureKeyBlockBuilder.
-
-
Method Details
-
setKeyType
Description copied from class:SecureKeyKey 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)....- Overrides:
setKeyTypein classSecureKey- Parameters:
keyType- key-type label (e.g.TYPE_ZPK,TYPE_TMK)
-
getKeyType
Description copied from class:SecureKeyKey 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)....- Overrides:
getKeyTypein classSecureKey- Returns:
- keyType
-
setKeyLength
Description copied from class:SecureKeySets the length of the key (in bits) (when it was still clear). This might be different than the bit length of the secureKeyBytes.- Overrides:
setKeyLengthin classSecureKey- Parameters:
keyLength- clear key length in bits
-
getKeyLength
Description copied from class:SecureKeyReturns the clear-key length in bits.- Overrides:
getKeyLengthin classSecureKey- Returns:
- The Length of the secure key (when it was still clear)
-
getScheme
-
getKeyBlockVersion
Identifies the method by which the key block is cryptographically protected and the content layout of the block.- Returns:
- The key block version that corresponds to byte 0 of the key block.
-
getKeyBlockLength
Entire key block length after encoding (header, optional header, encrypted confidential data, and MAC).- Returns:
- The key block length that corresponds to bytes 1-4 of the key block.
-
getKeyUsage
The primary usage of the key contained in the key block.- Returns:
- The key usage that corresponds to bytes 5-6 of the key block.
-
getAlgorithm
The cryptographic algorithm with which the key contained in key block will be used.- Returns:
- The key algorithm that corresponds to byte 7 of the key block.
-
getModeOfUse
The operation that the key contained in the key block can perform.- Returns:
- The mode of use that corresponds to byte 8 of the key block.
-
getKeyVersion
Version number to optionally indicate that the contents of the key block is a component (key part), or to prevent re-injection of an old key.- Returns:
- The key version that corresponds to bytes 9-10 of the key block.
-
getExportability
The conditions under which the key can be exported outside the cryptographic domain.- Returns:
- The key exportability that corresponds to byte 11 of the key block.
-
getReserved
This element is not specified by TR-31 (should contain two ASCII zeros).In proprietary derivatives can be used as e.g: LMK identifier.
- Returns:
- The reserved that corresponds to bytes 14-15 of the key block.
-
getOptionalHeaders
The key blok Optional Header Blocks.The number of optional heders corresponds to bytes 12-13 of the key block.
The order of the elements in the map is preserved by
LinkedHashMap- Returns:
- Read only map of Optional Key Blok Heders.
-
getKeyBlockMAC
The key block MAC ensures the integrity of the key block.It is calculated over the Header, Optional Header Blocks and the encrypted Key Data. The length of the MAC depends on the type of LMK key:
- 4 bytes for DES Key Block LMK
- 8 bytes for AES Key Block LMK
- Returns:
- calculated key block MAC value.
-
dump
Dumps SecureKeyBlock basic information- Parameters:
p- a PrintStream usually supplied by Loggerindent- indention string, usually suppiled by Logger- See Also:
-