iaik.tc.tss.api.structs.common
Class TcBasicTypeDecoder

java.lang.Object
  extended by iaik.tc.tss.api.structs.common.TcBasicTypeDecoder
Direct Known Subclasses:
TcCompositeTypeDecoder

public class TcBasicTypeDecoder
extends java.lang.Object

This class provides a set of basic decoding methods for simple TCG defined types such as UINT32. The decoding assumes that the data is provided in big endian (MSB first) byte order by lower layers (TSS). Furthermore, it is assumed that structures are packed on byte boundaries. Both assumptions are based on the statements on "Endness of Structures" and "Byte Packing" in the TCG TPM Specification. Instances of this class take a a raw byte data blob with an optional initial offset. By calling the decode methods, the byte data is decoded according to the type of the decode method. The decodeUINT32 method for instance, reads 4 bytes (starting at the current offset), interprets them as a 4 byte integer and returns it. The internal offset is advanced by the size of the decoded type (4 bytes in the case of UNIT32).


Constructor Summary
TcBasicTypeDecoder(TcBlobData data)
          This constructor takes a byte data object to be decoded.
TcBasicTypeDecoder(TcBlobData data, int offset)
          This constructor takes a byte data object to be decoded.
 
Method Summary
 boolean decodeBoolean()
          This method decodes a single byte and interprets it as a boolean value.
 short decodeByte()
          This method decodes a single byte.
 TcBlobData decodeBytes(int numBytes)
          This method returns the given number of bytes starting at the current offset.
 TcBlobData decodeBytes(long numBytes)
          Overloaded method taking a long instead of an int as argument.
 long decodeTpmAlgorithmId()
          This method decodes a TPM_ALGORITHM_ID.
 short decodeTpmAuthDataUsage()
          This method decodes a TPM_AUTH_DATA_USAGE.
 int decodeTpmEncScheme()
          This method decodes a TPM_ENC_SCHEME.
 long decodeTpmKeyFlags()
          This method decodes a TPM_KEY_FLAGS.
 int decodeTpmKeyUsage()
          This method decodes a TPM_KEY_USAGE.
 int decodeTpmSigScheme()
          This method decodes a TPM_SIG_SCHEME.
 long decodeTssAlgorithmId()
          This method decodes a TSS_ALGORITHM_ID.
 int decodeTssEncScheme()
          This method decodes a TSS_ENC_SCHEME.
 long decodeTssEvenType()
          This method decodes a TSS_EVEN_TYPE.
 long decodeTssFlag()
          This method decodes a TSS_FLAG.
 long decodeTssHandle()
          This method decodes a TSS_HANDLE.
 long decodeTssHContext()
          This method decodes a TSS_HCONTEXT.
 long decodeTssHEncData()
          This method decodes a TSS_HENC_DATA.
 long decodeTssHHash()
          This method decodes a TSS_HHASH.
 long decodeTssHKey()
          This method decodes a TSS_HKEY.
 long decodeTssHObjet()
          This method decodes a TSS_HOBJECT.
 long decodeTssHPcrs()
          This method decodes a TSS_HPCRS.
 long decodeTssHPolicy()
          This method decodes a TSS_HPOLICY.
 long decodeTssHPS()
          This method decodes a TSS_HPS.
 long decodeTssHTpm()
          This method decodes a TSS_HTPM.
 long decodeTssKeyUsageId()
          This method decodes a TSS_KEY_USAGE_ID.
 int decodeTssMigrationScheme()
          This method decodes a TSS_MIGRATION_SCHEME.
 long decodeTssResult()
          This method decodes a TSS_RESULT.
 int decodeTssSigScheme()
          This method decodes a TSS_SIG_SCHEME.
 int decodeUINT16()
          This method decodes an UINT16 type starting at the current offset.
 long decodeUINT32()
          This method decodes an UINT32 type starting at the current offset.
 java.math.BigInteger decodeUINT64()
          This method decodes an UINT64 type starting at the current offset.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcBasicTypeDecoder

public TcBasicTypeDecoder(TcBlobData data)
This constructor takes a byte data object to be decoded. The initial offset is set to 0.

