Package tss
Class TpmBase
- java.lang.Object
-
- tss.TpmBase
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
Tpm
public abstract class TpmBase extends Object implements Closeable
TpmBase is the base class for Tpm (Tpm is auto-generated)
-
-
Field Summary
Fields Modifier and Type Field Description TPM_HANDLE
_EndorsementHandle
Admin handles (and associated auth values) can be associated with a TPM objectTPM_HANDLE
_LockoutHandle
Admin handles (and associated auth values) can be associated with a TPM objectTPM_HANDLE
_OwnerHandle
Admin handles (and associated auth values) can be associated with a TPM objectTPM_HANDLE
_PlatformHandle
Admin handles (and associated auth values) can be associated with a TPM object
-
Constructor Summary
Constructors Constructor Description TpmBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tpm
_allowErrors()
For the next TPM command invocation, errors will not cause an exception to be thrown (use _lastCommandSucceeded or _getLastResponseCode() to check for an error)Tpm
_expectError(TPM_RC expectedResponse)
For the next TPM command invocation, an exception will be throw if the command returns a response code different from expectedResponse.Tpm
_expectMoreResponses(TPM_RC... expectedResponses)
Adds more response codes allowed to be returned by the next executed command.Tpm
_expectResponses(TPM_RC... expectedResponses)
The next executed command should return one of the response codes contained in the given list.TpmDevice
_getDevice()
Tpm objects can interact with TPMs over a variety of interfaces called "devices." This returns the current attached deviceTPM_RC[]
_GetExpectedResponses()
TPM_RC
_getLastResponseCode()
Get the last TPM response codeBoolean
_lastCommandSucceeded()
Did the last TPM command return RC_SUCCESS?void
_setCallback(TpmCallbackInterface callback)
Clients can register for callbacks, e.g.void
_setDevice(TpmDevice theDevice)
Tpm objects can interact with TPMs over a variety of interfaces.Tpm
_withSession(TPM_HANDLE h)
Specifies a single session handle to use with the next commandTpm
_withSessions(TPM_HANDLE... hh)
Specifies the session handles to use with the next commandvoid
close()
protected void
DispatchCommand(TPM_CC cmdCode, ReqStructure req, RespStructure resp)
Send a command to the underlying TPMTPM_RC
getLastResponseCode()
Get last response code returned from the TPM (e.g.
-
-
-
Field Detail
-
_OwnerHandle
public TPM_HANDLE _OwnerHandle
Admin handles (and associated auth values) can be associated with a TPM object
-
_EndorsementHandle
public TPM_HANDLE _EndorsementHandle
Admin handles (and associated auth values) can be associated with a TPM object
-
_PlatformHandle
public TPM_HANDLE _PlatformHandle
Admin handles (and associated auth values) can be associated with a TPM object
-
_LockoutHandle
public TPM_HANDLE _LockoutHandle
Admin handles (and associated auth values) can be associated with a TPM object
-
-
Method Detail
-
_setDevice
public void _setDevice(TpmDevice theDevice)
Tpm objects can interact with TPMs over a variety of interfaces. This attaches a "TPM transport" interface to the TPM so that commands can be sent and received- Parameters:
theDevice
- A transport connection to a TPM device
-
_getDevice
public TpmDevice _getDevice()
Tpm objects can interact with TPMs over a variety of interfaces called "devices." This returns the current attached device- Returns:
- The current TPM device
-
_allowErrors
public Tpm _allowErrors()
For the next TPM command invocation, errors will not cause an exception to be thrown (use _lastCommandSucceeded or _getLastResponseCode() to check for an error)- Returns:
- The same object (to allow modifier chaining)
-
_GetExpectedResponses
public TPM_RC[] _GetExpectedResponses()
- Returns:
- The list of response codes allowed to be returned by the next executed command.
-
_expectError
public Tpm _expectError(TPM_RC expectedResponse)
For the next TPM command invocation, an exception will be throw if the command returns a response code different from expectedResponse.- Parameters:
expectedResponse
- Expected response code. May be null or TPM_RC.SUCCESS.- Returns:
- This Tpm object (to allow modifier chaining)
-
_expectResponses
public Tpm _expectResponses(TPM_RC... expectedResponses)
The next executed command should return one of the response codes contained in the given list. Otherwise a run-time warning is issued. If the only expected response code is TPM_RC.SUCCESS, and the command returns an error code, a TssException is thrown.- Parameters:
expectedResponses
- One or more allowed response codes. May be null.- Returns:
- This Tpm object (to allow modifier chaining)
-
_expectMoreResponses
public Tpm _expectMoreResponses(TPM_RC... expectedResponses)
Adds more response codes allowed to be returned by the next executed command. If no expected response codes have been specified with the _ExpectResponses() method before this call, TpmRc.Success is implicitly added to the list.- Parameters:
expectedResponses
- Additional allowed response codes. May not be null.- Returns:
- this TPM object
-
_lastCommandSucceeded
public Boolean _lastCommandSucceeded()
Did the last TPM command return RC_SUCCESS?- Returns:
- Success?
-
_getLastResponseCode
public TPM_RC _getLastResponseCode()
Get the last TPM response code- Returns:
- The response code
-
_withSession
public Tpm _withSession(TPM_HANDLE h)
Specifies a single session handle to use with the next command- Parameters:
h
- Session handle- Returns:
- this TPM object
-
_withSessions
public Tpm _withSessions(TPM_HANDLE... hh)
Specifies the session handles to use with the next command- Parameters:
hh
- List of up to 3 session handles- Returns:
- this TPM object
-
getLastResponseCode
public TPM_RC getLastResponseCode()
Get last response code returned from the TPM (e.g. TPM_RC.SUCCESS)- Returns:
- The response code
-
DispatchCommand
protected void DispatchCommand(TPM_CC cmdCode, ReqStructure req, RespStructure resp)
Send a command to the underlying TPM- Parameters:
cmdCode
- The command codereq
- The input parameter structureresp
- The output parameter structure
-
_setCallback
public void _setCallback(TpmCallbackInterface callback)
Clients can register for callbacks, e.g. after each TPM command is executed.- Parameters:
callback
- Reference to a TpmCallbackInterface implementation
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-