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.
85 lines
2.3 KiB
85 lines
2.3 KiB
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();
|
|
}
|
|
}
|
|
}
|
|
|