org.bouncycastle.oer.SwitchIndexer 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.
package org.bouncycastle.oer;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Sequence;
public abstract class SwitchIndexer
{
public abstract ASN1Encodable get(int index);
public static class Asn1SequenceIndexer
extends SwitchIndexer
{
private final ASN1Sequence sequence;
public Asn1SequenceIndexer(ASN1Sequence sequence)
{
this.sequence = sequence;
}
@Override
public ASN1Encodable get(int index)
{
return sequence.getObjectAt(index);
}
}
public static class Asn1EncodableVectorIndexer
extends SwitchIndexer
{
private final ASN1EncodableVector asn1EncodableVector;
public Asn1EncodableVectorIndexer(ASN1EncodableVector asn1EncodableVector)
{
this.asn1EncodableVector = asn1EncodableVector;
}
@Override
public ASN1Encodable get(int index)
{
return asn1EncodableVector.get(index);
}
}
public static class FixedValueIndexer
extends SwitchIndexer
{
private final ASN1Encodable returnValue;
public FixedValueIndexer(ASN1Encodable returnValue)
{
this.returnValue = returnValue;
}
@Override
public ASN1Encodable get(int index)
{
return returnValue;
}
}
}