Class SNPGuestWrapper


  • public class SNPGuestWrapper
    extends java.lang.Object
    Wrapper to execute the command line tool SNPGuest.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.apache.logging.log4j.Logger LOGGER  
      private java.lang.Runtime runtime  
      private static java.nio.file.Path SNPGUEST  
      private static org.apache.logging.log4j.Marker STDERR_MARKER  
      private static org.apache.logging.log4j.Marker STDOUT_MARKER  
    • Constructor Summary

      Constructors 
      Constructor Description
      SNPGuestWrapper()
      Default constructor.
      SNPGuestWrapper​(java.lang.Runtime runtimeIn)
      Constructor to specify a runtime.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int executeProcess​(java.lang.String... command)
      Executes a commandline process
      int fetchVCEK​(EpycGeneration generation, java.nio.file.Path certsDir, java.nio.file.Path report)
      Fetch the VCEK from the KDS.
      private static void logProcessOutput​(org.apache.logging.log4j.Marker marker, java.io.InputStream stream)  
      int verifyAttestation​(java.nio.file.Path certsDir, java.nio.file.Path report)
      Verify the attestation report.
      int verifyCertificates​(java.nio.file.Path certsDir)
      Verify the certificate chain.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • STDOUT_MARKER

        private static final org.apache.logging.log4j.Marker STDOUT_MARKER
      • STDERR_MARKER

        private static final org.apache.logging.log4j.Marker STDERR_MARKER
      • LOGGER

        private static final org.apache.logging.log4j.Logger LOGGER
      • SNPGUEST

        private static final java.nio.file.Path SNPGUEST
      • runtime

        private final java.lang.Runtime runtime
    • Constructor Detail

      • SNPGuestWrapper

        public SNPGuestWrapper()
        Default constructor.
      • SNPGuestWrapper

        SNPGuestWrapper​(java.lang.Runtime runtimeIn)
        Constructor to specify a runtime. For unit testing.
        Parameters:
        runtimeIn - the runtime used to execute processes
    • Method Detail

      • fetchVCEK

        public int fetchVCEK​(EpycGeneration generation,
                             java.nio.file.Path certsDir,
                             java.nio.file.Path report)
                      throws java.util.concurrent.ExecutionException
        Fetch the VCEK from the KDS.
        Parameters:
        generation - Specify the processor model for the certificate chain.
        certsDir - Directory to store the certificates in
        report - Path to attestation report to use to request VCEK
        Returns:
        the exit code of the fetching process
        Throws:
        java.util.concurrent.ExecutionException - when an error happens during the process execution
      • verifyCertificates

        public int verifyCertificates​(java.nio.file.Path certsDir)
                               throws java.util.concurrent.ExecutionException
        Verify the certificate chain.
        Parameters:
        certsDir - Path to directory containing certificate chain
        Returns:
        the exit code of the verification process
        Throws:
        java.util.concurrent.ExecutionException - when an error happens during the process execution
      • verifyAttestation

        public int verifyAttestation​(java.nio.file.Path certsDir,
                                     java.nio.file.Path report)
                              throws java.util.concurrent.ExecutionException
        Verify the attestation report.
        Parameters:
        certsDir - Path to directory containing VCEK.
        report - Path to attestation report to use for validation.
        Returns:
        the exit code of the verification process
        Throws:
        java.util.concurrent.ExecutionException - when an error happens during the process execution
      • executeProcess

        private int executeProcess​(java.lang.String... command)
                            throws java.util.concurrent.ExecutionException
        Executes a commandline process
        Parameters:
        command - the command line to execute
        Returns:
        the exit code returned by the process
        Throws:
        java.util.concurrent.ExecutionException - when an error happens during the process execution
      • logProcessOutput

        private static void logProcessOutput​(org.apache.logging.log4j.Marker marker,
                                             java.io.InputStream stream)