k.getPrimeExponentP(), k.getPrimeExponentQ(),
k.getCrtCoefficient());
}
else if (spec.isAssignableFrom(DHPrivateKeySpec.class) && key instanceof DHPrivateKey)
{
DHPrivateKey k = (DHPrivateKey)key;
return new DHPrivateKeySpec(k.getX(), k.getParams().getP(), k.getParams().getG());
}
else if (spec.isAssignableFrom(DHPublicKeySpec.class) && key instanceof DHPublicKey)
{
DHPublicKey k = (DHPublicKey)key;
return new DHPublicKeySpec(k.getY(), k.getParams().getP(), k.getParams().getG());
}
throw new RuntimeException("not implemented yet " + key + " " + spec);
}