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,
               String item)
Creates a new octet string type. 
 | 
OctetStringType(String item)
Creates a new octet string type. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static String | 
decode(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(String s)
Converts the supplied string to a byte array using the UTF-8 encoding. 
 | 
encode, readBufferpublic OctetStringType(String item)
item - to DER encodepublic OctetStringType(byte[] item)
item - to DER encodepublic OctetStringType(DERTag tag, String item)
tag - der tag associated with this typeitem - to DER encodeIllegalArgumentException - if the der tag is constructedpublic OctetStringType(DERTag tag, byte[] item)
tag - der tag associated with this typeitem - to DER encodeIllegalArgumentException - if the der tag is constructedpublic byte[] encode()
DEREncoderencode in interface DEREncoderpublic static String decode(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(String s)
s - to convertCopyright © 2003-2019 Virginia Tech. All Rights Reserved.