ECGost3410ParamSetParameters
using Org.BouncyCastle.Math;
using System;
namespace Org.BouncyCastle.Asn1.CryptoPro
{
public class ECGost3410ParamSetParameters : Asn1Encodable
{
private readonly DerInteger m_a;
private readonly DerInteger m_b;
private readonly DerInteger m_p;
private readonly DerInteger m_q;
private readonly DerInteger m_x;
private readonly DerInteger m_y;
public BigInteger A => m_a.PositiveValue;
public BigInteger B => m_b.PositiveValue;
public BigInteger P => m_p.PositiveValue;
public BigInteger Q => m_q.PositiveValue;
private int X => m_x.IntPositiveValueExact;
public BigInteger Y => m_y.PositiveValue;
public static ECGost3410ParamSetParameters GetInstance(object obj)
{
if (obj == null)
return null;
ECGost3410ParamSetParameters eCGost3410ParamSetParameters = obj as ECGost3410ParamSetParameters;
if (eCGost3410ParamSetParameters != null)
return eCGost3410ParamSetParameters;
return new ECGost3410ParamSetParameters(Asn1Sequence.GetInstance(obj));
}
public static ECGost3410ParamSetParameters GetInstance(Asn1TaggedObject obj, bool explicitly)
{
return new ECGost3410ParamSetParameters(Asn1Sequence.GetInstance(obj, explicitly));
}
public static ECGost3410ParamSetParameters GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return new ECGost3410ParamSetParameters(Asn1Sequence.GetTagged(taggedObject, declaredExplicit));
}
[Obsolete("Use 'GetInstance' instead")]
public ECGost3410ParamSetParameters(Asn1Sequence seq)
{
int count = seq.Count;
if (count != 6)
throw new ArgumentException("Bad sequence size: " + count.ToString(), "seq");
m_a = DerInteger.GetInstance(seq[0]);
m_b = DerInteger.GetInstance(seq[1]);
m_p = DerInteger.GetInstance(seq[2]);
m_q = DerInteger.GetInstance(seq[3]);
m_x = DerInteger.GetInstance(seq[4]);
m_y = DerInteger.GetInstance(seq[5]);
}
public ECGost3410ParamSetParameters(BigInteger a, BigInteger b, BigInteger p, BigInteger q, int x, BigInteger y)
{
m_a = new DerInteger(a);
m_b = new DerInteger(b);
m_p = new DerInteger(p);
m_q = new DerInteger(q);
m_x = new DerInteger(x);
m_y = new DerInteger(y);
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(m_a, m_b, m_p, m_q, m_x, m_y);
}
}
}