001package org.apache.commons.ssl.org.bouncycastle.asn1.ocsp;
002
003import java.math.BigInteger;
004
005import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Enumerated;
006import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Object;
007import org.apache.commons.ssl.org.bouncycastle.asn1.ASN1Primitive;
008
009public class OCSPResponseStatus
010    extends ASN1Object
011{
012    public static final int SUCCESSFUL = 0;
013    public static final int MALFORMED_REQUEST = 1;
014    public static final int INTERNAL_ERROR = 2;
015    public static final int TRY_LATER = 3;
016    public static final int SIG_REQUIRED = 5;
017    public static final int UNAUTHORIZED = 6;
018
019    private ASN1Enumerated value;
020
021    /**
022     * The OCSPResponseStatus enumeration.
023     * <pre>
024     * OCSPResponseStatus ::= ENUMERATED {
025     *     successful            (0),  --Response has valid confirmations
026     *     malformedRequest      (1),  --Illegal confirmation request
027     *     internalError         (2),  --Internal error in issuer
028     *     tryLater              (3),  --Try again later
029     *                                 --(4) is not used
030     *     sigRequired           (5),  --Must sign the request
031     *     unauthorized          (6)   --Request unauthorized
032     * }
033     * </pre>
034     */
035    public OCSPResponseStatus(
036        int value)
037    {
038        this(new ASN1Enumerated(value));
039    }
040
041    private OCSPResponseStatus(
042        ASN1Enumerated value)
043    {
044        this.value = value;
045    }
046
047    public static OCSPResponseStatus getInstance(
048        Object  obj)
049    {
050        if (obj instanceof OCSPResponseStatus)
051        {
052            return (OCSPResponseStatus)obj;
053        }
054        else if (obj != null)
055        {
056            return new OCSPResponseStatus(ASN1Enumerated.getInstance(obj));
057        }
058
059        return null;
060    }
061
062    public BigInteger getValue()
063    {
064        return value.getValue();
065    }
066
067    public ASN1Primitive toASN1Primitive()
068    {
069        return value;
070    }
071}