All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.oer.its.etsi102941.CtlDelete Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctls. This jar contains APIs for JDK 1.8 and up.

There is a newer version: 1.78.1
Show newest version
package org.bouncycastle.oer.its.etsi102941;

import org.bouncycastle.asn1.ASN1Choice;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.oer.its.ieee1609dot2.basetypes.HashedId8;

/**
 * CtlDelete ::= CHOICE {
 * cert  HashedId8,
 * dc    DcDelete,
 * ...
 * }
 */
public class CtlDelete
    extends ASN1Object
    implements ASN1Choice
{

    public static final int cert = 0;
    public static final int dc = 1;

    private final int choice;
    private final ASN1Encodable ctlDelete;

    public static CtlDelete cert(HashedId8 value)
    {
        return new CtlDelete(cert, value);
    }

    public static CtlDelete dc(DcDelete value)
    {
        return new CtlDelete(dc, value);
    }


    public CtlDelete(int choice, ASN1Encodable value)
    {
        this.choice = choice;
        switch (choice)
        {
        case cert:
            ctlDelete = HashedId8.getInstance(value);
            return;
        case dc:
            ctlDelete = DcDelete.getInstance(value);
            return;
        }
        throw new IllegalArgumentException("invalid choice value " + choice);
    }

    private CtlDelete(ASN1TaggedObject value)
    {
        this(value.getTagNo(), value.getObject());
    }

    public static CtlDelete getInstance(Object o)
    {
        if (o instanceof CtlDelete)
        {
            return (CtlDelete)o;
        }

        if (o != null)
        {
            return new CtlDelete(ASN1TaggedObject.getInstance(o));
        }
        return null;
    }

    public int getChoice()
    {
        return choice;
    }

    public ASN1Encodable getCtlDelete()
    {
        return ctlDelete;
    }

    public ASN1Primitive toASN1Primitive()
    {
        return new DERTaggedObject(choice, ctlDelete);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy