blob: dc99c6a9a25eecf599d858d72039479e1966e202 (
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
using System;
using System.IO;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.Ocsp;
namespace Org.BouncyCastle.Ocsp
{
public class OcspResp
{
private OcspResponse resp;
public OcspResp(
OcspResponse resp)
{
this.resp = resp;
}
public OcspResp(
byte[] resp)
: this(new Asn1InputStream(resp))
{
}
public OcspResp(
Stream inStr)
: this(new Asn1InputStream(inStr))
{
}
private OcspResp(
Asn1InputStream aIn)
{
try
{
this.resp = OcspResponse.GetInstance(aIn.ReadObject());
}
catch (Exception e)
{
throw new IOException("malformed response: " + e.Message, e);
}
}
public int Status
{
get { return this.resp.ResponseStatus.Value.IntValue; }
}
public object GetResponseObject()
{
ResponseBytes rb = this.resp.ResponseBytes;
if (rb == null)
return null;
if (rb.ResponseType.Equals(OcspObjectIdentifiers.PkixOcspBasic))
{
try
{
return new BasicOcspResp(
BasicOcspResponse.GetInstance(
Asn1Object.FromByteArray(rb.Response.GetOctets())));
}
catch (Exception e)
{
throw new OcspException("problem decoding object: " + e, e);
}
}
return rb.Response;
}
/**
* return the ASN.1 encoded representation of this object.
*/
public byte[] GetEncoded()
{
return resp.GetEncoded();
}
public override bool Equals(
object obj)
{
if (obj == this)
return true;
OcspResp other = obj as OcspResp;
if (other == null)
return false;
return resp.Equals(other.resp);
}
public override int GetHashCode()
{
return resp.GetHashCode();
}
}
}
|