Package tss

Class TpmDevice

  • All Implemented Interfaces:
    Closeable, AutoCloseable
    Direct Known Subclasses:
    TpmDeviceLinux, TpmDeviceTbs, TpmDeviceTcp

    public abstract class TpmDevice
    extends Object
    implements Closeable
    Partially abstract base class for classes implementing communication interface with TPM devices of different kinds (e.g. a simulator, TBS interface on Windows or /dev/tpm0 on linux).
    Author:
    pengland
    • Constructor Detail

      • TpmDevice

        public TpmDevice()
    • Method Detail

      • connect

        public abstract boolean connect()
        Establishes a connection with the TPM device.
        Returns:
        Whether the connection was established
      • close

        public abstract void close()
        Closes the established connection with the TPM device.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
      • dispatchCommand

        public abstract void dispatchCommand​(byte[] cmdBuf)
        Sends the TPM command buffer byte array to the TPM
        Parameters:
        cmdBuf - TPM command buffer
      • getResponse

        public abstract byte[] getResponse()
        Returns:
        TPM response buffer received from the TPM device
      • responseReady

        public abstract boolean responseReady()
        Returns:
        Whether the TPM response to the previously issued command is ready
      • powerCtl

        public void powerCtl​(boolean on)
        Powers on/off the TPM. Only implemented for TPM simulators and TPM vendors test harness.
        Parameters:
        on - New on/off state (true/false correspondingly)
      • assertPhysicalPresence

        public void assertPhysicalPresence​(boolean on)
        Asserts or stops asserting Physical Presence. Only implemented for TPM simulators and TPM vendors test harness.
        Parameters:
        on - New on/off state (true/false correspondingly)
      • setLocality

        public void setLocality​(int locality)
        Sets the locality for subsequent commands. Only implemented for TPM simulators and TPM vendors test harness.
        Parameters:
        locality - New locality value
      • platformAvailable

        public boolean platformAvailable()
        Returns:
        true if the TPM device supports sending/emulation of platform signals, and if the platform hierarchy is enabled.
      • powerCtlAvailable

        public boolean powerCtlAvailable()
        Returns:
        true if the TPM device can be power cycled programmatically
      • localityCtlAvailable

        public boolean localityCtlAvailable()
        Returns:
        true if the TPM device allows changing locality programmatically
      • implementsPhysicalPresence

        public boolean implementsPhysicalPresence()
        Returns:
        true if physical presence can be asserted
      • powerOn

        public void powerOn()
        Convenience wrapper for powerCtl(true)
      • powerOff

        public void powerOff()
        Convenience wrapper for powerCtl(false)
      • powerCycle

        public void powerCycle()
        Convenience wrapper for powerCtl(false); powerCtl(true). Power-cycles the TPM device, i.e. turns it off and then back on.