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.
60 lines
1.1 KiB
60 lines
1.1 KiB
2 months ago
|
using System;
|
||
|
|
||
|
using Org.BouncyCastle.Utilities;
|
||
|
|
||
|
namespace Org.BouncyCastle.Crypto.Parameters
|
||
|
{
|
||
|
public class ElGamalKeyParameters
|
||
|
: AsymmetricKeyParameter
|
||
|
{
|
||
|
private readonly ElGamalParameters parameters;
|
||
|
|
||
|
protected ElGamalKeyParameters(
|
||
|
bool isPrivate,
|
||
|
ElGamalParameters parameters)
|
||
|
: base(isPrivate)
|
||
|
{
|
||
|
// TODO Should we allow 'parameters' to be null?
|
||
|
this.parameters = parameters;
|
||
|
}
|
||
|
|
||
|
public ElGamalParameters Parameters
|
||
|
{
|
||
|
get { return parameters; }
|
||
|
}
|
||
|
|
||
|
public override bool Equals(
|
||
|
object obj)
|
||
|
{
|
||
|
if (obj == this)
|
||
|
return true;
|
||
|
|
||
|
ElGamalKeyParameters other = obj as ElGamalKeyParameters;
|
||
|
|
||
|
if (other == null)
|
||
|
return false;
|
||
|
|
||
|
return Equals(other);
|
||
|
}
|
||
|
|
||
|
protected bool Equals(
|
||
|
ElGamalKeyParameters other)
|
||
|
{
|
||
|
return Platform.Equals(parameters, other.parameters)
|
||
|
&& base.Equals(other);
|
||
|
}
|
||
|
|
||
|
public override int GetHashCode()
|
||
|
{
|
||
|
int hc = base.GetHashCode();
|
||
|
|
||
|
if (parameters != null)
|
||
|
{
|
||
|
hc ^= parameters.GetHashCode();
|
||
|
}
|
||
|
|
||
|
return hc;
|
||
|
}
|
||
|
}
|
||
|
}
|