Class 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 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.
    • 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 method getLabelString()
        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.