1package org.bouncycastle.asn1.ocsp;
2
3import java.math.BigInteger;
4
5import org.bouncycastle.asn1.ASN1Enumerated;
6import org.bouncycastle.asn1.ASN1Object;
7import org.bouncycastle.asn1.ASN1Primitive;
8
9public class OCSPResponseStatus
10    extends ASN1Object
11{
12    public static final int SUCCESSFUL = 0;
13    public static final int MALFORMED_REQUEST = 1;
14    public static final int INTERNAL_ERROR = 2;
15    public static final int TRY_LATER = 3;
16    public static final int SIG_REQUIRED = 5;
17    public static final int UNAUTHORIZED = 6;
18
19    private ASN1Enumerated value;
20
21    /**
22     * The OCSPResponseStatus enumeration.
23     * <pre>
24     * OCSPResponseStatus ::= ENUMERATED {
25     *     successful            (0),  --Response has valid confirmations
26     *     malformedRequest      (1),  --Illegal confirmation request
27     *     internalError         (2),  --Internal error in issuer
28     *     tryLater              (3),  --Try again later
29     *                                 --(4) is not used
30     *     sigRequired           (5),  --Must sign the request
31     *     unauthorized          (6)   --Request unauthorized
32     * }
33     * </pre>
34     */
35    public OCSPResponseStatus(
36        int value)
37    {
38        this(new ASN1Enumerated(value));
39    }
40
41    private OCSPResponseStatus(
42        ASN1Enumerated value)
43    {
44        this.value = value;
45    }
46
47    public static OCSPResponseStatus getInstance(
48        Object  obj)
49    {
50        if (obj instanceof OCSPResponseStatus)
51        {
52            return (OCSPResponseStatus)obj;
53        }
54        else if (obj != null)
55        {
56            return new OCSPResponseStatus(ASN1Enumerated.getInstance(obj));
57        }
58
59        return null;
60    }
61
62    public BigInteger getValue()
63    {
64        return value.getValue();
65    }
66
67    public ASN1Primitive toASN1Primitive()
68    {
69        return value;
70    }
71}
72