blob: f7c5298a7a5502f5853df7234523e4c48cb07e80 (
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
|
using System;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1.Cms
{
public class TimeStampTokenEvidence
: Asn1Encodable
{
public static TimeStampTokenEvidence GetInstance(object obj)
{
if (obj == null)
return null;
if (obj is TimeStampTokenEvidence timeStampTokenEvidence)
return timeStampTokenEvidence;
return new TimeStampTokenEvidence(Asn1Sequence.GetInstance(obj));
}
public static TimeStampTokenEvidence GetInstance(Asn1TaggedObject tagged, bool isExplicit)
{
return new TimeStampTokenEvidence(Asn1Sequence.GetInstance(tagged, isExplicit));
}
private readonly TimeStampAndCrl[] m_timeStampAndCrls;
public TimeStampTokenEvidence(TimeStampAndCrl[] timeStampAndCrls)
{
if (Arrays.IsNullOrContainsNull(timeStampAndCrls))
throw new NullReferenceException("'timeStampAndCrls' cannot be null, or contain null");
m_timeStampAndCrls = timeStampAndCrls;
}
public TimeStampTokenEvidence(TimeStampAndCrl timeStampAndCrl)
{
m_timeStampAndCrls = new []{ timeStampAndCrl ?? throw new ArgumentNullException(nameof(timeStampAndCrl)) };
}
private TimeStampTokenEvidence(Asn1Sequence seq)
{
m_timeStampAndCrls = seq.MapElements(TimeStampAndCrl.GetInstance);
}
public virtual TimeStampAndCrl[] ToTimeStampAndCrlArray() => (TimeStampAndCrl[])m_timeStampAndCrls.Clone();
/**
* <pre>
* TimeStampTokenEvidence ::=
* SEQUENCE SIZE(1..MAX) OF TimeStampAndCrl
* </pre>
* @return
*/
public override Asn1Object ToAsn1Object() => new DerSequence(m_timeStampAndCrls);
}
}
|