blob: 5e1be82287bb69181e218ce646e056f3f248d4da (
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
|
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
namespace Org.BouncyCastle.Asn1
{
internal class LazyDLEnumerator
: IEnumerator<Asn1Encodable>
{
private readonly byte[] m_contents;
private Asn1InputStream m_input;
private Asn1Object m_current;
internal LazyDLEnumerator(byte[] contents)
{
this.m_contents = contents;
Reset();
}
object IEnumerator.Current
{
get { return Current; }
}
public Asn1Encodable Current
{
get
{
if (null == m_current)
throw new InvalidOperationException();
return m_current;
}
}
public virtual void Dispose()
{
}
public bool MoveNext()
{
return null != (this.m_current = ReadObject());
}
public void Reset()
{
this.m_input = new LazyAsn1InputStream(m_contents);
this.m_current = null;
}
private Asn1Object ReadObject()
{
try
{
return m_input.ReadObject();
}
catch (IOException e)
{
throw new Asn1ParsingException("malformed ASN.1: " + e.Message, e);
}
}
}
}
|