Package sop.external

Class ExternalSOP

java.lang.Object
sop.external.ExternalSOP
All Implemented Interfaces:
sop.SOP

public class ExternalSOP extends Object implements sop.SOP
Implementation of the SOP API using an external SOP binary.
  • Constructor Details

    • ExternalSOP

      public ExternalSOP(@Nonnull String binaryName)
      Instantiate an ExternalSOP object for the given binary and pass it empty environment variables, as well as a default ExternalSOP.TempDirProvider.
      Parameters:
      binaryName - name / path of the SOP binary
    • ExternalSOP

      public ExternalSOP(@Nonnull String binaryName, @Nonnull Properties properties)
      Instantiate an ExternalSOP object for the given binary, and pass it the given properties as environment variables, as well as a default ExternalSOP.TempDirProvider.
      Parameters:
      binaryName - name / path of the SOP binary
      properties - environment variables
    • ExternalSOP

      public ExternalSOP(@Nonnull String binaryName, @Nonnull ExternalSOP.TempDirProvider tempDirProvider)
      Instantiate an ExternalSOP object for the given binary and the given ExternalSOP.TempDirProvider using empty environment variables.
      Parameters:
      binaryName - name / path of the SOP binary
      tempDirProvider - custom tempDirProvider
    • ExternalSOP

      public ExternalSOP(@Nonnull String binaryName, @Nonnull Properties properties, @Nonnull ExternalSOP.TempDirProvider tempDirProvider)
      Instantiate an ExternalSOP object for the given binary using the given properties and custom ExternalSOP.TempDirProvider.
      Parameters:
      binaryName - name / path of the SOP binary
      properties - environment variables
      tempDirProvider - tempDirProvider
  • Method Details

    • version

      public sop.operation.Version version()
      Specified by:
      version in interface sop.SOP
    • generateKey

      public sop.operation.GenerateKey generateKey()
      Specified by:
      generateKey in interface sop.SOP
    • extractCert

      public sop.operation.ExtractCert extractCert()
      Specified by:
      extractCert in interface sop.SOP
    • detachedSign

      public sop.operation.DetachedSign detachedSign()
      Specified by:
      detachedSign in interface sop.SOP
    • inlineSign

      public sop.operation.InlineSign inlineSign()
      Specified by:
      inlineSign in interface sop.SOP
    • detachedVerify

      public sop.operation.DetachedVerify detachedVerify()
      Specified by:
      detachedVerify in interface sop.SOP
    • inlineVerify

      public sop.operation.InlineVerify inlineVerify()
      Specified by:
      inlineVerify in interface sop.SOP
    • inlineDetach

      public sop.operation.InlineDetach inlineDetach()
      Specified by:
      inlineDetach in interface sop.SOP
    • encrypt

      public sop.operation.Encrypt encrypt()
      Specified by:
      encrypt in interface sop.SOP
    • decrypt

      public sop.operation.Decrypt decrypt()
      Specified by:
      decrypt in interface sop.SOP
    • armor

      public sop.operation.Armor armor()
      Specified by:
      armor in interface sop.SOP
    • listProfiles

      public sop.operation.ListProfiles listProfiles()
      Specified by:
      listProfiles in interface sop.SOP
    • revokeKey

      public sop.operation.RevokeKey revokeKey()
      Specified by:
      revokeKey in interface sop.SOP
    • changeKeyPassword

      public sop.operation.ChangeKeyPassword changeKeyPassword()
      Specified by:
      changeKeyPassword in interface sop.SOP
    • dearmor

      public sop.operation.Dearmor dearmor()
      Specified by:
      dearmor in interface sop.SOP
    • finish

      public static void finish(@Nonnull Process process) throws IOException
      Throws:
      IOException
    • propertiesToEnv

      public static List<String> propertiesToEnv(@Nonnull Properties properties)
      Return all key-value pairs from the given Properties object as a list with items of the form
      key=value
      .
      Parameters:
      properties - properties
      Returns:
      list of key=value strings
    • readString

      public static String readString(@Nonnull InputStream inputStream) throws IOException
      Read the contents of the InputStream and return them as a String.
      Parameters:
      inputStream - input stream
      Returns:
      string
      Throws:
      IOException - in case of an IO error
    • executeProducingOperation

      public static sop.Ready executeProducingOperation(@Nonnull Runtime runtime, @Nonnull List<String> commandList, @Nonnull List<String> envList)
      Execute the given command on the given Runtime with the given list of environment variables. This command does not transform any input data, and instead is purely a producer.
      Parameters:
      runtime - runtime
      commandList - command
      envList - environment variables
      Returns:
      ready to read the result from
    • executeTransformingOperation

      public static sop.Ready executeTransformingOperation(@Nonnull Runtime runtime, @Nonnull List<String> commandList, @Nonnull List<String> envList, @Nonnull InputStream standardIn)
      Execute the given command on the given runtime using the given environment variables. The given input stream provides input for the process. This command is a transformation, meaning it is given input data and transforms it into output data.
      Parameters:
      runtime - runtime
      commandList - command
      envList - environment variables
      standardIn - stream of input data for the process
      Returns:
      ready to read the result from
    • defaultTempDirProvider

      public static ExternalSOP.TempDirProvider defaultTempDirProvider()
      Default implementation of the ExternalSOP.TempDirProvider which stores temporary files in the systems temp dir (Files.createTempDirectory(String, FileAttribute[])).
      Returns:
      default implementation