java.lang.Object
com.ibm.crypto.hdwrCCA.provider.RSAKeyParameterSpec
- All Implemented Interfaces:
AlgorithmParameterSpec
This class provides means for specifying the parameters for a RSA key pair
to be generated via the RSAKeyPairGenerator class. These parameters are type,
which is either KeyHWAttrubuteValues.PKDS, KeyHWAttributeValues.RETAIN, or
KeyHWAttributeValues.CLEAR; usage which is either KeyHWAttributeValues.SIGNATURE, or
KeyHWAttributeValues.KEYMANAGEMENT; keysize, the modulus size in
bits and keylabel which is the label associated with the generated private
key. This class is immutable.
-
Constructor Summary
ConstructorsConstructorDescriptionRSAKeyParameterSpec
(int strength, byte type) Constructs a parameter set.RSAKeyParameterSpec
(int strength, byte type, byte usage) Constructs a parameter set.RSAKeyParameterSpec
(int strength, byte type, byte usage, byte[] label) Deprecated.RSAKeyParameterSpec
(int strength, byte type, byte usage, String label) Constructs a parameter set. -
Method Summary
Modifier and TypeMethodDescriptionReturns the key pair attributes.int
Returns the key size.Returns the key label that will be used to store the private key.byte[]
getToken()
Deprecated.This method is being replaced by the methodgetLabelString()
-
Constructor Details
-
RSAKeyParameterSpec
Constructs a parameter set. The keyToken is to be randomly generated and key usage is defaulted to KeyHWAttributeValues.KEYMANAGEMENT.- Parameters:
strength
- the length (in bits) of the key to be generated.type
- the hardware key type determined from KeyHWAttributeValues PKDS (key storage), RETAIN (retain in the PCI crypto card) or CLEAR.- Throws:
IllegalArgumentException
- for any parameter values outside the bounds for that parameter.
-
RSAKeyParameterSpec
Constructs a parameter set. The keyToken is to be randomly generated.- Parameters:
strength
- the length (in bits) of the key to be generated.type
- the hardware key type determined from KeyHWAttributeValues PKDS (key storage), RETAIN (retain in the PCI crypto card) or CLEAR.usage
- the way that the key will be used, must be either SIGNATURE (use for signing purposes only) or KEYMANAGMENT(use for both management of keys and signing purposes).- Throws:
IllegalArgumentException
- for any parameter values outside the bounds for that parameter.
-
RSAKeyParameterSpec
public RSAKeyParameterSpec(int strength, byte type, byte usage, String label) throws IllegalArgumentException Constructs a parameter set.- Parameters:
strength
- the length (in bits) of the keytype
- the hardware key type, must beKeyHWAttributeValues.PKDS
(key storage),KeyHWAttributeValues.RETAIN
(retain in the PCI crypto card), orKeyHWAttributeValues.CLEAR
usage
- the way that the key will be used, must be eitherKeyHWAttributeValues.SIGNATURE
(use for signing purposes only) orKeyHWAttributeValues.KEYMANAGEMENT
(use for both management of keys and signing purposes)label
- if aKeyHWAttributeValues.PKDS
key, the label used to identify the key, this value can be null to indicate a random label. If aKeyHWAttributeValues.CLEAR
key, label is ignored- Throws:
IllegalArgumentException
- for any parameter values outside the bounds for that parameter.
-
RSAKeyParameterSpec
@Deprecated public RSAKeyParameterSpec(int strength, byte type, byte usage, byte[] label) throws IllegalArgumentException Deprecated.It is recommended that the caller make use of the methodRSAKeyParameterSpec(int, byte, byte, String)
instead to construct this parameter spec using PKDS labels.Constructs a parameter set.- Parameters:
strength
- the length (in bits) of the keytype
- the hardware key type, must beKeyHWAttributeValues.PKDS
(key storage),KeyHWAttributeValues.RETAIN
(retain in the PCI crypto card), orKeyHWAttributeValues.CLEAR
usage
- the way that the key will be used, must be eitherKeyHWAttributeValues.SIGNATURE
(use for signing purposes only) orKeyHWAttributeValues.KEYMANAGEMENT
(use for both management of keys and signing purposes)label
- if aKeyHWAttributeValues.PKDS
key, the label used to identify the key, this value can be null to indicate a random label. If aKeyHWAttributeValues.CLEAR
key, label is ignored. The label must conform to the character restrictions imposed by the platform you are executing on. In addition, the byte array representing the label must be encoded using the "8859_1" code page. For example, if the label is "MyLabel", then the correct form for this parameter is "MyLabel".getBytes(StandardCharsets.ISO_8859_1)- Throws:
IllegalArgumentException
- for any parameter values outside the bounds for that parameter.- See Also:
-
-
Method Details
-
getAttributes
Returns the key pair attributes.- Returns:
- the key pair attributes.
-
getKeySize
public int getKeySize()Returns the key size.- Returns:
- the key size.
-
getToken
Deprecated.This method is being replaced by the methodgetLabelString()
If a key label was specified when this RSAKeyParameterSpec was created, this method returns the key token which is the label that will be used to identify the key when generated. If the label was not specified, when this RSAKeyParameterSpec was created, it will be created when the key is generated and will not be available in this RSAKeyParameterSpec. The key token (label) is not relevant for keys of type CLEAR.- Returns:
- the key label, or null if no label was specified to the constructor of this RSAKeyParameterSpec.
-
getLabelString
Returns the key label that will be used to store the private key.- Returns:
- the key label. Returns null if no label is associated with this parameter spec.
-
RSAKeyParameterSpec(int, byte, byte, String)
instead to construct this parameter spec using PKDS labels.