|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectTcBlobData
public class TcBlobData
This class represents a data blob (binary data object) that is received from/passed to the TSS. Passing parameters as simple unsigned byte arrays is a common practice in the TSS APIs. This class provides an abstraction of this byte data objects.
Method Summary | |
---|---|
void |
append(TcBlobData dataToAppend)
This method is used to append binary data to the current binary data block. |
byte[] |
asByteArray()
This method returns the entire binary data as a byte array. |
short[] |
asShortArray()
This method returns the entire binary data as a short array. |
Object |
clone()
This method returns a clone of the object. |
boolean |
equals(Object obj)
This method checks if two objects are equal. |
void |
flush()
Flushes the internal buffer by filling it with 0. |
byte |
getByteOrder()
This method returns the byte order used when converting UINT16 and UINT32 types to byte blobs. |
byte |
getElement(int index)
This method returns the byte value at the given position. |
int |
getLength()
This method returns the length of the binary data. |
long |
getLengthAsLong()
This method returns the length of the binary data. |
byte[] |
getRange(int index,
int numElements)
This method returns a specified range of elements. |
short[] |
getRangeAsShortArray(int index,
int numElements)
This method returns a specified range of elements. |
int |
hashCode()
|
TcBlobData |
hmacSha1(TcBlobData key)
This method returns the HmacSha1 digest of the object's data using the given HMAC key. |
TcBlobData |
initStringASCII(String input)
Initializes the object using the provided String value. |
void |
invalidateContent()
This method overwrites the data held internally by the object with all zeros. |
static TcBlobData |
newBlobData(TcBlobData other)
This method takes another TcBlobData object and copies its contents to this object (i.e. |
static TcBlobData |
newBOOL(boolean input)
Initializes the object using the provided boolean value. |
static TcBlobData |
newBYTE(short input)
Initializes the object using the provided short value. |
static TcBlobData |
newByteArray(byte[] input)
This factory method creates a new blob and initializes it with the given byte array. |
static TcBlobData |
newByteArray(byte[] input,
int offset,
int numBytes)
This factory method creates a new blob and initializes it with the given byte array. |
static TcBlobData |
newString(String input)
Initializes the object using the provided String value.Note that this method uses the default string encoding and the default null termination behavior. |
static TcBlobData |
newString(String input,
boolean addNullTermination)
Initializes the object using the provided String value. |
static TcBlobData |
newString(String input,
boolean addNullTermination,
String stringEncoding)
Initializes the object using the provided String value. |
static TcBlobData |
newStringASCII(String input)
Initializes the object using the provided String value. |
static TcBlobData |
newUINT16(int input)
Initializes the object using the provided int value. |
static TcBlobData |
newUINT16(int input,
byte byteOrder)
Initializes the object using the provided int value. |
static TcBlobData |
newUINT32(long input)
Initializes the object using the provided long value. |
static TcBlobData |
newUINT32(long input,
byte byteOrder)
Initializes the object using the provided long value. |
static TcBlobData |
newUINT64(BigInteger input)
|
void |
overrideByteOrder(byte byteOrder)
This method allows to override the default byte order used when parsing mutli-byte types into a byte array. |
void |
overrideStringEncoding(String encoding)
This method allows to override the string encoding scheme that is used when interpreting the data held by the object. |
void |
overrideStringIsNullTerminated(boolean isNullTerminated)
This method allows to override the internal flag indicating if the contained string data is null terminated or not. |
void |
prepend(TcBlobData dataToPrepend)
This method is used to prepend binary data to the current binary data block. |
TcBlobData |
sha1()
This method returns the SHA-1 digest of the contained binary data. |
boolean |
stringIsNullTerminated()
This method returns true if the contained string data is null terminated, false otherwise. |
void |
substBytes(int offset,
byte[] data)
This method allows to substitute a contiguous range of bytes in the byte blob. |
void |
toggleNullTermination()
This method appends or removes the null termination character of the contained data based on the current state of the stringIsNullTerminated_ flag. |
String |
toHexString()
Returns a hex string representation of the object's binary data. |
String |
toHexStringNoWrap()
|
String |
toString()
Returns a string representation of the object's binary data. |
String |
toStringASCII()
Returns a string representation of the object's binary data. |
TcBlobData |
xor(TcBlobData key)
This method returns the object's data in XOR encrypted form using the provided key. |
Methods inherited from class Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static TcBlobData newBYTE(short input) throws IllegalArgumentException
input
- Single byte the object is initialized with.
IllegalArgumentException
- If negative arguments are supplied, this exception is thrown.public static TcBlobData newBOOL(boolean input) throws IllegalArgumentException
input
- Single byte the object is initialized with.
IllegalArgumentException
- If negative arguments are supplied, this exception is thrown.public static TcBlobData newUINT16(int input) throws IllegalArgumentException
input
- Single short the object is initialized with.
IllegalArgumentException
- If negative arguments are supplied, this exception is thrown.public static TcBlobData newUINT16(int input, byte byteOrder) throws IllegalArgumentException
input
- Single short the object is initialized with.byteOrder
- byte order to be used
IllegalArgumentException
- If negative arguments are supplied, this exception is thrown.public static TcBlobData newUINT32(long input) throws IllegalArgumentException
input
- Single int the object is initialized with.
IllegalArgumentException
- If negative arguments are supplied, this exception is thrown.public static TcBlobData newUINT64(BigInteger input) throws IllegalArgumentException
input
- Single BigInteger the object is initialized with.
IllegalArgumentException
- If negative arguments are supplied, this exception is thrown.public static TcBlobData newUINT32(long input, byte byteOrder) throws IllegalArgumentException
input
- Single short the object is initialized with.byteOrder
- byte order to be used
IllegalArgumentException
- If negative arguments are supplied, this exception is thrown.public static TcBlobData newByteArray(byte[] input)
public static TcBlobData newByteArray(byte[] input, int offset, int numBytes)
input
- Byte array the object is initialized with.offset
- the Offset the data copying starts fromnumBytes
- the number of bytes copied
public static TcBlobData newString(String input, boolean addNullTermination, String stringEncoding)
input
- String the object is initialized with.addNullTermination
- If true, a null termination character is appended.stringEncoding
- The encoding scheme used when parsing the given String into a byte array.
public static TcBlobData newString(String input, boolean addNullTermination)
input
- String the object is initialized with.addNullTermination
- If true, a null termination character is appended.
public static TcBlobData newString(String input)
input
- String the object is initialized with.
public static TcBlobData newStringASCII(String input)
input
- String the object is initialized with.
public static TcBlobData newBlobData(TcBlobData other)
other
- Other BlobData object this object is initialized with.
public void overrideByteOrder(byte byteOrder)
byteOrder
- The byte order to the used.public void overrideStringEncoding(String encoding)
encoding
- The string encoding scheme used for interpreting the objects data.public void overrideStringIsNullTerminated(boolean isNullTerminated)
isNullTerminated
- The null termination state for the data.public byte getByteOrder()
public TcBlobData initStringASCII(String input)
input
- String the object is initialized with.
public void append(TcBlobData dataToAppend)
dataToAppend
- data to be appended to the current blockpublic void prepend(TcBlobData dataToPrepend)
dataToPrepend
- data to be prepended to the current blockpublic byte getElement(int index)
index
- the index of the element to be returned.
public int getLength()
public long getLengthAsLong()
public byte[] getRange(int index, int numElements)
index
- first element to be returnednumElements
- number of elements to be returned
public short[] getRangeAsShortArray(int index, int numElements)
index
- first element to be returnednumElements
- number of elements to be returned
public byte[] asByteArray()
public short[] asShortArray()
public void substBytes(int offset, byte[] data)
offset
- The offset where the substitution starts.data
- The data to be substituted into the blob.public TcBlobData sha1()
NoSuchAlgorithmException
public TcBlobData hmacSha1(TcBlobData key)
key
- The key used for the HMAC calculation.
TcTssException
- This exception is thrown if the provided key is invalid.public TcBlobData xor(TcBlobData key)
public void flush()
TcBlobData
instances that represent passwords to clear the
password from memory.
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public Object clone()
clone
in class Object
public String toHexString()
public String toHexStringNoWrap()
public boolean stringIsNullTerminated()
public void toggleNullTermination()
public void invalidateContent()
public String toString()
toString
in class Object
public String toStringASCII()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |