Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.bouncycastle.oer;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Integer;
public class OERDefinition
{
static final BigInteger[] uIntMax = new BigInteger[]{
new BigInteger("256"),
new BigInteger("65536"),
new BigInteger("4294967296"),
new BigInteger("18446744073709551616"),
};
static final BigInteger[][] sIntRange = new BigInteger[][]{
new BigInteger[]{new BigInteger("-128"), new BigInteger("127")},
new BigInteger[]{new BigInteger("-32768"), new BigInteger("32767")},
new BigInteger[]{new BigInteger("-2147483648"), new BigInteger("2147483647")},
new BigInteger[]{new BigInteger("-9223372036854775808"), new BigInteger("9223372036854775807")},
};
public static Builder bool()
{
return new Builder(BaseType.BOOLEAN);
}
public static Builder integer()
{
return new Builder(BaseType.INT);
}
public static Builder integer(long val)
{
return new Builder(BaseType.INT).defaultValue(new ASN1Integer(val));
}
public static Builder bitString(long len)
{
return new Builder(BaseType.BIT_STRING).fixedSize(len);
}
public static Builder integer(BigInteger lower, BigInteger upper)
{
return new Builder(BaseType.INT).range(lower, upper);
}
public static Builder integer(long lower, long upper)
{
return new Builder(BaseType.INT).range(BigInteger.valueOf(lower), BigInteger.valueOf(upper));
}
public static Builder integer(long lower, long upper, ASN1Encodable defaultValue)
{
return new Builder(BaseType.INT).range(lower, upper, defaultValue);
}
public static Builder nullValue()
{
return new Builder(BaseType.NULL);
}
public static Builder seq()
{
return new Builder(BaseType.SEQ);
}
public static Builder seq(Object... items)
{
return new Builder(BaseType.SEQ).items(items);
}
public static Builder aSwitch(Switch aSwitch)
{
return new Builder(BaseType.Switch).decodeSwitch(aSwitch);
}
public static Builder enumItem(String label)
{
return new Builder(BaseType.ENUM_ITEM).label(label);
}
public static Builder enumItem(String label, BigInteger value)
{
return new Builder(BaseType.ENUM_ITEM).enumValue(value).label(label);
}
public static Builder enumeration(Object... items)
{
return new Builder(BaseType.ENUM).items(items);
}
public static Builder choice(Object... items)
{
return new Builder(BaseType.CHOICE).items(items);
}
public static Builder placeholder()
{
return new Builder(null);
}
public static Builder seqof(Object... items)
{
return new Builder(BaseType.SEQ_OF).items(items);
}
public static Builder octets()
{
return new Builder(BaseType.OCTET_STRING).unbounded();
}
public static Builder octets(int size)
{
return new Builder(BaseType.OCTET_STRING).fixedSize(size);
}
public static Builder octets(int lowerBound, int upperBound)
{
return new Builder(BaseType.OCTET_STRING).range(BigInteger.valueOf(lowerBound), BigInteger.valueOf(upperBound));
}
public static Builder ia5String()
{
return new Builder(BaseType.IA5String);
}
public static Builder utf8String()
{
return new Builder(BaseType.UTF8_STRING);
}
public static Builder utf8String(int size)
{
return new Builder(BaseType.UTF8_STRING).rangeToMAXFrom(size);
}
public static Builder utf8String(int lowerBound, int upperBound)
{
return new Builder(BaseType.UTF8_STRING).range(BigInteger.valueOf(lowerBound), BigInteger.valueOf(upperBound));
}
public static Builder opaque()
{
return new Builder(BaseType.OPAQUE);
}
public static List