Class DERUtils

java.lang.Object
org.jolokia.jvmagent.security.asn1.DERUtils

public class DERUtils extends Object
  • Method Details

    • encodeLength

      public static byte[] encodeLength(int size)

      ASN.1 encode length value as length octets according to X.690, 8.1.3 Length octets

      DER rules permit only the definite form without end marker. int allows encoding lengths up to and including 0x7FFFFFFF and 5 bytes for encoded length is enough to fit such encoded length value.

      Parameters:
      size -
      Returns:
    • decodeLength

      public static int[] decodeLength(byte[] encoded)
      Decode length value in the passed byte array
      Parameters:
      encoded -
      Returns:
      [ the length of the DER value, length of encoded length value ]
    • decodeLength

      public static int[] decodeLength(byte[] encoded, int offset)
      Decode length value in the passed byte array starting from offset
      Parameters:
      encoded -
      offset -
      Returns:
      [ the length of the DER value, length of encoded length value ]
    • parse

      public static DERObject parse(byte[] encoded)
    • parse

      public static DERObject parse(byte[] encoded, int offset)