java.lang.Object
com.ibm.crypto.hdwrCCA.provider.TR31KeyBlock
A TR-31 KeyBlock is a byte[] structure. This class is provided to
allow applications to extract non-key data from a TR-31 KeyBlock.
This class cannot be used to create a TR-31 KeyBlock. It is used only
to extract and display non-key data from an existing TR-31 KeyBlock.
This class never returns the key bytes. All other data in the
TR-31 KeyBlock can be obtained using the getter APIs or by calling the
toString() method.
-
Constructor Summary
ConstructorsConstructorDescriptionTR31KeyBlock
(byte[] TR31_KeyBlockBytes) Constructor Note that this method has a long path length because multiple native APIs are called to extract the data from the specified TR-31 Key Block. -
Method Summary
Modifier and TypeMethodDescriptionReturns the key algorithm field in the ANSI TR-31 KeyBlock as a string.Returns the key algorithm field in the ANSI TR-31 KeyBlock as an expanded string.int
Returns the contents of the KeyBlock length field in the ANSI TR-31 Key block.Returns the contents of the KeyBlockVersion field in the ANSI TR-31 Key block.Returns the key exportability field in the ANSI TR-31 KeyBlock as a string.Returns the key exportability field in the ANSI TR-31 KeyBlock as an expanded string.Returns the key mode field in the ANSI TR-31 KeyBlock as a string.Returns the key mode field in the ANSI TR-31 KeyBlock as an expanded string.Returns the key usage field in the ANSI TR-31 KeyBlock as a String.Returns the key usage field in the ANSI TR-31 KeyBlock as an expanded String.Returns the key version field in the ANSI TR-31 KeyBlock as a string.int
Returns the count of optional data blocks contained in the ANSI TR-31 KeyBlock.Returns the contents of the optional data blocks in the ANSI TR-31 Key block.toString()
Returns a formatted string displaying the non-key data contents of the ANSI TR-31 Key block.
-
Constructor Details
-
TR31KeyBlock
public TR31KeyBlock(byte[] TR31_KeyBlockBytes) Constructor Note that this method has a long path length because multiple native APIs are called to extract the data from the specified TR-31 Key Block.- Parameters:
TR31_KeyBlockBytes
- the ANSI TR-31 Key Block from which non-key information will be queried.- Throws:
InvalidParameterException
- if theTR31_KeyBlock
is null.JCECCARuntimeException
- if theTR31_KeyBlock
is not a valid ANSI TR-31 Key Block.
-
-
Method Details
-
getKeyBlockVersion
Returns the contents of the KeyBlockVersion field in the ANSI TR-31 Key block. This is a one-byte character.- Returns:
- the contents of the KeyBlockVersion field in the ANSI TR-31 Key Block.
-
getKeyBlockLength
public int getKeyBlockLength()Returns the contents of the KeyBlock length field in the ANSI TR-31 Key block.- Returns:
- the contents of the KeyBlockLength field in the ANSI TR-31 Key Block.
-
getKeyUsage
Returns the key usage field in the ANSI TR-31 KeyBlock as a String.- Returns:
- key usage as a String. This wil be one of
the following:
- D0 DataEncryptionKey
- K0 KeyEcryptingKey
- other UnrecognizedKeyUsage
-
getKeyUsageAsString
Returns the key usage field in the ANSI TR-31 KeyBlock as an expanded String.- Returns:
- key usage as a String. This will be one of
the following:
- DataEncryptionKey
- KeyEcryptingKey
- UnrecognizedKeyUsage
-
getKeyAlgorithm
Returns the key algorithm field in the ANSI TR-31 KeyBlock as a string.- Returns:
- the key algorithm as a String. This will be one of
the following:
- D Single-DES
- T Triple-DES
- other UnsupportedAlgorithm
-
getKeyAlgorithmAsString
Returns the key algorithm field in the ANSI TR-31 KeyBlock as an expanded string.- Returns:
- the key algorithm as a String. This will be one of
the following:
- Single-DES
- Triple-DES
- UnsupportedAlgorithm
-
getKeyMode
Returns the key mode field in the ANSI TR-31 KeyBlock as a string.- Returns:
- key mode as a String. This will be one of
the following:
- B EncryptDecrypt
- E Exporter
- D Importer
- other UnrecognizedKeyMode
-
getKeyModeAsString
Returns the key mode field in the ANSI TR-31 KeyBlock as an expanded string.- Returns:
- key mode as a String. This will be one of
the following:
- EncryptDecrypt
- Exporter
- Importer
- UnrecognizedKeyMode
-
getKeyVersion
Returns the key version field in the ANSI TR-31 KeyBlock as a string.- Returns:
- key mode as a String. This will be one of A, B, or C
-
getKeyExportability
Returns the key exportability field in the ANSI TR-31 KeyBlock as a string.- Returns:
- key exportability. This is a one byte string indicating
whether the key can be exported from this system and, if so,
it specifies conditions under which export is permitted.
This will be one of the following:
- "N" Not exportable
- "E" Exportable under trusted key
- "S" Exportable under any key
-
getKeyExportabilityAsString
Returns the key exportability field in the ANSI TR-31 KeyBlock as an expanded string.- Returns:
- key exportability as a String. This is a one byte
string indicating whether the key can be exported from this
system and, if so, it specifies conditions under which export
is permitted. This will be one of the following:
- Not exportable
- Exportable under trusted key
- Exportable under any key
-
getNumOptDataBlocks
public int getNumOptDataBlocks()Returns the count of optional data blocks contained in the ANSI TR-31 KeyBlock.- Returns:
- the count of optional data blocks contained in the ANSI TR-31 Key Block.
-
getOptDataBlocks
Returns the contents of the optional data blocks in the ANSI TR-31 Key block.- Returns:
- the contents of the optional data blocks in the ANSI TR-31 Key Block in an array of TR31OptionalDataBlock objects. If there are no optional data blocks in the ANSI TR-31 Key Block, an empty array is returned.
-
toString
Returns a formatted string displaying the non-key data contents of the ANSI TR-31 Key block. Note that this method may have long path length because, if the TR-31 Key Block has optional data blocks and they have not yet been retrieved, then multiple native APIs are are called to extract them from the TR-31 Key Block.
-