Code example for DSAParameterSpec

Methods: getP

0
  { 
    if (! (spec instanceof DSAParameterSpec))
      throw new InvalidAlgorithmParameterException("Wrong AlgorithmParameterSpec type: "
                                                   + spec.getClass().getName());
    DSAParameterSpec dsaSpec = (DSAParameterSpec) spec;
    BigInteger p = dsaSpec.getP();
    int size = p.bitLength();
    this.engineInit(size, random);
  } 
 
  protected AlgorithmParameters engineGenerateParameters()
  { 
    if (modulusLength < 1)
      modulusLength = DSSKeyPairGenerator.DEFAULT_MODULUS_LENGTH;
 
    fips = new FIPS186(modulusLength, rnd);
    BigInteger[] params = fips.generateParameters();
    BigInteger p = params[3];
    BigInteger q = params[2];
    BigInteger g = params[5];
    DSAParameterSpec spec = new DSAParameterSpec(p, q, g);