public class SecureKeyBlock extends SecureKey
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.
Modifier and Type | Field and Description |
---|---|
protected Algorithm |
algorithm
The cryptographic algorithm with which the key contained in key block
will be used.
|
protected Exportability |
exportability
The conditions under which the key can be exported outside the
cryptographic domain.
|
protected int |
keyBlockLength
Entire key block length after encoding (header, optional header,
encrypted confidential data, and MAC).
|
protected byte[] |
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.
|
protected char |
keyBlockVersion
Identifies the method by which the key block is cryptographically
protected and the content layout of the block.
|
protected KeyUsage |
keyUsage
The primary usage of the key contained in the key block.
|
protected java.lang.String |
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.
|
protected ModeOfUse |
modeOfUse
The operation that the key contained in the key block can perform.
|
protected java.util.Map<java.lang.String,java.lang.String> |
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.
|
protected java.lang.String |
reserved
This element is not specified by TR-31 (should contain two ASCII zeros).
|
Modifier | Constructor and Description |
---|---|
protected |
SecureKeyBlock()
Constructs an SecureKeyBlock.
|
Modifier and Type | Method and Description |
---|---|
void |
dump(java.io.PrintStream p,
java.lang.String indent)
Dumps SecureKeyBlock basic information
|
Algorithm |
getAlgorithm()
The cryptographic algorithm with which the key contained in key block
will be used.
|
Exportability |
getExportability()
The conditions under which the key can be exported outside the
cryptographic domain.
|
int |
getKeyBlockLength()
Entire key block length after encoding (header, optional header,
encrypted confidential data, and MAC).
|
byte[] |
getKeyBlockMAC()
The key block MAC ensures the integrity of the key block.
|
char |
getKeyBlockVersion()
Identifies the method by which the key block is cryptographically
protected and the content layout of the block.
|
short |
getKeyLength() |
java.lang.String |
getKeyType()
Key Type is useful for stating what this key can be used for.
|
KeyUsage |
getKeyUsage()
The primary usage of the key contained in the key block.
|
java.lang.String |
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.
|
ModeOfUse |
getModeOfUse()
The operation that the key contained in the key block can perform.
|
java.util.Map<java.lang.String,java.lang.String> |
getOptionalHeaders()
The key blok Optional Header Blocks.
|
java.lang.String |
getReserved()
This element is not specified by TR-31 (should contain two ASCII zeros).
|
KeyScheme |
getScheme()
Gets the key scheme used to protect this key.
|
void |
setKeyLength(short keyLength)
Sets the length of the key (in bits) (when it was still clear).
|
void |
setKeyType(java.lang.String keyType)
Key Type is useful for stating what this key can be used for.
|
getKeyBytes, getKeyCheckValue, getKeyName, setKeyBytes, setKeyCheckValue, setKeyName, setScheme
protected char keyBlockVersion
protected int keyBlockLength
protected KeyUsage keyUsage
protected Algorithm algorithm
protected ModeOfUse modeOfUse
protected java.lang.String keyVersion
protected Exportability exportability
protected java.lang.String reserved
In proprietary derivatives can be used as e.g: LMK identifier.
protected java.util.Map<java.lang.String,java.lang.String> optionalHeaders
protected byte[] keyBlockMAC
protected SecureKeyBlock()
It can be used internally by e.g: SecureKeyBlockBuilder
.
public void setKeyType(java.lang.String keyType)
SecureKey
setKeyType
in class SecureKey
public java.lang.String getKeyType()
SecureKey
getKeyType
in class SecureKey
public void setKeyLength(short keyLength)
SecureKey
setKeyLength
in class SecureKey
public short getKeyLength()
getKeyLength
in class SecureKey
public KeyScheme getScheme()
SecureKey
public char getKeyBlockVersion()
public int getKeyBlockLength()
public KeyUsage getKeyUsage()
public Algorithm getAlgorithm()
public ModeOfUse getModeOfUse()
public java.lang.String getKeyVersion()
public Exportability getExportability()
public java.lang.String getReserved()
In proprietary derivatives can be used as e.g: LMK identifier.
public java.util.Map<java.lang.String,java.lang.String> getOptionalHeaders()
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
public byte[] getKeyBlockMAC()
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:
public void dump(java.io.PrintStream p, java.lang.String indent)
p
- a PrintStream usually supplied by Loggerindent
- indention string, usually suppiled by LoggerLoggeable