summaryrefslogtreecommitdiff
path: root/repackaged_platform/bcprov/src/main/java/com/android/internal/org/bouncycastle/its/asn1/EndEntityType.java
blob: dac4a9e52581e464bc4296e2f6d90024613ea688 (plain)
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
/* GENERATED SOURCE. DO NOT MODIFY. */
package com.android.internal.org.bouncycastle.its.asn1;

import com.android.internal.org.bouncycastle.asn1.ASN1BitString;
import com.android.internal.org.bouncycastle.asn1.ASN1Object;
import com.android.internal.org.bouncycastle.asn1.ASN1Primitive;
import com.android.internal.org.bouncycastle.asn1.DERBitString;

/**
 * <pre>
 *     EndEntityType ::= BIT STRING { app(0), enrol(1) } (SIZE (8)) (ALL EXCEPT ())
 * </pre>
 * @hide This class is not part of the Android public SDK API
 */
public class EndEntityType
    extends ASN1Object
{
    public static final int        app = (1 << 7);
    public static final int        enrol = (1 << 6);

    private final ASN1BitString type;

    public EndEntityType(int type)
    {
        if (type != app && type != enrol)
        {
            throw new IllegalArgumentException("value out of range");
        }

        this.type = new DERBitString(type);
    }

    private EndEntityType(DERBitString str)
    {
        this.type = str;
    }

    public static EndEntityType getInstance(Object src)
    {
        if (src instanceof EndEntityType)
        {
            return (EndEntityType)src;
        }
        else if (src != null)
        {
            return new EndEntityType(DERBitString.getInstance(src));
        }

        return null;
    }

    public ASN1Primitive toASN1Primitive()
    {
        return type;
    }
}