public class OidType extends AbstractDERType implements DEREncoder
Modifier and Type | Field and Description |
---|---|
private byte[] |
derItem
Integer to encode.
|
Constructor and Description |
---|
OidType(DERTag tag,
int[] item)
Creates a new oid type.
|
OidType(DERTag tag,
String item)
Creates a new oid type.
|
OidType(int[] item)
Creates a new oid type.
|
OidType(String item)
Creates a new oid type.
|
Modifier and Type | Method and Description |
---|---|
static String |
decode(ByteBuffer encoded)
Converts bytes in the buffer to an OID by reading from the current position to the limit, which assumes the bytes
of the integer are in big-endian order.
|
byte[] |
encode()
Encode this object into it's DER type.
|
protected static void |
isValid(int[] oid)
Checks whether the supplied oid is valid.
|
static int[] |
parse(String oid)
Converts the supplied oid into an array on integers.
|
protected static int |
readInt(ByteBuffer buffer)
Reads the necessary encoded bytes from the supplied buffer to create an integer.
|
protected static byte[] |
toBytes(int component)
Converts the supplied oid component to a byte array.
|
static byte[] |
toBytes(int[] oid)
Converts the supplied list of oid components to a byte array.
|
encode, readBuffer
public OidType(String item)
item
- to DER encodepublic OidType(int[] item)
item
- to DER encodepublic OidType(DERTag tag, String item)
tag
- der tag associated with this typeitem
- to DER encodeIllegalArgumentException
- if the der tag is constructedpublic OidType(DERTag tag, int[] item)
tag
- der tag associated with this typeitem
- to DER encodeIllegalArgumentException
- if the der tag is constructedpublic byte[] encode()
DEREncoder
encode
in interface DEREncoder
public static String decode(ByteBuffer encoded)
encoded
- buffer containing DER-encoded data where the buffer is positioned at the start of OID bytes and
the limit is set beyond the last byte of OID data.public static byte[] toBytes(int[] oid)
oid
- to convertIllegalArgumentException
- if the oid is not valid. See isValid(int[])
protected static void isValid(int[] oid)
oid
- to checkIllegalArgumentException
- if the oid is not valid.protected static byte[] toBytes(int component)
component
- to convert to bytesprotected static int readInt(ByteBuffer buffer)
buffer
- to readpublic static int[] parse(String oid)
oid
- to parseIllegalArgumentException
- if the oid is not valid. See isValid(int[])
Copyright © 2003-2019 Virginia Tech. All Rights Reserved.