ret = new RSAKeyGenParameterSpec(getKeyLength(pk), rpk.getPublicExponent());
} else if (pk instanceof DSAPublicKey) {
log.debug("getKeyGenSpec: DSA");
final DSAPublicKey dpk = (DSAPublicKey)pk;
final DSAParams params = dpk.getParams();
ret = new DSAParameterSpec(params.getP(), params.getQ(), params.getG());
} else if (pk instanceof ECPublicKey) {
log.debug("getKeyGenSpec: ECPublicKey");
final ECPublicKey ecpub = (ECPublicKey) pk;
final java.security.spec.ECParameterSpec sunsp = ecpub.getParams();
final EllipticCurve ecurve = new EllipticCurve(sunsp.getCurve().getField(), sunsp.getCurve().getA(), sunsp.getCurve().getB());