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
|
using System;
using Org.BouncyCastle.Asn1.Cms;
namespace Org.BouncyCastle.Asn1.Crmf
{
public class PopoPrivKey
: Asn1Encodable, IAsn1Choice
{
public const int thisMessage = 0;
public const int subsequentMessage = 1;
public const int dhMAC = 2;
public const int agreeMAC = 3;
public const int encryptedKey = 4;
private readonly int tagNo;
private readonly Asn1Encodable obj;
private PopoPrivKey(Asn1TaggedObject obj)
{
this.tagNo = obj.TagNo;
switch (tagNo)
{
case thisMessage:
this.obj = DerBitString.GetInstance(obj, false);
break;
case subsequentMessage:
this.obj = SubsequentMessage.ValueOf(DerInteger.GetInstance(obj, false).IntValueExact);
break;
case dhMAC:
this.obj = DerBitString.GetInstance(obj, false);
break;
case agreeMAC:
this.obj = PKMacValue.GetInstance(obj, false);
break;
case encryptedKey:
this.obj = EnvelopedData.GetInstance(obj, false);
break;
default:
throw new ArgumentException("unknown tag in PopoPrivKey", "obj");
}
}
public static PopoPrivKey GetInstance(Asn1TaggedObject tagged, bool isExplicit)
{
return new PopoPrivKey(Asn1TaggedObject.GetInstance(tagged.GetObject()));
}
public PopoPrivKey(SubsequentMessage msg)
{
this.tagNo = subsequentMessage;
this.obj = msg;
}
public virtual int Type
{
get { return tagNo; }
}
public virtual Asn1Encodable Value
{
get { return obj; }
}
/**
* <pre>
* PopoPrivKey ::= CHOICE {
* thisMessage [0] BIT STRING, -- Deprecated
* -- possession is proven in this message (which contains the private
* -- key itself (encrypted for the CA))
* subsequentMessage [1] SubsequentMessage,
* -- possession will be proven in a subsequent message
* dhMAC [2] BIT STRING, -- Deprecated
* agreeMAC [3] PKMACValue,
* encryptedKey [4] EnvelopedData }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
return new DerTaggedObject(false, tagNo, obj);
}
}
}
|