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 Detail

      • close

        void close()
        This method should be called to finish the work with this signer instance. Within the close method the Signer 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 of Signature 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 not null and readable.
        Returns:
        an array of found Signatures. If the document contains no Signatures, the returned array is of length 0. Its recommend that the returned array is not null.
        Throws:
        java.lang.IllegalArgumentException - if the document stream is null or document format is unsupported
      • getSigningDevice

        SigningDevice getSigningDevice()
        Returns a SigningDevice information provided by this Signer. The SigningDevice 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 the SignatureContext have to be present, not null 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 the SignatureListener interface.

        NOTE:
        Implementations of this method will be blocking until the signing processes has been finished.

        Parameters:
        context - the SignatureContext providing necessary informations for the signing process
        listener - a SignatureListener to be notified about the signing process and to get informations about the signing result.
        Throws:
        java.lang.IllegalArgumentException - if the SignatureContext parameter is null 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 given MetaInfoField 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 - the MetaInfoField class type the support is asked for
        Returns:
        true if this MetaInfoField class type is supported, otherwise false will be returned.
        Throws:
        java.lang.IllegalArgumentException - if the parameter fieldType is null
      • 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 otherwise false will be returned.
        Throws:
        java.lang.IllegalArgumentException - if the document stream is null or closed