blob: 8dded7c054d390dc47b7af298c15263fe1550bf1 (
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
|
using System;
using System.Collections;
using Org.BouncyCastle.Utilities;
using Org.BouncyCastle.Utilities.Collections;
namespace Org.BouncyCastle.Bcpg.OpenPgp
{
/// <remarks>A holder for a list of PGP encryption method packets.</remarks>
public class PgpEncryptedDataList
: PgpObject
{
private IList list = Platform.CreateArrayList();
private InputStreamPacket data;
public PgpEncryptedDataList(
BcpgInputStream bcpgInput)
{
while (bcpgInput.NextPacketTag() == PacketTag.PublicKeyEncryptedSession
|| bcpgInput.NextPacketTag() == PacketTag.SymmetricKeyEncryptedSessionKey)
{
list.Add(bcpgInput.ReadPacket());
}
data = (InputStreamPacket)bcpgInput.ReadPacket();
for (int i = 0; i != list.Count; i++)
{
if (list[i] is SymmetricKeyEncSessionPacket)
{
list[i] = new PgpPbeEncryptedData((SymmetricKeyEncSessionPacket) list[i], data);
}
else
{
list[i] = new PgpPublicKeyEncryptedData((PublicKeyEncSessionPacket) list[i], data);
}
}
}
public PgpEncryptedData this[int index]
{
get { return (PgpEncryptedData) list[index]; }
}
[Obsolete("Use 'object[index]' syntax instead")]
public object Get(int index)
{
return this[index];
}
[Obsolete("Use 'Count' property instead")]
public int Size
{
get { return list.Count; }
}
public int Count
{
get { return list.Count; }
}
public bool IsEmpty
{
get { return list.Count == 0; }
}
public IEnumerable GetEncryptedDataObjects()
{
return new EnumerableProxy(list);
}
}
}
|