Class Asn1Util
- java.lang.Object
-
- net.ripe.rpki.commons.crypto.util.Asn1Util
-
public final class Asn1Util extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.bouncycastle.asn1.ASN1Primitivedecode(byte[] extension)Decodes the byte array extension using theASN1InputStream.static byte[]encode(org.bouncycastle.asn1.ASN1Encodable value)static org.bouncycastle.asn1.DERBitStringencodeIpAddress(net.ripe.ipresource.IpRange prefix)IPAddress ::= BIT STRINGstatic <T extends org.bouncycastle.asn1.ASN1Encodable>
Texpect(org.bouncycastle.asn1.ASN1Encodable value, Class<? extends T> expectedClass)Checks ifvalueis an instance of theexpectedClass.static net.ripe.ipresource.AsnparseAsId(org.bouncycastle.asn1.ASN1Encodable der)ASId ::= INTEGERstatic net.ripe.ipresource.IpAddressparseIpAddress(net.ripe.ipresource.IpResourceType type, org.bouncycastle.asn1.ASN1Encodable der, boolean padWithOnes)IPAddress ::= BIT STRINGstatic net.ripe.ipresource.IpRangeparseIpAddressAsPrefix(net.ripe.ipresource.IpResourceType type, org.bouncycastle.asn1.ASN1Encodable der)IpAddressused as a prefix.static org.bouncycastle.asn1.DERBitStringresourceToBitString(net.ripe.ipresource.UniqueIpResource resource, int bitCount)
-
-
-
Method Detail
-
encode
public static byte[] encode(org.bouncycastle.asn1.ASN1Encodable value)
-
resourceToBitString
public static org.bouncycastle.asn1.DERBitString resourceToBitString(net.ripe.ipresource.UniqueIpResource resource, int bitCount)
-
decode
public static org.bouncycastle.asn1.ASN1Primitive decode(byte[] extension)
Decodes the byte array extension using theASN1InputStream.
-
expect
public static <T extends org.bouncycastle.asn1.ASN1Encodable> T expect(org.bouncycastle.asn1.ASN1Encodable value, Class<? extends T> expectedClass)Checks ifvalueis an instance of theexpectedClass.- Throws:
IllegalArgumentException- the instance is null or not an instance of the expected class.
-
parseIpAddressAsPrefix
public static net.ripe.ipresource.IpRange parseIpAddressAsPrefix(net.ripe.ipresource.IpResourceType type, org.bouncycastle.asn1.ASN1Encodable der)IpAddressused as a prefix.
-
parseIpAddress
public static net.ripe.ipresource.IpAddress parseIpAddress(net.ripe.ipresource.IpResourceType type, org.bouncycastle.asn1.ASN1Encodable der, boolean padWithOnes)IPAddress ::= BIT STRING
-
parseAsId
public static net.ripe.ipresource.Asn parseAsId(org.bouncycastle.asn1.ASN1Encodable der)
ASId ::= INTEGER- Throws:
IllegalArgumentException- when the wrong encoding is used or value is not a valid 32-bit ASN.
-
encodeIpAddress
public static org.bouncycastle.asn1.DERBitString encodeIpAddress(net.ripe.ipresource.IpRange prefix)
IPAddress ::= BIT STRING
-
-