blob: 6f3b4c8c3222f8eeb68faa246c478e89e4bbc6c8 (
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
|
using System;
using Org.BouncyCastle.Asn1;
namespace Org.BouncyCastle.Asn1.Pkcs
{
public class AuthenticatedSafe
: Asn1Encodable
{
private static ContentInfo[] Copy(ContentInfo[] info)
{
return (ContentInfo[])info.Clone();
}
public static AuthenticatedSafe GetInstance(object obj)
{
if (obj is AuthenticatedSafe)
return (AuthenticatedSafe)obj;
if (obj == null)
return null;
return new AuthenticatedSafe(Asn1Sequence.GetInstance(obj));
}
private readonly ContentInfo[] info;
private readonly bool isBer;
private AuthenticatedSafe(Asn1Sequence seq)
{
info = new ContentInfo[seq.Count];
for (int i = 0; i != info.Length; i++)
{
info[i] = ContentInfo.GetInstance(seq[i]);
}
isBer = seq is BerSequence;
}
public AuthenticatedSafe(
ContentInfo[] info)
{
this.info = Copy(info);
this.isBer = true;
}
public ContentInfo[] GetContentInfo()
{
return Copy(info);
}
public override Asn1Object ToAsn1Object()
{
if (isBer)
{
return new BerSequence(info);
}
// TODO bc-java uses DL sequence
//return new DLSequence(info);
return new DerSequence(info);
}
}
}
|