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.
86 lines
2.3 KiB
86 lines
2.3 KiB
2 months ago
|
using System;
|
||
|
using System.Globalization;
|
||
|
|
||
|
using Org.BouncyCastle.Asn1;
|
||
|
using Org.BouncyCastle.Math.EC;
|
||
|
|
||
|
namespace Org.BouncyCastle.Crypto.Parameters
|
||
|
{
|
||
|
public class ECPublicKeyParameters
|
||
|
: ECKeyParameters
|
||
|
{
|
||
|
private readonly ECPoint q;
|
||
|
|
||
|
public ECPublicKeyParameters(
|
||
|
ECPoint q,
|
||
|
ECDomainParameters parameters)
|
||
|
#pragma warning disable CS0612 // ���ͻ���Ա�ѹ�ʱ
|
||
|
: this("EC", q, parameters)
|
||
|
#pragma warning restore CS0612 // ���ͻ���Ա�ѹ�ʱ
|
||
|
{
|
||
|
}
|
||
|
|
||
|
[Obsolete("Use version with explicit 'algorithm' parameter")]
|
||
|
public ECPublicKeyParameters(
|
||
|
ECPoint q,
|
||
|
DerObjectIdentifier publicKeyParamSet)
|
||
|
: base("ECGOST3410", false, publicKeyParamSet)
|
||
|
{
|
||
|
this.q = ECDomainParameters.ValidatePublicPoint(Parameters.Curve, q);
|
||
|
}
|
||
|
|
||
|
[Obsolete]
|
||
|
public ECPublicKeyParameters(
|
||
|
string algorithm,
|
||
|
ECPoint q,
|
||
|
ECDomainParameters parameters)
|
||
|
: base(algorithm, false, parameters)
|
||
|
{
|
||
|
this.q = ECDomainParameters.ValidatePublicPoint(Parameters.Curve, q);
|
||
|
}
|
||
|
|
||
|
[Obsolete]
|
||
|
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; }
|
||
|
}
|
||
|
|
||
|
[Obsolete]
|
||
|
#pragma warning disable CS0809 // ��ʱ��Ա��дδ��ʱ��Ա
|
||
|
public override bool Equals(object obj)
|
||
|
#pragma warning restore CS0809 // ��ʱ��Ա��дδ��ʱ��Ա
|
||
|
{
|
||
|
if (obj == this)
|
||
|
return true;
|
||
|
|
||
|
ECPublicKeyParameters other = obj as ECPublicKeyParameters;
|
||
|
|
||
|
if (other == null)
|
||
|
return false;
|
||
|
|
||
|
return Equals(other);
|
||
|
}
|
||
|
|
||
|
[Obsolete]
|
||
|
protected bool Equals(
|
||
|
ECPublicKeyParameters other)
|
||
|
{
|
||
|
return q.Equals(other.q) && base.Equals(other);
|
||
|
}
|
||
|
|
||
|
public override int GetHashCode()
|
||
|
{
|
||
|
return q.GetHashCode() ^ base.GetHashCode();
|
||
|
}
|
||
|
}
|
||
|
}
|