Parameters:
data - The byte data to be decoded.

TcBasicTypeDecoder

public TcBasicTypeDecoder(TcBlobData data,
                          int offset)
This constructor takes a byte data object to be decoded. The initial offset is set to the specified one.

Parameters:
data - The byte data to be decoded.
offset - The initial offset.
Method Detail

decodeUINT32

public long decodeUINT32()
This method decodes an UINT32 type starting at the current offset. The Value is returned as a Java long to avoid problems with the signdness of the Java 32bit int type.


decodeUINT64

public java.math.BigInteger decodeUINT64()
This method decodes an UINT64 type starting at the current offset. The Value is returned as a unsigned Java BigInteger.


decodeUINT16

public int decodeUINT16()
This method decodes an UINT16 type starting at the current offset. The Value is returned as a Java int to avoid problems with the signdness of the Java 16bit int type.


decodeByte

public short decodeByte()
This method decodes a single byte.


decodeBytes

public TcBlobData decodeBytes(int numBytes)
This method returns the given number of bytes starting at the current offset.

Parameters:
numBytes - number of bytes to decode

decodeBytes

public TcBlobData decodeBytes(long numBytes)
Overloaded method taking a long instead of an int as argument.


decodeBoolean

public boolean decodeBoolean()
This method decodes a single byte and interprets it as a boolean value.


decodeTssHandle

public long decodeTssHandle()
This method decodes a TSS_HANDLE.


decodeTssFlag

public long decodeTssFlag()
This method decodes a TSS_FLAG.


decodeTssResult

public long decodeTssResult()
This method decodes a TSS_RESULT.


decodeTssHObjet

public long decodeTssHObjet()
This method decodes a TSS_HOBJECT.


decodeTssHContext

public long decodeTssHContext()
This method decodes a TSS_HCONTEXT.


decodeTssHPolicy

public long decodeTssHPolicy()
This method decodes a TSS_HPOLICY.


decodeTssHTpm

public long decodeTssHTpm()
This method decodes a TSS_HTPM.


decodeTssHKey

public long decodeTssHKey()
This method decodes a TSS_HKEY.


decodeTssHEncData

public long decodeTssHEncData()
This method decodes a TSS_HENC_DATA.


decodeTssHPcrs

public long decodeTssHPcrs()
This method decodes a TSS_HPCRS.


decodeTssHHash

public long decodeTssHHash()
This method decodes a TSS_HHASH.


decodeTssHPS

public long decodeTssHPS()
This method decodes a TSS_HPS.


decodeTssEvenType

public long decodeTssEvenType()
This method decodes a TSS_EVEN_TYPE.


decodeTssMigrationScheme

public int decodeTssMigrationScheme()
This method decodes a TSS_MIGRATION_SCHEME.


decodeTssAlgorithmId

public long decodeTssAlgorithmId()
This method decodes a TSS_ALGORITHM_ID.


decodeTssKeyUsageId

public long decodeTssKeyUsageId()
This method decodes a TSS_KEY_USAGE_ID.


decodeTssEncScheme

public int decodeTssEncScheme()
This method decodes a TSS_ENC_SCHEME.


decodeTssSigScheme

public int decodeTssSigScheme()
This method decodes a TSS_SIG_SCHEME.


decodeTpmEncScheme

public int decodeTpmEncScheme()
This method decodes a TPM_ENC_SCHEME.


decodeTpmSigScheme

public int decodeTpmSigScheme()
This method decodes a TPM_SIG_SCHEME.


decodeTpmAlgorithmId

public long decodeTpmAlgorithmId()
This method decodes a TPM_ALGORITHM_ID.


decodeTpmKeyUsage

public int decodeTpmKeyUsage()
This method decodes a TPM_KEY_USAGE.


decodeTpmKeyFlags

public long decodeTpmKeyFlags()
This method decodes a TPM_KEY_FLAGS.


decodeTpmAuthDataUsage

public short decodeTpmAuthDataUsage()
This method decodes a TPM_AUTH_DATA_USAGE.