1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
using System;
using Org.BouncyCastle.Math;
using Org.BouncyCastle.Math.EC;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Crypto.Parameters
{
public class ECDomainParameters
{
internal ECCurve curve;
internal byte[] seed;
internal ECPoint g;
internal BigInteger n;
internal BigInteger h;
public ECDomainParameters(
ECCurve curve,
ECPoint g,
BigInteger n)
: this(curve, g, n, BigInteger.One)
{
}
public ECDomainParameters(
ECCurve curve,
ECPoint g,
BigInteger n,
BigInteger h)
: this(curve, g, n, h, null)
{
}
public ECDomainParameters(
ECCurve curve,
ECPoint g,
BigInteger n,
BigInteger h,
byte[] seed)
{
if (curve == null)
throw new ArgumentNullException("curve");
if (g == null)
throw new ArgumentNullException("g");
if (n == null)
throw new ArgumentNullException("n");
if (h == null)
throw new ArgumentNullException("h");
this.curve = curve;
this.g = g;
this.n = n;
this.h = h;
this.seed = Arrays.Clone(seed);
}
public ECCurve Curve
{
get { return curve; }
}
public ECPoint G
{
get { return g; }
}
public BigInteger N
{
get { return n; }
}
public BigInteger H
{
get { return h; }
}
public byte[] GetSeed()
{
return Arrays.Clone(seed);
}
public override bool Equals(
object obj)
{
if (obj == this)
return true;
ECDomainParameters other = obj as ECDomainParameters;
if (other == null)
return false;
return Equals(other);
}
protected bool Equals(
ECDomainParameters other)
{
return curve.Equals(other.curve)
&& g.Equals(other.g)
&& n.Equals(other.n)
&& h.Equals(other.h)
&& Arrays.AreEqual(seed, other.seed);
}
public override int GetHashCode()
{
return curve.GetHashCode()
^ g.GetHashCode()
^ n.GetHashCode()
^ h.GetHashCode()
^ Arrays.GetHashCode(seed);
}
}
}
|