{
  public void setup(Map attributes)  {    // find out the modulus length    Integer l = (Integer) attributes.get(MODULUS_LENGTH);    L = (l == null ? DEFAULT_MODULUS_LENGTH : l.intValue());    if ((L % 64) != 0 || L < 512 || L > 1024)      throw new IllegalArgumentException(MODULUS_LENGTH);    // should we use the default pre-computed params?    Boolean useDefaults = (Boolean) attributes.get(USE_DEFAULTS);    if (useDefaults == null)      {        useDefaults = Boolean.TRUE;      }    Boolean strictDefaults = (Boolean) attributes.get(STRICT_DEFAULTS);    if (strictDefaults == null)      strictDefaults = Boolean.FALSE;    // are we given a set of DSA params or we shall use/generate our own?    DSAParameterSpec params = (DSAParameterSpec) attributes.get(DSS_PARAMETERS);    if (params != null)      {        p = params.getP();        q = params.getQ();        g = params.getG();      }    else if (useDefaults.equals(Boolean.TRUE))      {        switch (L)          {          case 512:            p = KEY_PARAMS_512.getP();            q = KEY_PARAMS_512.getQ();            g = KEY_PARAMS_512.getG();            break;          case 768:            p = KEY_PARAMS_768.getP();            q = KEY_PARAMS_768.getQ();            g = KEY_PARAMS_768.getG();            break;          case 1024:            p = KEY_PARAMS_1024.getP();            q = KEY_PARAMS_1024.getQ();            g = KEY_PARAMS_1024.getG();            break;          default:            if (strictDefaults.equals(Boolean.TRUE))              throw new IllegalArgumentException(                  "Does not provide default parameters for " + L                  + "-bit modulus length");            else              {            p = null;            q = null;            g = null;          }      }      }    else      {        p = null;        q = null;        g = null;      }    // do we have a SecureRandom, or should we use our own?    rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS);    // what is the preferred encoding format    Integer formatID = (Integer) attributes.get(PREFERRED_ENCODING_FORMAT);    preferredFormat = formatID == null        ? DEFAULT_ENCODING_FORMAT        : formatID.intValue();    // set the seed-key    byte[] kb = new byte[20]; // we need 160 bits of randomness    nextRandomBytes(kb);    XKEY = new BigInteger(1, kb).setBit(159).setBit(0);  }