Class Asn1Util


  • public final class Asn1Util
    extends Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.bouncycastle.asn1.ASN1Primitive decode​(byte[] extension)
      Decodes the byte array extension using the ASN1InputStream.
      static byte[] encode​(org.bouncycastle.asn1.ASN1Encodable value)  
      static org.bouncycastle.asn1.DERBitString encodeIpAddress​(net.ripe.ipresource.IpRange prefix)
      IPAddress ::= BIT STRING
      static <T extends org.bouncycastle.asn1.ASN1Encodable>
      T
      expect​(org.bouncycastle.asn1.ASN1Encodable value, Class<? extends T> expectedClass)
      Checks if value is an instance of the expectedClass.
      static net.ripe.ipresource.Asn parseAsId​(org.bouncycastle.asn1.ASN1Encodable der)
      ASId ::= INTEGER
      static net.ripe.ipresource.IpAddress parseIpAddress​(net.ripe.ipresource.IpResourceType type, org.bouncycastle.asn1.ASN1Encodable der, boolean padWithOnes)
      IPAddress ::= BIT STRING
      static net.ripe.ipresource.IpRange parseIpAddressAsPrefix​(net.ripe.ipresource.IpResourceType type, org.bouncycastle.asn1.ASN1Encodable der)
      IpAddress used as a prefix.
      static org.bouncycastle.asn1.DERBitString resourceToBitString​(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 the ASN1InputStream.
      • expect

        public static <T extends org.bouncycastle.asn1.ASN1Encodable> T expect​(org.bouncycastle.asn1.ASN1Encodable value,
                                                                               Class<? extends T> expectedClass)
        Checks if value is an instance of the expectedClass.
        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)
        IpAddress used 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