Class DSAHWKeyParameterSpec

java.lang.Object
com.ibm.crypto.hdwrCCA.provider.DSAHWKeyParameterSpec
All Implemented Interfaces:
AlgorithmParameterSpec

public class DSAHWKeyParameterSpec extends Object implements AlgorithmParameterSpec
This class provides a means for specifying the attributes of a DSA key pair that is to be generated. The attributes include the key size, the label that the private key is to be stored under, and the DSAParameterSpec. This class is immutable.
  • Constructor Details

    • DSAHWKeyParameterSpec

      public DSAHWKeyParameterSpec(int strength, byte type) throws InvalidParameterException, IllegalArgumentException
      Constructs a parameter set based on the parameters specified. In this case, the key label is randomly generated and no DSAParameterSpec will be specified for key generation.
      Parameters:
      strength - the length (in bits) of the key to be generated
      type - the hardware key type, from KeyHWAttributeValues the value PKDS (key storage) is the only accepted one for this parameter.
      Throws:
      InvalidParameterException - is thrown when the strength parameter is not valid.
      IllegalArgumentException - is thrown when the type parameter is not KeyHWAttributeValues.PKDS.
    • DSAHWKeyParameterSpec

      public DSAHWKeyParameterSpec(int strength, String label) throws InvalidParameterException, IllegalArgumentException
      Constructs a parameter set based on the parameters specified. In this case, no DSAParameterSpec will be specified for key generation.
      Parameters:
      strength - the length (in bits) of the key to be generated.
      label - the PKDS label used to specify the keys when generated.
      Throws:
      InvalidParameterException - is thrown when the strength parameter is not valid.
      IllegalArgumentException - is thrown when the label parameter is longer than 64 bytes.
    • DSAHWKeyParameterSpec

      @Deprecated public DSAHWKeyParameterSpec(int strength, byte type, byte[] label) throws InvalidParameterException, IllegalArgumentException
      Deprecated.
      this method is deprecated, it is recommended that the caller make use of the method DSAHWKeyParameterSpec(int,String) instead to construct this "KeySpec" using CKDS labels.
      Constructs a parameter set based on the parameters specified. In this case, no DSAParameterSpec will be specified for key generation.
      Parameters:
      strength - the length (in bits) of the key to be generated.
      type - the hardware key type, from KeyHWAttributeValues the value PKDS (key storage) is the only accepted one for this parameter.
      label - the label used to specify the keys when generated. The label must be conform to the character restrictions imposed by the platform you are executing on. In addition, when passed to this method as a byte array, it 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("8859_1")
      Throws:
      InvalidParameterException - is thrown when the strength parameter is not valid.
      IllegalArgumentException - is thrown when the type parameter is not KeyHWAttributeValues.PKDS or the label parameter is longer than 64 bytes.
    • DSAHWKeyParameterSpec

      public DSAHWKeyParameterSpec(BigInteger p, BigInteger q, BigInteger g, String label) throws IllegalArgumentException
      Constructs a parameter set based on the parameters specified.
      Parameters:
      p - the prime P of the DSAParameterSpec.
      q - the sub-prime Q of the DSAParameterSpec.
      g - the base G of the DSAParameterSpec.
      label - the label used to specify the keys when generated.
      Throws:
      IllegalArgumentException - is thrown when the label parameter is longer than 64 characters.
    • DSAHWKeyParameterSpec

      @Deprecated public DSAHWKeyParameterSpec(BigInteger p, BigInteger q, BigInteger g, byte type, byte[] label) throws IllegalArgumentException
      Deprecated.
      this method is deprecated, it is recommended that the caller make use of the method DSAHWKeyParameterSpec(BigInteger,BigInteger,BigInteger,String) instead to construct this "KeySpec" using CKDS labels.
      Constructs a parameter set based on the parameters specified.
      Parameters:
      p - the prime P of the DSAParameterSpec.
      q - the sub-prime Q of the DSAParameterSpec.
      g - the base G of the DSAParameterSpec.
      type - the hardware key type, from KeyHWAttributeValues the value PKDS (key storage) is the only accepted one for this parameter.
      label - the label used to specify the keys when generated. The label must be conform to the character restrictions imposed by the platform you are executing on. In addition, when passed to this method as a byte array, it 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("8859_1")
      Throws:
      IllegalArgumentException - is thrown when the type parameter is not KeyHWAttributeValues.PKDS or the label parameter is longer than 64 bytes.
    • DSAHWKeyParameterSpec

      public DSAHWKeyParameterSpec(BigInteger p, BigInteger q, BigInteger g, byte type) throws IllegalArgumentException
      Constructs a parameter set based on the parameters specified. The key label will be randomly generated for the key pair.
      Parameters:
      p - the prime P of the DSAParameterSpec.
      q - the sub-prime Q of the DSAParameterSpec.
      g - the base G of the DSAParameterSpec.
      type - the hardware key type, from KeyHWAttributeValues the value PKDS (key storage) is the only accepted one for this parameter.
      Throws:
      IllegalArgumentException - is thrown when the type parameter is not KeyHWAttributeValues.PKDS.
    • DSAHWKeyParameterSpec

      @Deprecated public DSAHWKeyParameterSpec(BigInteger p, BigInteger q, BigInteger g, byte[] label) throws IllegalArgumentException
      Deprecated.
      this method is deprecated, it is recommended that the caller make use of the method DSAHWKeyParameterSpec(BigInteger,BigInteger,BigInteger,String) instead to construct this "KeySpec" using CKDS labels.
      Constructs a parameter set based on the parameters specified.
      Parameters:
      p - the prime P of the DSAParameterSpec.
      q - the sub-prime Q of the DSAParameterSpec.
      g - the base G of the DSAParameterSpec.
      label - the label used to specify the keys when generated. The label must be conform to the character restrictions imposed by the platform you are executing on. In addition, when passed to this method as a byte array, it 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("8859_1")
      Throws:
      IllegalArgumentException - is thrown when the label parameter is longer than 64 bytes.
    • DSAHWKeyParameterSpec

      public DSAHWKeyParameterSpec(BigInteger p, BigInteger q, BigInteger g) throws IllegalArgumentException
      Constructs a parameter set based on the parameters specified. The key label will be randomly generated.
      Parameters:
      p - the prime P of the DSAParameterSpec.
      q - the sub-prime Q of the DSAParameterSpec.
      g - the base G of the DSAParameterSpec.
      Throws:
      IllegalArgumentException
    • DSAHWKeyParameterSpec

      public DSAHWKeyParameterSpec(DSAParameterSpec params, String label) throws IllegalArgumentException
      Constructs a parameter set based on the parameters specified.
      Parameters:
      params - the DSAParameterSpec used to create the keys.
      label - the label used to specify the keys when generated.
      Throws:
      IllegalArgumentException - is thrown when the label parameter is longer than 64 bytes.
    • DSAHWKeyParameterSpec

      @Deprecated public DSAHWKeyParameterSpec(DSAParameterSpec params, byte type, byte[] label) throws IllegalArgumentException
      Deprecated.
      this method is deprecated, it is recommended that the caller make use of the method DSAHWKeyParameterSpec(DSAParameterSpec,String) instead to construct this "KeySpec" using CKDS labels.
      Constructs a parameter set based on the parameters specified.
      Parameters:
      params - the DSAParameterSpec used to create the keys.
      type - the hardware key type, from KeyHWAttributeValues the value PKDS (key storage) is the only accepted one for this parameter.
      label - the label used to specify the keys when generated. The label must be conform to the character restrictions imposed by the platform you are executing on. In addition, when passed to this method as a byte array, it 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("8859_1")
      Throws:
      IllegalArgumentException - is thrown when the type parameter is not KeyHWAttributeValues.PKDS or the label parameter is longer than 64 bytes.
  • Method Details

    • getAttributes

      public DSAKeyHWAttributes getAttributes()
      Returns the key pair attributes
      Returns:
      the key pair attributes.
    • getKeySize

      public int getKeySize()
      Returns the key size in bits.
      Returns:
      the key size.
    • getDSAParamSpec

      public DSAParameterSpec getDSAParamSpec()
      Returns the DSAParameterSpec associated with this object.
      Returns:
      the DSA Parameter Spec.
    • getLabelString

      public 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.