Interface Signer
-
- All Known Implementing Classes:
SoDefaultSigner
public interface Signer
This 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 void
close()
This method should be called to finish the work with this signer instance.Signature[]
getSignatures(javax.imageio.stream.ImageInputStream documentStream)
Returns an array ofSignature
found in the document given by the parameterized document stream.SigningDevice
getSigningDevice()
Returns aSigningDevice
information provided by thisSigner
.boolean
isMetaInfoFieldSupported(java.lang.Class<? extends MetaInfoField> fieldType)
Returns a indicator whether this signer supports givenMetaInfoField
class type.boolean
isSigningSupportedFor(javax.imageio.stream.ImageInputStream documentStream)
Returns a indicator whether this signer supports signing service for the given document stream.void
startSigning(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 theSigner
instance 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
Signer
instance after a call to this method is not a warranted characteristic.
-
getSignatures
Signature[] getSignatures(javax.imageio.stream.ImageInputStream documentStream)
Returns an array ofSignature
found 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 notnull
and readable.- Returns:
- an array of found
Signature
s. If the document contains noSignature
s, the returned array is of length 0. Its recommend that the returned array is notnull
. - Throws:
java.lang.IllegalArgumentException
- if the document stream isnull
or document format is unsupported
-
getSigningDevice
SigningDevice getSigningDevice()
Returns aSigningDevice
information provided by thisSigner
. TheSigningDevice
allows to retrieve informations about the device the signer use to retrieve signatures.- Returns:
- a
SigningDevice
instance 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
SignatureContext
parameter accompanies the signature request, providing necessary informations for the signing process, like the document to sign on, signature properties and so on. Therefore theSignatureContext
have to be present, notnull
and should provide the necessary informations for a signature retrieval.The
SignatureListener
is a callback mechanism to notify the calling application about signing progress and its result. For detailed informations see the javadoc of theSignatureListener
interface.NOTE:
Implementations of this method will be blocking until the signing processes has been finished.- Parameters:
context
- theSignatureContext
providing necessary informations for the signing processlistener
- aSignatureListener
to be notified about the signing process and to get informations about the signing result.- Throws:
java.lang.IllegalArgumentException
- if theSignatureContext
parameter isnull
or 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 givenMetaInfoField
class 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
- theMetaInfoField
class type the support is asked for- Returns:
true
if thisMetaInfoField
class type is supported, otherwisefalse
will 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:
true
if this signer supports signing service for this document type otherwisefalse
will be returned.- Throws:
java.lang.IllegalArgumentException
- if the document stream isnull
or closed
-
-