blob: c63c502050827daecab245bfda679d869a70531b (
plain) (
blame)
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
|
using System;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1.X9
{
public class DHValidationParms
: Asn1Encodable
{
private readonly DerBitString seed;
private readonly DerInteger pgenCounter;
public static DHValidationParms GetInstance(Asn1TaggedObject obj, bool isExplicit)
{
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
}
public static DHValidationParms GetInstance(object obj)
{
if (obj == null || obj is DHDomainParameters)
return (DHValidationParms)obj;
if (obj is Asn1Sequence)
return new DHValidationParms((Asn1Sequence)obj);
throw new ArgumentException("Invalid DHValidationParms: " + Platform.GetTypeName(obj), "obj");
}
public DHValidationParms(DerBitString seed, DerInteger pgenCounter)
{
if (seed == null)
throw new ArgumentNullException("seed");
if (pgenCounter == null)
throw new ArgumentNullException("pgenCounter");
this.seed = seed;
this.pgenCounter = pgenCounter;
}
private DHValidationParms(Asn1Sequence seq)
{
if (seq.Count != 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.seed = DerBitString.GetInstance(seq[0]);
this.pgenCounter = DerInteger.GetInstance(seq[1]);
}
public DerBitString Seed
{
get { return this.seed; }
}
public DerInteger PgenCounter
{
get { return this.pgenCounter; }
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(seed, pgenCounter);
}
}
}
|