- java.lang.Object
-
- com.ibm.crypto.hdwrCCA.provider.RSAKeyParameterSpec
-
- All Implemented Interfaces:
java.security.spec.AlgorithmParameterSpec
public class RSAKeyParameterSpec extends java.lang.Object implements java.security.spec.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
Constructors Constructor Description RSAKeyParameterSpec(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.It is recommended that the caller make use of the methodRSAKeyParameterSpec(int, byte, byte, String)
instead to construct this parameter spec using PKDS labels.RSAKeyParameterSpec(int strength, byte type, byte usage, java.lang.String label)
Constructs a parameter set.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RSAKeyHWAttributes
getAttributes()
Returns the key pair attributes.int
getKeySize()
Returns the key size.java.lang.String
getLabelString()
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 Detail
-
RSAKeyParameterSpec
public RSAKeyParameterSpec(int strength, byte type) throws java.lang.IllegalArgumentException
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:
java.lang.IllegalArgumentException
- for any parameter values outside the bounds for that parameter.
-
RSAKeyParameterSpec
public RSAKeyParameterSpec(int strength, byte type, byte usage) throws java.lang.IllegalArgumentException
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:
java.lang.IllegalArgumentException
- for any parameter values outside the bounds for that parameter.
-
RSAKeyParameterSpec
public RSAKeyParameterSpec(int strength, byte type, byte usage, java.lang.String label) throws java.lang.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:
java.lang.IllegalArgumentException
- for any parameter values outside the bounds for that parameter.
-
RSAKeyParameterSpec
@Deprecated public RSAKeyParameterSpec(int strength, byte type, byte usage, byte[] label) throws java.lang.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:
java.lang.IllegalArgumentException
- for any parameter values outside the bounds for that parameter.- See Also:
RSAKeyParameterSpec(int, byte, byte, String) is preferred over using this constructor.
-
-
Method Detail
-
getAttributes
public RSAKeyHWAttributes 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 public byte[] 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
public java.lang.String 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.
-
-