Class CCAAlgorithmParameterSpec
- All Implemented Interfaces:
AlgorithmParameterSpec
DESedeKeyGenerator,
DESKeyGenerator, and AESKeyGenerator classes.
This class can also be used with the RSA cipher class for specifying parameters associated with how a secret key is to be unwrapped.
If the key type is SECURE_INTERNAL_TOKEN, then only the key token is
returned from the hardware and resident in memory.
If the key type is CKDS, after the SECURE_INTERNAL_TOKEN key
is passed to the hardware, only the CKDS entry label is
resident in memory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteA key that is encrypted by the ICSF host master key and stored in the CKDS.static final byteA clear key.static final byteA key that is encrypted by the ICSF host master key, sometimes called a secure hardware key, and saved as a key token.static final byteThis value represents the encryption wrapping mode to be used while wrapping the key value.static final byteThis value represents the encryption wrapping mode to be used while wrapping the key value.static final byteThis value represents the encryption wrapping mode to be used while wrapping the key value. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a parameter set for a DES, DESede, or AES key.CCAAlgorithmParameterSpec(byte hwType) Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key.CCAAlgorithmParameterSpec(byte hwType, String label) Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key.CCAAlgorithmParameterSpec(int size) Constructs a parameter set with the desired key size for a DES, DESede, or AES key.CCAAlgorithmParameterSpec(int size, byte hwType) Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key.CCAAlgorithmParameterSpec(int size, byte hwType, String label) Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key.CCAAlgorithmParameterSpec(int size, byte hwType, String label, byte wrappingMode) Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key. -
Method Summary
Modifier and TypeMethodDescriptionbyteReturns the type of key to be generated.Returns the specified key encrypting key.intGet the desired key size.Returns the user specified hardware key usage attributes.getLabel()Returns a CKDS label.booleanReturns the NoCvKEK attribute.Returns OAEP padding parameters.byteReturns the type of key token wrapping to be used.Returns a user-specified block of optional data blocks suitable to be included when a TR-31 KeyBlock is created to export a key.protected booleanChecks to see if this CCAAlgorithmParameterSpec is a SECURE_INTERNAL_TOKEN type.voidsetHwType(byte hwTypeVal) Sets the type of key to be generated.voidsetKey2KeyEncryptingKey(SecretKey key2KeyEncryptingKey) Sets the key encrypting key that will be used to wrap the second key of a generated key pair.voidsetKeySize(int size) Set the desired key size for the key to be generated.voidsetKeyUsage(SymmetricKeyConstants.KeyUsage keyUsage) Sets hardware key usage attributes.voidSets the label for aCKDStype hardware key.voidsetNoCvKEK(boolean NoCvKEK) Specifies whether the CKDS Key Encrypting Key should be created with the NoCvKEK option.voidsetOAEPParameterSpec(OAEPParameterSpec oaepSpec) Sets the OAEP padding parameters.voidsetTokenWrappingMode(byte wrappingMode) Sets the type of key token wrapping mode to be used.voidSpecifies an optional data block to be included when a TR-31 KeyBlock is created to export a key.voidsetTR31OptionalDataBlocks(TR31OptionalDataBlock[] OptData) Specifies an array of optional data blocks to be included when a TR-31 KeyBlock is created to export a key.
-
Field Details
-
CKDS
public static final byte CKDSA key that is encrypted by the ICSF host master key and stored in the CKDS. The key is wrapped by the ICSF master key using the default key wrapping modes as set within ICSF.- See Also:
-
CLEAR
public static final byte CLEARA clear key.- See Also:
-
SECURE_INTERNAL_TOKEN
public static final byte SECURE_INTERNAL_TOKENA key that is encrypted by the ICSF host master key, sometimes called a secure hardware key, and saved as a key token. This is the default type. The key is wrapped by the ICSF master key using the default key wrapping modes as set within ICSF.- See Also:
-
WRAPPING_MODE_DEFAULT
public static final byte WRAPPING_MODE_DEFAULTThis value represents the encryption wrapping mode to be used while wrapping the key value. This mode will be used by ICSF to wrap the ICSF token with the ICSF master key. In this case the default mode as set by ICSF will be used. This setting is relevant to keys that are being generated or unwrapped asCKDSorSECURE_INTERNAL_TOKENkeys.- See Also:
-
WRAPPING_MODE_ECB
public static final byte WRAPPING_MODE_ECBThis value represents the encryption wrapping mode to be used while wrapping the key value. This mode will be used by ICSF to wrap the ICSF token with the ICSF master key. In this case the EBC mode will be used. This setting is relevant to keys that are being generated or unwrapped asCKDSorSECURE_INTERNAL_TOKENkeys.- See Also:
-
WRAPPING_MODE_CBC
public static final byte WRAPPING_MODE_CBCThis value represents the encryption wrapping mode to be used while wrapping the key value. This mode will be used by ICSF to wrap the ICSF token with the ICSF master key. In this case the CBC mode will be used. ICSF currently refers to the CBC mode as enhanced key wrapping mode. This setting is relevant to keys that are being generated or unwrapped asCKDSorSECURE_INTERNAL_TOKENkeys.- See Also:
-
-
Constructor Details
-
CCAAlgorithmParameterSpec
public CCAAlgorithmParameterSpec()Constructs a parameter set for a DES, DESede, or AES key. Key type will default toSECURE_INTERNAL_TOKENusing the default wrapping modeWRAPPING_MODE_DEFAULTas set by ICSF. -
CCAAlgorithmParameterSpec
public CCAAlgorithmParameterSpec(int size) Constructs a parameter set with the desired key size for a DES, DESede, or AES key. Key type will default toSECURE_INTERNAL_TOKENusing the default wrapping modeWRAPPING_MODE_DEFAULTas set by ICSF.- Parameters:
size- the size or strength of the requested key, a key size of 0 indicates that the default key size of the key generator or cipher is to be used
-
CCAAlgorithmParameterSpec
public CCAAlgorithmParameterSpec(byte hwType) Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key.- Parameters:
hwType- the type of key to be generated. This must be one ofCLEAR,SECURE_INTERNAL_TOKEN, orCKDS. If thehwTypeisCKDSand a CKDS label is not explicitly specified, a CKDS label will be generated automatically- Throws:
InvalidParameterException- ifhwTypeis not valid.
-
CCAAlgorithmParameterSpec
public CCAAlgorithmParameterSpec(int size, byte hwType) Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key.- Parameters:
size- the size or strength of the requested key, a key size of 0 indicates that the default key size of the key generator or cipher is to be usedhwType- the type of key to be generated. This must be one ofCLEAR,SECURE_INTERNAL_TOKEN, orCKDS. If thehwTypeisCKDSand a CKDS label is not explicitly specified, a CKDS label will be generated automatically- Throws:
InvalidParameterException- ifhwTypeis not valid.
-
CCAAlgorithmParameterSpec
Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key.- Parameters:
size- the size or strength of the requested key, a key size of 0 indicates that the default key size of the key generator or cipher is to be usedhwType- the type of key to be generated. This must be one ofCLEAR,SECURE_INTERNAL_TOKEN, orCKDSlabel- ifhwTypeisCKDS, this label will be used to identify the CKDS entry created to store the key. Otherwise, this label is ignored. This label must not be longer than 64 characters and cannot include embedded spaces. If null is specified, a label will be generated automatically ifhwTypeisCKDS- Throws:
InvalidParameterException- ifhwTypeis not valid or iflabelis longer than 64 characters.
-
CCAAlgorithmParameterSpec
Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key.- Parameters:
hwType- the type of key to be generated. This must be one ofCLEAR,SECURE_INTERNAL_TOKEN, orCKDSlabel- ifhwTypeisCKDS, this label will be used to identify the CKDS entry created to store the key. Otherwise, this label is ignored. This label must not be longer than 64 characters and cannot include embedded spaces. If null is specified, a label will be generated automatically ifhwTypeisCKDS- Throws:
InvalidParameterException- ifhwTypeis not valid or iflabelis longer than 64 characters.
-
CCAAlgorithmParameterSpec
Constructs a parameter set for specifying the characteristics of the desired DES, DESede, or AES key.- Parameters:
size- the size or strength of the requested key, a key size of 0 indicates that the default key size of the key generator or cipher is to be usedhwType- the type of key to be generated. This must be one ofCLEAR,SECURE_INTERNAL_TOKEN, orCKDSlabel- ifhwTypeisCKDS, this label will be used to identify the CKDS entry created to store the key. Otherwise, this label is ignored. This label must not be longer than 64 characters and cannot include embedded spaces. If null is specified, a label will be generated automatically ifhwTypeisCKDSwrappingMode- the wrapping mode to be used by ICSF. This value will only be used when the key type is set toSECURE_INTERNAL_TOKENorCKDS. If the key type isCLEAR, this value is ignored. ThewrappingModemust be one ofWRAPPING_MODE_DEFAULT,WRAPPING_MODE_CBC, orWRAPPING_MODE_ECB- Throws:
InvalidParameterException- ifhwTypeis not valid,labelis longer than 64 characters, orwrappingModeis not valid.
-
-
Method Details
-
getKeySize
public int getKeySize()Get the desired key size.- Returns:
- the desired key size.
-
setKeySize
public void setKeySize(int size) Set the desired key size for the key to be generated.- Parameters:
size- the desired key size, a key size of 0 indicates that the default key size of the key generator or cipher is to be used
-
getHwType
public byte getHwType()Returns the type of key to be generated.- Returns:
- the type of key to be generated, must be one of
CLEAR,SECURE_INTERNAL_TOKEN, orCKDS.
-
setHwType
public void setHwType(byte hwTypeVal) Sets the type of key to be generated.- Parameters:
hwTypeVal- the type of key to be generated, this must be one ofCLEAR,SECURE_INTERNAL_TOKEN, orCKDS- Throws:
InvalidParameterException- if the suppliedhwTypeValis not supported.
-
getLabel
Returns a CKDS label.- Returns:
- the user specified CKDS entry label. If no label was specified, then null will be returned.
-
setLabel
Sets the label for aCKDStype hardware key.- Parameters:
label- if the key to be generated is a CKDS key, then this label will be used to identify the CKDS entry associated with the key. Otherwise, this label will be ignored. This label must not be longer than 64 characters and must not include embedded spaces.- Throws:
InvalidParameterException- iflabelis longer than 64 characters in length.
-
getTokenWrappingMode
public byte getTokenWrappingMode()Returns the type of key token wrapping to be used. Key token wrapping applies only forSECURE_INTERNAL_TOKENandCKDShardware key types.- Returns:
- the key token wrapping mode to be used, one of
WRAPPING_MODE_DEFAULT,WRAPPING_MODE_CBC, orWRAPPING_MODE_ECB.
-
setTokenWrappingMode
Sets the type of key token wrapping mode to be used. Key token wrapping occurs only forSECURE_INTERNAL_TOKENandCKDShardware key types.- Parameters:
wrappingMode- the wrapping mode to be used, this must be one ofWRAPPING_MODE_DEFAULT,WRAPPING_MODE_CBC, orWRAPPING_MODE_ECB- Throws:
InvalidParameterException- if thewrappingModeis not supported.
-
setOAEPParameterSpec
Sets the OAEP padding parameters.- Parameters:
oaepSpec- the OAEP padding parameters
-
getOAEPParameterSpec
Returns OAEP padding parameters.- Returns:
- the OAEP padding parameters if previously set, otherwise returns null.
-
setNoCvKEK
public void setNoCvKEK(boolean NoCvKEK) Specifies whether the CKDS Key Encrypting Key should be created with the NoCvKEK option. This is usually true only when the KEK will be used to export keys to non-z/OS systems, as in a TR-31 Key Block.The default value is false.
The NoCvKEK attribute is only allowed when generating a KEK in the CKDS or importing a KEK to the CKDS.
- Parameters:
NoCvKEK- the requested key usage NoCvKEK attribute
-
getNoCvKEK
public boolean getNoCvKEK()Returns the NoCvKEK attribute.- Returns:
- the NoCvKEK attribute.
-
setTR31OptionalDataBlocks
Specifies an array of optional data blocks to be included when a TR-31 KeyBlock is created to export a key. Optional data blocks are used to specify key attributes not included in the formal Tr-31 KeyBlock header but required by the platform where the KeyBlock will be unwrapped.The tr31OptionalDataBlocks attribute is ignored if not creating a TR-31 KeyBlock.
This method follows a replace model. After this method is called, the CCAAlgorithmParameterSpec will contain only the TR31OptionalDataBlocks specified in this method call.
This method copies the data passed to it into local storage so it will be unaffected by changes the caller makes after the call.
- Parameters:
OptData- An array of TR31OptionalDataBlock objects to be included in a TR-31 KeyBlock.
-
setTR31OptionalDataBlock
Specifies an optional data block to be included when a TR-31 KeyBlock is created to export a key. Optional data blocks are used to specify key attributes not included in the formal Tr-31 KeyBlock header but required by the platform where the KeyBlock will be unwrapped.The tr31OptionalDataBlocks attribute is ignored if not creating a TR-31 KeyBlock.
This method follows a replace model. After this method is called, the CCAAlgorithmParameterSpec will contain exactly one TR31OptionalDataBlock.
This method copies the data passed to it into local storage so it will be unaffected by changes the caller makes after the call.
- Parameters:
OptData- A TR31OptionalDataBlock object to be included in a TR-31 KeyBlock.
-
getTR31OptionalDataBlocks
Returns a user-specified block of optional data blocks suitable to be included when a TR-31 KeyBlock is created to export a key. Optional data blocks are used to specify key attributes not included in the formal Tr-31 KeyBlock header but required by the platform where the KeyBlock will be unwrapped.- Returns:
- user-specified block of optional data blocks suitable to be included when a TR-31 KeyBlock is created.
-
setKeyUsage
Sets hardware key usage attributes. This may be a single operational DATA key, or something more complex, like a pair of key encrypting keys.The default key usage attribute for hardware DES, Triple-DES, and AES key generation is
SymmetricKeyConstants.KeyUsage.OP_DATA. Valid key usage attribute for DES key generation isSymmetricKeyConstants.KeyUsage.OP_DATA. Valid key usage attributes for Triple-DES and AES key generation areSymmetricKeyConstants.KeyUsage.OP_DATA,SymmetricKeyConstants.KeyUsage.OPEX_EXPORTER_IMPORTER, andSymmetricKeyConstants.KeyUsage.OPEX_IMPORTER_EXPORTER.Hardware key usage attribute is ignored if generating
CLEARkeys.- Parameters:
keyUsage- the requested key usage attribute, null may be specified to indicate the default key usage attribute
-
getKeyUsage
Returns the user specified hardware key usage attributes.- Returns:
- the user specified hardware key usage attributes, or null if not previously set.
-
setKey2KeyEncryptingKey
Sets the key encrypting key that will be used to wrap the second key of a generated key pair.- Parameters:
key2KeyEncryptingKey- key encrypting key that will be used to wrap the second key of a generated key pair, has no effect if not generating a key pair- Throws:
InvalidParameterException- ifkey2KeyEncryptingKeyis not an instance ofDESedeKeyorAESKey, or if the key type isCLEAR.
-
getKey2KeyEncryptingKey
Returns the specified key encrypting key.- Returns:
- the specified key encrypting key, or null if no such key was specified.
-
isSecureInternalToken
protected boolean isSecureInternalToken()Checks to see if this CCAAlgorithmParameterSpec is a SECURE_INTERNAL_TOKEN type.- Returns:
- true if hwType is SECURE_INTERNAL_TOKEN.
-