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.
82 lines
2.1 KiB
82 lines
2.1 KiB
8 months ago
|
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||
|
#pragma warning disable
|
||
|
using System;
|
||
|
using System.Globalization;
|
||
|
|
||
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC;
|
||
|
|
||
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
|
||
|
{
|
||
|
public class ECPublicKeyParameters
|
||
|
: ECKeyParameters
|
||
|
{
|
||
|
private readonly ECPoint q;
|
||
|
|
||
|
public ECPublicKeyParameters(
|
||
|
ECPoint q,
|
||
|
ECDomainParameters parameters)
|
||
|
: this("EC", q, parameters)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
public ECPublicKeyParameters(
|
||
|
ECPoint q,
|
||
|
DerObjectIdentifier publicKeyParamSet)
|
||
|
: base("ECGOST3410", false, publicKeyParamSet)
|
||
|
{
|
||
|
this.q = ECDomainParameters.ValidatePublicPoint(Parameters.Curve, q);
|
||
|
}
|
||
|
|
||
|
public ECPublicKeyParameters(
|
||
|
string algorithm,
|
||
|
ECPoint q,
|
||
|
ECDomainParameters parameters)
|
||
|
: base(algorithm, false, parameters)
|
||
|
{
|
||
|
this.q = ECDomainParameters.ValidatePublicPoint(Parameters.Curve, q);
|
||
|
}
|
||
|
|
||
|
public ECPublicKeyParameters(
|
||
|
string algorithm,
|
||
|
ECPoint q,
|
||
|
DerObjectIdentifier publicKeyParamSet)
|
||
|
: base(algorithm, false, publicKeyParamSet)
|
||
|
{
|
||
|
this.q = ECDomainParameters.ValidatePublicPoint(Parameters.Curve, q);
|
||
|
}
|
||
|
|
||
|
public ECPoint Q
|
||
|
{
|
||
|
get { return q; }
|
||
|
}
|
||
|
|
||
|
public override bool Equals(object obj)
|
||
|
{
|
||
|
if (obj == this)
|
||
|
return true;
|
||
|
|
||
|
ECPublicKeyParameters other = obj as ECPublicKeyParameters;
|
||
|
|
||
|
if (other == null)
|
||
|
return false;
|
||
|
|
||
|
return Equals(other);
|
||
|
}
|
||
|
|
||
|
protected bool Equals(
|
||
|
ECPublicKeyParameters other)
|
||
|
{
|
||
|
return q.Equals(other.q) && base.Equals(other);
|
||
|
}
|
||
|
|
||
|
public override int GetHashCode()
|
||
|
{
|
||
|
return q.GetHashCode() ^ base.GetHashCode();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
#pragma warning restore
|
||
|
#endif
|