@@ -0,0 +1,2303 @@
+/**%0A * %0A */%0Apackage org.opencps.pki;%0A%0Aimport java.security.SignatureException;%0Aimport java.security.cert.X509Certificate;%0A%0Aimport com.itextpdf.text.pdf.security.ExternalSignatureContainer;%0A%0A%0A/**%0A * @author nguyennv%0A *%0A */%0Apublic class PdfPkcs7Signer extends PdfSigner %7B%0A%0A    /**%0A     * Constructor%0A     */%0A    public PdfPkcs7Signer(String filePath, X509Certificate cert) %7B%0A        super(filePath, cert);%0A    %7D%0A    %0A    /**%0A     * Constructor%0A     */%0A    public PdfPkcs7Signer(String filePath, X509Certificate cert, String tempFilePath, String signedFilePath, boolean isVisible) %7B%0A        super(filePath, cert, tempFilePath, signedFilePath, isVisible);%0A    %7D%0A%0A    /**%0A     * (non-Javadoc)%0A     * @throws SignatureException %0A     * @see org.opencps.pki.Signer#computeHash()%0A     */%0A    @Override%0A    public byte%5B%5D computeHash() throws SignatureException %7B%0A        float llx = 36.0f;%0A        float lly = 48.0f;%0A        SignatureImage signatureImage = getSignatureGraphic();%0A        if (signatureImage != null) %7B%0A            int signatureImageWidth = signatureImage.getBufferedImage().getWidth();%0A            int signatureImageHeight = signatureImage.getBufferedImage().getHeight();%0A            float urx = llx + signatureImageWidth;%0A            float ury = lly + signatureImageHeight;%0A            return computeDigest(llx, lly, urx, ury);%0A        %7D%0A        else %7B%0A            return computeDigest(llx, lly, 144, 80);%0A        %7D%0A    %7D%0A%0A    /**%0A     * Compute hash key with corner coordinates of rectangle%0A     */%0A    @Override%0A    public byte%5B%5D computeHash(float llx, float lly, float urx, float ury) throws SignatureException %7B%0A        return computeDigest(llx, lly, urx, ury);%0A    %7D%0A%0A    /**%0A     * (non-Javadoc)%0A     * @throws SignatureException %0A     * @see org.opencps.pki.Signer#sign()%0A     */%0A    @Override%0A    public Boolean sign(byte%5B%5D signature) throws SignatureException %7B%0A        return sign(signature, getTempFilePath());%0A    %7D%0A%0A    /**%0A     * (non-Javadoc)%0A     * @throws SignatureException %0A     * @see org.opencps.pki.Signer#sign()%0A     */%0A    @Override%0A    public Boolean sign(byte%5B%5D signature, String filePath) throws SignatureException %7B%0A        ExternalSignatureContainer container = new Pksc7SignatureContainer(this, signature);%0A        return signExternal(container, filePath);%0A    %7D%0A%7D%0A

Add Pdf Pkcs7 Signer