Package tss

Class 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 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
    • Constructor Detail

      • TpmBase

        public TpmBase()
    • 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 code
        req - The input parameter structure
        resp - 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