blob: 6f1969c2a70c028a74eaa457341931e7fcca9999 (
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
|
using System;
using System.IO;
namespace Org.BouncyCastle.Bcpg
{
/// <summary>Basic type for a trust packet.</summary>
public class TrustPacket
: ContainedPacket
{
private readonly byte[] levelAndTrustAmount;
public TrustPacket(
BcpgInputStream bcpgIn)
{
MemoryStream bOut = new MemoryStream();
int ch;
while ((ch = bcpgIn.ReadByte()) >= 0)
{
bOut.WriteByte((byte) ch);
}
levelAndTrustAmount = bOut.ToArray();
}
public TrustPacket(
int trustCode)
{
this.levelAndTrustAmount = new byte[]{ (byte) trustCode };
}
public byte[] GetLevelAndTrustAmount()
{
return (byte[]) levelAndTrustAmount.Clone();
}
public override void Encode(
BcpgOutputStream bcpgOut)
{
bcpgOut.WritePacket(PacketTag.Trust, levelAndTrustAmount, true);
}
}
}
|