Package sop.external
Class ExternalSOP
java.lang.Object
sop.external.ExternalSOP
- All Implemented Interfaces:
sop.SOP
Implementation of the
SOP API using an external SOP binary.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThis 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
ConstructorsConstructorDescriptionExternalSOP(String binaryName) Instantiate anExternalSOPobject for the given binary and pass it empty environment variables, as well as a defaultExternalSOP.TempDirProvider.ExternalSOP(String binaryName, Properties properties) Instantiate anExternalSOPobject for the given binary, and pass it the given properties as environment variables, as well as a defaultExternalSOP.TempDirProvider.ExternalSOP(String binaryName, Properties properties, ExternalSOP.TempDirProvider tempDirProvider) Instantiate anExternalSOPobject for the given binary using the given properties and customExternalSOP.TempDirProvider.ExternalSOP(String binaryName, ExternalSOP.TempDirProvider tempDirProvider) Instantiate anExternalSOPobject for the given binary and the givenExternalSOP.TempDirProviderusing empty environment variables. -
Method Summary
Modifier and TypeMethodDescriptionsop.operation.Armorarmor()sop.operation.ChangeKeyPasswordsop.operation.Dearmordearmor()sop.operation.Decryptdecrypt()static ExternalSOP.TempDirProviderDefault implementation of theExternalSOP.TempDirProviderwhich stores temporary files in the systems temp dir (Files.createTempDirectory(String, FileAttribute[])).sop.operation.DetachedSignsop.operation.DetachedVerifysop.operation.Encryptencrypt()static sop.ReadyExecute the given command on the givenRuntimewith the given list of environment variables.static sop.ReadyexecuteTransformingOperation(Runtime runtime, List<String> commandList, List<String> envList, InputStream standardIn) Execute the given command on the given runtime using the given environment variables.sop.operation.ExtractCertstatic voidsop.operation.GenerateKeysop.operation.InlineDetachsop.operation.InlineSignsop.operation.InlineVerifysop.operation.ListProfilespropertiesToEnv(Properties properties) Return all key-value pairs from the givenPropertiesobject as a list with items of the formstatic StringreadString(InputStream inputStream) Read the contents of theInputStreamand return them as aString.sop.operation.RevokeKeysop.operation.Versionversion()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface sop.SOP
sign, verify
-
Constructor Details
-
ExternalSOP
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
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 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 String binaryName, @Nonnull 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 Details
-
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
-
revokeKey
public sop.operation.RevokeKey revokeKey()- Specified by:
revokeKeyin interfacesop.SOP
-
changeKeyPassword
public sop.operation.ChangeKeyPassword changeKeyPassword()- Specified by:
changeKeyPasswordin interfacesop.SOP
-
dearmor
public sop.operation.Dearmor dearmor()- Specified by:
dearmorin interfacesop.SOP
-
finish
- Throws:
IOException
-
propertiesToEnv
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
Read the contents of theInputStreamand return them as aString.- 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 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 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- runtimecommandList- commandenvList- environment variablesstandardIn- stream of input data for the process- Returns:
- ready to read the result from
-
defaultTempDirProvider
Default implementation of theExternalSOP.TempDirProviderwhich stores temporary files in the systems temp dir (Files.createTempDirectory(String, FileAttribute[])).- Returns:
- default implementation
-