Package io.airlift.security.der
Class DerUtils
- java.lang.Object
-
- io.airlift.security.der.DerUtils
-
public final class DerUtils extends Object
ASN.1 DER encoder methods necessary to process PEM files and to write a certificate signing request. NOTE: this API is only present for the two mentioned use cases, and is subject to change without warning.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<byte[]>decodeSequence(byte[] sequence)Decodes a sequence of encoded values.static byte[]decodeSequenceOptionalElement(byte[] element)Decodes a optional element of a sequence.static byte[]encodeBitString(int padBits, byte[] value)Encodes a bit string padded with the specified number of bits.static byte[]encodeLength(int length)Encodes the length of a DER value.static byte[]encodeOctetString(byte[] value)Encodes an octet string.static byte[]encodeOid(String oid)static byte[]encodeSequence(byte[]... encodedValues)Encodes a sequence of encoded values.
-
-
-
Method Detail
-
encodeSequence
public static byte[] encodeSequence(byte[]... encodedValues)
Encodes a sequence of encoded values.
-
decodeSequence
public static List<byte[]> decodeSequence(byte[] sequence)
Decodes a sequence of encoded values.
-
decodeSequenceOptionalElement
public static byte[] decodeSequenceOptionalElement(byte[] element)
Decodes a optional element of a sequence.
-
encodeBitString
public static byte[] encodeBitString(int padBits, byte[] value)Encodes a bit string padded with the specified number of bits. The encoding is a byte containing the padBits followed by the value bytes.
-
encodeOctetString
public static byte[] encodeOctetString(byte[] value)
Encodes an octet string.
-
encodeLength
public static byte[] encodeLength(int length)
Encodes the length of a DER value. The encoding of a 7bit value is simply the value. Values needing more than 7bits are encoded as a lead byte with the high bit set and containing the number of value bytes. Then the following bytes encode the length using the least number of bytes possible.
-
encodeOid
public static byte[] encodeOid(String oid)
-
-