public class OctetStringType extends AbstractDERType implements DEREncoder
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
derItem
String to encode.
|
| Constructor and Description |
|---|
OctetStringType(byte[] item)
Creates a new octet string type.
|
OctetStringType(DERTag tag,
byte[] item)
Creates a new octet string type.
|
OctetStringType(DERTag tag,
java.lang.String item)
Creates a new octet string type.
|
OctetStringType(java.lang.String item)
Creates a new octet string type.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
decode(java.nio.ByteBuffer encoded)
Converts bytes in the buffer to a string by reading from the current position to the limit, which assumes the bytes
of the string are in big-endian order.
|
byte[] |
encode()
Encode this object into it's DER type.
|
static byte[] |
toBytes(java.lang.String s)
Converts the supplied string to a byte array using the UTF-8 encoding.
|
encode, readBufferpublic OctetStringType(java.lang.String item)
item - to DER encodepublic OctetStringType(byte[] item)
item - to DER encodepublic OctetStringType(DERTag tag, java.lang.String item)
tag - der tag associated with this typeitem - to DER encodejava.lang.IllegalArgumentException - if the der tag is constructedpublic OctetStringType(DERTag tag, byte[] item)
tag - der tag associated with this typeitem - to DER encodejava.lang.IllegalArgumentException - if the der tag is constructedpublic byte[] encode()
DEREncoderencode in interface DEREncoderpublic static java.lang.String decode(java.nio.ByteBuffer encoded)
encoded - buffer containing DER-encoded data where the buffer is positioned at the start of string bytes and
the limit is set beyond the last byte of string data.public static byte[] toBytes(java.lang.String s)
s - to convert