ASN1ObjectIdentifier id = info.getAlgorithm().getAlgorithm();
// we need the PKCS check to handle older keys marked with the X9 oid.
if (id.equals(PKCSObjectIdentifiers.dhKeyAgreement) || isPKCSParam(seq))
{
DHParameter params = DHParameter.getInstance(seq);
if (params.getL() != null)
{
this.dhSpec = new DHParameterSpec(params.getP(), params.getG(), params.getL().intValue());
}
else
{
this.dhSpec = new DHParameterSpec(params.getP(), params.getG());
}
}
else if (id.equals(X9ObjectIdentifiers.dhpublicnumber))
{
DHDomainParameters params = DHDomainParameters.getInstance(seq);
this.dhSpec = new DHParameterSpec(params.getP().getValue(), params.getG().getValue());
}
else
{
throw new IllegalArgumentException("unknown algorithm type: " + id);
}