Package sop.external
Class ExternalSOP
- java.lang.Object
-
- sop.external.ExternalSOP
-
- All Implemented Interfaces:
sop.SOP
public class ExternalSOP extends java.lang.Object implements sop.SOPImplementation of theSOPAPI using an external SOP binary.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceExternalSOP.TempDirProviderThis 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.
-
Constructor Summary
Constructors Constructor Description ExternalSOP(java.lang.String binaryName)Instantiate anExternalSOPobject for the given binary and pass it empty environment variables, as well as a defaultExternalSOP.TempDirProvider.ExternalSOP(java.lang.String binaryName, java.util.Properties properties)Instantiate anExternalSOPobject for the given binary, and pass it the given properties as environment variables, as well as a defaultExternalSOP.TempDirProvider.ExternalSOP(java.lang.String binaryName, java.util.Properties properties, ExternalSOP.TempDirProvider tempDirProvider)Instantiate anExternalSOPobject for the given binary using the given properties and customExternalSOP.TempDirProvider.ExternalSOP(java.lang.String binaryName, ExternalSOP.TempDirProvider tempDirProvider)Instantiate anExternalSOPobject for the given binary and the givenExternalSOP.TempDirProviderusing empty environment variables.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description sop.operation.Armorarmor()sop.operation.Dearmordearmor()sop.operation.Decryptdecrypt()static ExternalSOP.TempDirProviderdefaultTempDirProvider()Default implementation of theExternalSOP.TempDirProviderwhich stores temporary files in the systems temp dir (Files.createTempDirectory(String, FileAttribute[])).sop.operation.DetachedSigndetachedSign()sop.operation.DetachedVerifydetachedVerify()sop.operation.Encryptencrypt()static sop.ReadyexecuteProducingOperation(java.lang.Runtime runtime, java.util.List<java.lang.String> commandList, java.util.List<java.lang.String> envList)Execute the given command on the givenRuntimewith the given list of environment variables.static sop.ReadyexecuteTransformingOperation(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.ExtractCertextractCert()static voidfinish(java.lang.Process process)sop.operation.GenerateKeygenerateKey()sop.operation.InlineDetachinlineDetach()sop.operation.InlineSigninlineSign()sop.operation.InlineVerifyinlineVerify()sop.operation.ListProfileslistProfiles()static java.util.List<java.lang.String>propertiesToEnv(java.util.Properties properties)Return all key-value pairs from the givenPropertiesobject as a list with items of the formstatic java.lang.StringreadString(java.io.InputStream inputStream)Read the contents of theInputStreamand return them as aString.sop.operation.Versionversion()
-
-
-
Constructor Detail
-
ExternalSOP
public ExternalSOP(@Nonnull java.lang.String binaryName)Instantiate anExternalSOPobject for the given binary and pass it empty environment variables, as well as a defaultExternalSOP.TempDirProvider.- Parameters:
binaryName- name / path of the SOP binary
-
ExternalSOP
public ExternalSOP(@Nonnull java.lang.String binaryName, @Nonnull java.util.Properties properties)Instantiate anExternalSOPobject for the given binary, and pass it the given properties as environment variables, as well as a defaultExternalSOP.TempDirProvider.- Parameters:
binaryName- name / path of the SOP binaryproperties- environment variables
-
ExternalSOP
public ExternalSOP(@Nonnull java.lang.String binaryName, @Nonnull ExternalSOP.TempDirProvider tempDirProvider)Instantiate anExternalSOPobject for the given binary and the givenExternalSOP.TempDirProviderusing empty environment variables.- Parameters:
binaryName- name / path of the SOP binarytempDirProvider- custom tempDirProvider
-
ExternalSOP
public ExternalSOP(@Nonnull java.lang.String binaryName, @Nonnull java.util.Properties properties, @Nonnull ExternalSOP.TempDirProvider tempDirProvider)Instantiate anExternalSOPobject for the given binary using the given properties and customExternalSOP.TempDirProvider.- Parameters:
binaryName- name / path of the SOP binaryproperties- environment variablestempDirProvider- tempDirProvider
-
-
Method Detail
-
version
public sop.operation.Version version()
- Specified by:
versionin interfacesop.SOP
-
generateKey
public sop.operation.GenerateKey generateKey()
- Specified by:
generateKeyin interfacesop.SOP
-
extractCert
public sop.operation.ExtractCert extractCert()
- Specified by:
extractCertin interfacesop.SOP
-
detachedSign
public sop.operation.DetachedSign detachedSign()
- Specified by:
detachedSignin interfacesop.SOP
-
inlineSign
public sop.operation.InlineSign inlineSign()
- Specified by:
inlineSignin interfacesop.SOP
-
detachedVerify
public sop.operation.DetachedVerify detachedVerify()
- Specified by:
detachedVerifyin interfacesop.SOP
-
inlineVerify
public sop.operation.InlineVerify inlineVerify()
- Specified by:
inlineVerifyin interfacesop.SOP
-
inlineDetach
public sop.operation.InlineDetach inlineDetach()
- Specified by:
inlineDetachin interfacesop.SOP
-
encrypt
public sop.operation.Encrypt encrypt()
- Specified by:
encryptin interfacesop.SOP
-
decrypt
public sop.operation.Decrypt decrypt()
- Specified by:
decryptin interfacesop.SOP
-
armor
public sop.operation.Armor armor()
- Specified by:
armorin interfacesop.SOP
-
listProfiles
public sop.operation.ListProfiles listProfiles()
- Specified by:
listProfilesin interfacesop.SOP
-
dearmor
public sop.operation.Dearmor dearmor()
- Specified by:
dearmorin interfacesop.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 givenPropertiesobject as a list with items of the formkey=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.IOExceptionRead the contents of theInputStreamand return them as aString.- 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 givenRuntimewith the given list of environment variables. This command does not transform any input data, and instead is purely a producer.- Parameters:
runtime- runtimecommandList- commandenvList- 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- runtimecommandList- commandenvList- environment variablesstandardIn- stream of input data for the process- Returns:
- ready to read the result from
-
defaultTempDirProvider
public static ExternalSOP.TempDirProvider defaultTempDirProvider()
Default implementation of theExternalSOP.TempDirProviderwhich stores temporary files in the systems temp dir (Files.createTempDirectory(String, FileAttribute[])).- Returns:
- default implementation
-
-