org.bouncycastle.oer.its.ieee1609dot2.SubjectPermissions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcutil-fips Show documentation
Show all versions of bcutil-fips Show documentation
The Bouncy Castle Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctls with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified and used appropriately.
The newest version!
package org.bouncycastle.oer.its.ieee1609dot2;
import org.bouncycastle.asn1.ASN1Choice;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Null;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.BERTags;
import org.bouncycastle.asn1.DERNull;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.oer.its.ieee1609dot2.basetypes.SequenceOfPsidSspRange;
/**
*
* SubjectPermissions ::= CHOICE {
* explicit SequenceOfPsidSspRange,
* all NULL,
* ...
* }
*
*/
public class SubjectPermissions
extends ASN1Object
implements ASN1Choice
{
public static final int explicit = 0;
public static final int all = 1;
private final ASN1Encodable subjectPermissions;
private final int choice;
SubjectPermissions(int choice, ASN1Encodable value)
{
this.subjectPermissions = value;
this.choice = choice;
}
public static SubjectPermissions explicit(SequenceOfPsidSspRange range)
{
return new SubjectPermissions(explicit, range);
}
public static SubjectPermissions all()
{
return new SubjectPermissions(all, DERNull.INSTANCE);
}
private SubjectPermissions(ASN1TaggedObject ato)
{
this.choice = ato.getTagNo();
switch (choice)
{
case explicit:
subjectPermissions = SequenceOfPsidSspRange.getInstance(ato.getObject());
break;
case all:
subjectPermissions = ASN1Null.getInstance(ato.getObject());
break;
default:
throw new IllegalArgumentException("invalid choice value " + choice);
}
}
public static SubjectPermissions getInstance(Object src)
{
if (src instanceof SubjectPermissions)
{
return (SubjectPermissions)src;
}
if (src != null)
{
return new SubjectPermissions(ASN1TaggedObject.getInstance(src));
}
return null;
}
public ASN1Encodable getSubjectPermissions()
{
return subjectPermissions;
}
public int getChoice()
{
return choice;
}
public ASN1Primitive toASN1Primitive()
{
return new DERTaggedObject(choice, subjectPermissions);
}
}