Package sop.external

Class ExternalSOP

  • All Implemented Interfaces:
    sop.SOP

    public class ExternalSOP
    extends java.lang.Object
    implements sop.SOP
    Implementation of the SOP API using an external SOP binary.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  ExternalSOP.TempDirProvider
      This interface can be used to provide a directory in which external SOP binaries can temporarily store additional results of OpenPGP operations such that the binding classes can parse them out from there.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      sop.operation.Armor armor()  
      sop.operation.Dearmor dearmor()  
      sop.operation.Decrypt decrypt()  
      static ExternalSOP.TempDirProvider defaultTempDirProvider()
      Default implementation of the ExternalSOP.TempDirProvider which stores temporary files in the systems temp dir (Files.createTempDirectory(String, FileAttribute[])).
      sop.operation.DetachedSign detachedSign()  
      sop.operation.DetachedVerify detachedVerify()  
      sop.operation.Encrypt encrypt()  
      static sop.Ready executeProducingOperation​(java.lang.Runtime runtime, java.util.List<java.lang.String> commandList, java.util.List<java.lang.String> envList)
      Execute the given command on the given Runtime with the given list of environment variables.
      static sop.Ready executeTransformingOperation​(java.lang.Runtime runtime, java.util.List<java.lang.String> commandList, java.util.List<java.lang.String> envList, java.io.InputStream standardIn)
      Execute the given command on the given runtime using the given environment variables.
      sop.operation.ExtractCert extractCert()  
      static void finish​(java.lang.Process process)  
      sop.operation.GenerateKey generateKey()  
      sop.operation.InlineDetach inlineDetach()  
      sop.operation.InlineSign inlineSign()  
      sop.operation.InlineVerify inlineVerify()  
      sop.operation.ListProfiles listProfiles()  
      static java.util.List<java.lang.String> propertiesToEnv​(java.util.Properties properties)
      Return all key-value pairs from the given Properties object as a list with items of the form
      static java.lang.String readString​(java.io.InputStream inputStream)
      Read the contents of the InputStream and return them as a String.
      sop.operation.Version version()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface sop.SOP

        sign, verify
    • Constructor Detail

      • ExternalSOP

        public ExternalSOP​(@Nonnull
                           java.lang.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
                           java.lang.String binaryName,
                           @Nonnull
                           java.util.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
                           java.lang.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
                           java.lang.String binaryName,
                           @Nonnull
                           java.util.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 Detail

      • 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
      • dearmor

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

        public static void finish​(@Nonnull
                                  java.lang.Process process)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • propertiesToEnv

        public static java.util.List<java.lang.String> propertiesToEnv​(@Nonnull
                                                                       java.util.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 java.lang.String readString​(@Nonnull
                                                  java.io.InputStream inputStream)
                                           throws java.io.IOException
        Read the contents of the InputStream and return them as a String.
        Parameters:
        inputStream - input stream
        Returns:
        string
        Throws:
        java.io.IOException - in case of an IO error
      • executeProducingOperation

        public static sop.Ready executeProducingOperation​(@Nonnull
                                                          java.lang.Runtime runtime,
                                                          @Nonnull
                                                          java.util.List<java.lang.String> commandList,
                                                          @Nonnull
                                                          java.util.List<java.lang.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
                                                             java.lang.Runtime runtime,
                                                             @Nonnull
                                                             java.util.List<java.lang.String> commandList,
                                                             @Nonnull
                                                             java.util.List<java.lang.String> envList,
                                                             @Nonnull
                                                             java.io.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