Interface Signer
-
- All Known Implementing Classes:
SoDefaultSigner
public interface SignerThis is main signer interface which provides the functionalities for signing processes. It represents a bridge between signing service consumer applications and third party signing solutions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()This method should be called to finish the work with this signer instance.Signature[]getSignatures(javax.imageio.stream.ImageInputStream documentStream)Returns an array ofSignaturefound in the document given by the parameterized document stream.SigningDevicegetSigningDevice()Returns aSigningDeviceinformation provided by thisSigner.booleanisMetaInfoFieldSupported(java.lang.Class<? extends MetaInfoField> fieldType)Returns a indicator whether this signer supports givenMetaInfoFieldclass type.booleanisSigningSupportedFor(javax.imageio.stream.ImageInputStream documentStream)Returns a indicator whether this signer supports signing service for the given document stream.voidstartSigning(SignatureContext context, SignatureListener listener)This method will be called to initiate a signature retrieval.
-
-
-
Method Detail
-
close
void close()
This method should be called to finish the work with this signer instance. Within the close method theSignerinstance frees and releases all its resources.After a call of this method, it is recommended to continue signing processes with a new signer instance retrieved by a call of
SignatureServiceProvider.createSigner().The reusability of the
Signerinstance after a call to this method is not a warranted characteristic.
-
getSignatures
Signature[] getSignatures(javax.imageio.stream.ImageInputStream documentStream)
Returns an array ofSignaturefound in the document given by the parameterized document stream.- Parameters:
documentStream- The document, provided as input stream, to be analyzed for embedded signatures. The document stream have to be notnulland readable.- Returns:
- an array of found
Signatures. If the document contains noSignatures, the returned array is of length 0. Its recommend that the returned array is notnull. - Throws:
java.lang.IllegalArgumentException- if the document stream isnullor document format is unsupported
-
getSigningDevice
SigningDevice getSigningDevice()
Returns aSigningDeviceinformation provided by thisSigner. TheSigningDeviceallows to retrieve informations about the device the signer use to retrieve signatures.- Returns:
- a
SigningDeviceinstance to provide informations about the device used to retrieve the signatures.
-
startSigning
void startSigning(SignatureContext context, SignatureListener listener)
This method will be called to initiate a signature retrieval.The given
SignatureContextparameter accompanies the signature request, providing necessary informations for the signing process, like the document to sign on, signature properties and so on. Therefore theSignatureContexthave to be present, notnulland should provide the necessary informations for a signature retrieval.The
SignatureListeneris a callback mechanism to notify the calling application about signing progress and its result. For detailed informations see the javadoc of theSignatureListenerinterface.NOTE:
Implementations of this method will be blocking until the signing processes has been finished.- Parameters:
context- theSignatureContextproviding necessary informations for the signing processlistener- aSignatureListenerto be notified about the signing process and to get informations about the signing result.- Throws:
java.lang.IllegalArgumentException- if theSignatureContextparameter isnullor does not provide the informations need to start a signing request.java.lang.IllegalStateException- if the signer implementation could not start the signing process due to an invalid or illegal state, e.g. the signing pad is not available.
-
isMetaInfoFieldSupported
boolean isMetaInfoFieldSupported(java.lang.Class<? extends MetaInfoField> fieldType)
Returns a indicator whether this signer supports givenMetaInfoFieldclass type.NOTE:
Implementations of this method will assure the following conditions:- the execution of this method will be as fast as possible.
- the returning value does not change if this method will be called twice or more times
- Parameters:
fieldType- theMetaInfoFieldclass type the support is asked for- Returns:
trueif thisMetaInfoFieldclass type is supported, otherwisefalsewill be returned.- Throws:
java.lang.IllegalArgumentException- if the parameter fieldType isnull
-
isSigningSupportedFor
boolean isSigningSupportedFor(javax.imageio.stream.ImageInputStream documentStream)
Returns a indicator whether this signer supports signing service for the given document stream.NOTE:
Implementations of this method will assure the following conditions:- the execution of this method will be as fast as possible.
- will not close the document stream.
- the returning value does not change if this method will be called twice or more times on the same document stream or content.
- Parameters:
documentStream- the document the signing support is asked for- Returns:
trueif this signer supports signing service for this document type otherwisefalsewill be returned.- Throws:
java.lang.IllegalArgumentException- if the document stream isnullor closed
-
-