You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
1.7 KiB
91 lines
1.7 KiB
1 year ago
|
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||
|
#pragma warning disable
|
||
|
using System;
|
||
|
|
||
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||
|
|
||
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
|
||
|
{
|
||
|
public class Gost3410Parameters
|
||
|
: ICipherParameters
|
||
|
{
|
||
|
private readonly BigInteger p, q, a;
|
||
|
private readonly Gost3410ValidationParameters validation;
|
||
|
|
||
|
public Gost3410Parameters(
|
||
|
BigInteger p,
|
||
|
BigInteger q,
|
||
|
BigInteger a)
|
||
|
: this(p, q, a, null)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public Gost3410Parameters(
|
||
|
BigInteger p,
|
||
|
BigInteger q,
|
||
|
BigInteger a,
|
||
|
Gost3410ValidationParameters validation)
|
||
|
{
|
||
|
if (p == null)
|
||
|
throw new ArgumentNullException("p");
|
||
|
if (q == null)
|
||
|
throw new ArgumentNullException("q");
|
||
|
if (a == null)
|
||
|
throw new ArgumentNullException("a");
|
||
|
|
||
|
this.p = p;
|
||
|
this.q = q;
|
||
|
this.a = a;
|
||
|
this.validation = validation;
|
||
|
}
|
||
|
|
||
|
public BigInteger P
|
||
|
{
|
||
|
get { return p; }
|
||
|
}
|
||
|
|
||
|
public BigInteger Q
|
||
|
{
|
||
|
get { return q; }
|
||
|
}
|
||
|
|
||
|
public BigInteger A
|
||
|
{
|
||
|
get { return a; }
|
||
|
}
|
||
|
|
||
|
public Gost3410ValidationParameters ValidationParameters
|
||
|
{
|
||
|
get { return validation; }
|
||
|
}
|
||
|
|
||
|
public override bool Equals(
|
||
|
object obj)
|
||
|
{
|
||
|
if (obj == this)
|
||
|
return true;
|
||
|
|
||
|
Gost3410Parameters other = obj as Gost3410Parameters;
|
||
|
|
||
|
if (other == null)
|
||
|
return false;
|
||
|
|
||
|
return Equals(other);
|
||
|
}
|
||
|
|
||
|
protected bool Equals(
|
||
|
Gost3410Parameters other)
|
||
|
{
|
||
|
return p.Equals(other.p) && q.Equals(other.q) && a.Equals(other.a);
|
||
|
}
|
||
|
|
||
|
public override int GetHashCode()
|
||
|
{
|
||
|
return p.GetHashCode() ^ q.GetHashCode() ^ a.GetHashCode();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
#pragma warning restore
|
||
|
#endif
|