blob: c1819a5ee63eff2feff6f08d9b1f8c6ffda07062 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
namespace Org.BouncyCastle.Asn1.X9
{
/**
* ANS.1 def for Diffie-Hellman key exchange OtherInfo structure. See
* RFC 2631, or X9.42, for further details.
*/
public class OtherInfo
: Asn1Encodable
{
private KeySpecificInfo keyInfo;
private Asn1OctetString partyAInfo;
private Asn1OctetString suppPubInfo;
public OtherInfo(
KeySpecificInfo keyInfo,
Asn1OctetString partyAInfo,
Asn1OctetString suppPubInfo)
{
this.keyInfo = keyInfo;
this.partyAInfo = partyAInfo;
this.suppPubInfo = suppPubInfo;
}
public OtherInfo(Asn1Sequence seq)
{
var e = seq.GetEnumerator();
e.MoveNext();
keyInfo = new KeySpecificInfo((Asn1Sequence)e.Current);
while (e.MoveNext())
{
Asn1TaggedObject o = (Asn1TaggedObject)e.Current;
if (o.TagNo == 0)
{
partyAInfo = (Asn1OctetString)o.GetObject();
}
else if ((int) o.TagNo == 2)
{
suppPubInfo = (Asn1OctetString)o.GetObject();
}
}
}
public KeySpecificInfo KeyInfo
{
get { return keyInfo; }
}
public Asn1OctetString PartyAInfo
{
get { return partyAInfo; }
}
public Asn1OctetString SuppPubInfo
{
get { return suppPubInfo; }
}
/**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* OtherInfo ::= Sequence {
* keyInfo KeySpecificInfo,
* partyAInfo [0] OCTET STRING OPTIONAL,
* suppPubInfo [2] OCTET STRING
* }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(keyInfo);
v.AddOptionalTagged(true, 0, partyAInfo);
v.Add(new DerTaggedObject(2, suppPubInfo));
return new DerSequence(v);
}
}
}
|