info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(CryptoProObjectIdentifiers.gostR3410_2001, params.getDERObject()), new DEROctetString(encKey));
}
else
{
X962Parameters params = null;
if (ecSpec instanceof ECNamedCurveParameterSpec)
{
DERObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveParameterSpec)ecSpec).getName());
params = new X962Parameters(curveOid);
}
else if (ecSpec == null)
{
params = new X962Parameters(DERNull.INSTANCE);
}
else
{
ECParameterSpec p = (ECParameterSpec)ecSpec;
ECCurve curve = p.getG().getCurve();
ECPoint generator;
if (curve instanceof ECCurve.Fp)
{
generator = new ECPoint.Fp(p.getG().getCurve(), p.getG().getX(), p.getG().getY(), withCompression);
}
else if (curve instanceof ECCurve.F2m)
{
generator = new ECPoint.F2m(p.getG().getCurve(), p.getG().getX(), p.getG().getY(), withCompression);
}
else
{
throw new UnsupportedOperationException("Subclass of ECPoint " + curve.getClass().toString() + "not supported");
}
X9ECParameters ecP = new X9ECParameters(
p.getCurve(), generator, p.getN(), p.getH(), p.getSeed());
params = new X962Parameters(ecP);
}
ECCurve curve = this.engineGetQ().getCurve();
ASN1OctetString p;
if (curve instanceof ECCurve.Fp)
{
p = (ASN1OctetString)(new X9ECPoint(new ECPoint.Fp(curve, this.getQ().getX(), this.getQ().getY(), withCompression)).getDERObject());
}
else if (curve instanceof ECCurve.F2m)
{
p = (ASN1OctetString)(new X9ECPoint(new ECPoint.F2m(curve, this.getQ().getX(), this.getQ().getY(), withCompression)).getDERObject());
}
else
{
throw new UnsupportedOperationException("Subclass of ECPoint " + curve.getClass().toString() + "not supported");
}
info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_ecPublicKey, params.getDERObject()), p.getOctets());
}
return info.getDEREncoded();
}