Interface EGIZSignatureHandler.Factory

    • Method Detail

      • setLogo

        void setLogo​(PDFImage logo)
        Set the logo to be displayed on the stamp
      • setCertificateSizes

        void setCertificateSizes​(int[] sizes)
        Set the size in bytes of each X.509 certificate that will be stored. For example, to store 1 x 1500byte cert, pass in "new int[] { 1500 }"
      • getMethod

        String getMethod()
        Get the "method" field of the signature, eg "urn:pdfsigfilter:bka.gv.at:binaer:v1.1.0";
      • populateCanvas

        void populateCanvas​(PDFCanvas canvas,
                            int width,
                            int height,
                            EGIZSignatureHandler handler)
        Populate the supplied canvas with the signature appearance. This method should return a new PDFCanvas of the specified size, containing text or images representing the signature. Tokens must be inserted into the canvas to indicate the location of the signature date, value, issuer, method and so on. These tokens can be created using the createToken() method of the handler property.
        Parameters:
        canvas - the Canvas
        width - the width of the canvas in points
        height - the height of the canvas in points
        handler - the SignatureHandler this canvas is being created for
      • setPage

        void setPage​(PDFPage page,
                     int x1,
                     int y1,
                     int x2,
                     int y2)
        Set the page and size of the stamp that will be added by the signature
        Parameters:
        page - the PDFPage to stamp
        x1 - the first X coordinate
        y1 - the first Y coordinate
        x2 - the second X coordinate
        y2 - the second Y coordinate
      • doSign

        void doSign​(EGIZSignatureHandler handler,
                    MessageDigest digest)
             throws IOException,
                    GeneralSecurityException,
                    CertificateException
        Do the actual signing. When this method is called, the "digest" has been updated with the bytes from the PDF. This method should do the following:
         1. Create the signature somehow, then
        
         2. Call "handler.setSignatureValue(data)" where "data" is a byte array containing
            the "Signaturwert" fields. This value will be base64 encoded by the handler.
         3. Call "handler.setSignerInfo(info)" where info is a String containing the value of the
            "Unterzeichner" field. The value may contain a "\n" to control where the line is split.
         4. Call "handler.setIssuerInfo(info)" where info is a String containing the value of the
            "Aussteller-Zertifikat" field. The value may contain a "\n" to control where the line
            is split.
         5. Call "handler.setCertificates(certs)" where "certs" is an array of
            javax.security.certs.X509Certificate.
         6. Call "handler.setSignDate(date)" where "date" is a java.util.Calendar
         7. Call "handler.setSerialNumber(num)" where "num" is a java.math.BigInteger
         8. Call "handler.setParameter(val)" where "val" is a String.
         
        The setNNN method calls can be made in any order.
        Throws:
        IOException
        GeneralSecurityException
        CertificateException