Algorithm parameter classes
Classes that implement the AlgorithmParameterSpec interface.
The CCAAlgorithmParameterSpec class
This class (which implements the AlgorithmParameterSpec
interface) specifies whether the AES, DES, or triple DES key to be generated or unwrapped is a
secret hardware key and whether it is stored in the CCA key storage area.
In the default case, an object of this class is created without specifying a key type, and this
object is passed to the init() method of an AESKeyGenerator, a
DESKeyGenerator, or a DESedeKeyGenerator. In this case, a
subsequent call to generateKey() returns a key object that contains the requested
key, which is encrypted by using the host primary key.
A CCAAlgorithmParameterSpec object can be used to specify the strength (size) of
the key to be generated.
A CCAAlgorithmParameterSpec object can be used to specify the type of CCA key
token wrapping to use for a DES or DESede key that is of type CKDS or SECURE_INTERNAL_TOKEN.
If the CCAAlgorithmParameterSpec object is used to generate a CKDS type key, the
CCAAlgorithmParameterSpec can be used to specify the desired label that is to be
used to store the key within the CCA key storage area. If a label is specified, it must be unique in
the CCA key storage area and must follow the CCA rules for labels. If no label is specifed for a new
CCA entry, the KeyGenerator generateKey() method creates one automatically.
A CCAAlgorithmParameterSpec object can also be used to explicitly specify the
type of key to be generated:
CCAAlgorithmParameterSpec.CKDScan be passed to theCCAAlgorithmParameterSpecconstructor, and the resulting object passed to theinit()method of anAESKeyGenerator, aDESKeyGenerator, or aDESedeKeyGenerator. In this case, a subsequent call togenerateKey()returns a key object that contains the CCA label of the key encrypted using the host primary key and stored in the system CCA key storage area.CCAAlgorithmParameterSpec.SECURE_INTERNAL_TOKENcan be passed to theCCAAlgorithmParameterSpecconstructor, and the resulting object passed to theinit()method of anAESKeyGenerator, aDESKeyGenerator, or aDESedeKeyGenerator. In this case, a subsequent call togenerateKey()returns a key object that contains the requested key, which is encrypted by using the host primary key. This key can also be generated by using aKeyGeneratorclass and passing aCCAAlgorithmParameterSpecobject, which was created without specifying a key type, to theKeyGenerator init()method.CCAAlgorithmParameterSpec.CLEARcan be passed to theCCAAlgorithmParameterSpecconstructor and the resulting object passed to theinit()method of anAESKeyGenerator, aDESKeyGenerator, or aDESedeKeyGenerator. In this case, a subsequent call togenerateKey()returns a key object that contains the clear key material for the requested key. This key can also be generated by using aKeyGeneratorclass without passing aCCAAlgorithmParameterSpecobject to theKeyGenerator init()method.
CCAAlgorithmParameterSpec has the following constructor
methods:public CCAAlgorithmParameterSpec()public CCAAlgorithmParameterSpec(int size)public CCAAlgorithmParameterSpec(byte hwType)public CCAAlgorithmParameterSpec(int size,byte hwType)public CCAAlgorithmParameterSpec(int size,byte hwType,String label)public CCAAlgorithmParameterSpec(byte hwType,String label)public CCAAlgorithmParameterSpec(int size, byte hwType, String label, byte wrappingMode)The following parameter restrictions apply to these constructor methods:
- The
sizeparameter must be valid for the specific algorithm of theKeyGeneratorto which thisCCAAlgorithmParameterSpecis passed. - The
hwTypeparameter must be one of the following constant values:CCAAlgorithmParameterSpec.CLEARCCAAlgorithmParameterSpec.SECURE_INTERNAL_TOKENCCAAlgorithmParameterSpec.CKDS
- The
labelparameter must be valid for the CCA component, according to the rules that are defined for ICSF on z/OS®. - The
wrappingModeparameter is used to specify the type of key wrapping that you want to use by CCA when you generate DES or DESede keys. Other key types, such as AES, do not honor the key wrapping mode value because they are always generated with the system default wrapping mode that is defined for ICSF on z/OS. Acceptable values for mode include ECB, CBC, and DEFAULT (the case is ignored for these values). When you use this flag, you receive an error under the following conditions:- When you generate a key that is not of type DES or DESede. Enhanced key wrapping is supported only for DES and DESede keys.
- If you did not specify ECB, CBC, or DEFAULT for the mode.
- If you specified the
-wrappingModeflag when you created a CLEAR key. The enhanced key wrapping mode is supported only when you generatie SECURE_INTERNAL_TOKEN and CKDS types of keys.
The CCAAlgorithmParameterSpec class has the following methods.
- Key size methods
-
These methods set or return the key size that is optionally specified to the
CCAAlgorithmParameterSpecconstructor method:public int getKeySize()public void setKeySize(int size)
- Key type methods
-
These methods set or return the key type that is optionally specified to the
CCAAlgorithmParameterSpecconstructor method:public byte getHwType()public void setHwType(byte hwTypeVal)
CCAAlgorithmParameterSpec.CLEARCCAAlgorithmParameterSpec.SECURE_INTERNAL_TOKENCCAAlgorithmParameterSpec.CKDS
- Storage label methods
-
These methods set or return the CCA key storage label that is optionally specified to the
CCAAlgorithmParameterSpecconstructor method. If you do not specify a CCA label, this label is set tonull:public String getLabel()public void setLabel(String label)
- Wrapping mode methods
-
These methods set or return the CCA token wrapping mode that is optionally specified to the
CCAAlgorithmParameterSpecconstructor method. If you do not specify a wrapping mode, this mode is set toDEFAULT:public byte getTokenWrappingMode()public void setTokenWrappingMode(byte wrappingMode)
It is not necessary to specify a CCAAlgorithmParameterSpec object to create a
key by using an AESKeyGenerator, DESKeyGenerator, or
DESedeKeyGenerator object. If no CCAAlgorithmParameterSpec object
is passed to the KeyGenerator init() method before the
generateKey() method is called, the key object that is returned contains the clear
key material for the requested key.
The KeyParameterSpec class for DSA hardware
(DSAHWKeyParameterSpec)
This class (which implements the AlgorithmParameterSpec interface) specifies the
set of parameters to use with the DSA hardware algorithm:
DSAKeyHWAttributesDue to hardware restrictions, these must be
KeyHWAttributeValues.PKDSandKeyHWAttributeValues.SIGNATURE.DSAParameterSpecThese are as follows:p: the primeq: the sub-primeg: the base
KeySizeThis parameter specifies the size of the key based on prime
p.KeyLabelThis parameter specifies the name that is used as a reference to the key that is stored in the hardware.
See the Java™ API documentation for the specific methods, default values and restrictions that are associated with this class.
The KeyParameterSpec class for RSA hardware
(RSAKeyParameterSpec)
This class (which implements the AlgorithmParameterSpec interface) specifies the
set of parameters to use with the RSA hardware algorithm:
-
RSAKeyHWAttributesThis parameter includes the following items:
RSAKeyHWAttributes.typeThis item must have one of the following values:KeyHWAttributeValues.PKDSKeyHWAttributeValues.CLEARKeyHWAttributeValues.RETAIN
RSAKeyHWAttributes.usageThis item must have one of the following values:KeyHWAttributeValues.SIGNATUREKeyHWAttributeValues.KEYMANAGEMENT
KeySizeThis parameter specifies the size of the key.
KeyLabelIf the
RSAKeyHWAttributes.typeis not specified asKeyHWAttributeValues.CLEAR, this parameter specifies the name that is used as a reference to the key that is stored in the CCA key storage area.
See the Java API documentation for the specific methods, default values and restrictions associated with this class.
The KeyParameterSpec class for EC hardware
(ECHWKeyParameterSpec)
This class (which implements the AlgorithmParameterSpec interface) specifies the
set of parameters to use with the EC hardware algorithm:
ECHWKeyAttributesThis parameter includes the following items:
ECHWKeyAttributes.typeThis item must have one of the following values:
KeyHWAttributeValues.PKDSKeyHWAttributeValues.CLEAR
ECHWKeyAttributes.usageThis item must have one of the following values:
KeyHWAttributeValues.SIGNATUREKeyHWAttributeValues.KEYMANAGEMENT
ECParameterSpecThis item consists of the following items:curve: the elliptic curveg: the generator, which is also known as the base pointn: the order of the generatorgh: the cofactor
StandardNameThis parameter specifies the standard name of the elliptic curve domain parameters.
KeySizeThis parameter specifies the size of the key.
KeyLabelIf the
ECHWKeyAttributes.typeis not specified asKeyHWAttributeValues.CLEAR, this parameter specifies the name that is used as a reference to the key that is stored in the CCA key storage area.
See the Java API documentation for the specific methods, default values, and restrictions associated with this class.