DigestType digestType = this.getDigestTypeFromSignature(certificate.getSigAlgName());
Calendar calendar = Calendar.getInstance();
PdfReader reader = new PdfReader(data);
PdfStamper stamper = PdfStamper.createSignature(reader, outputStream, PDFSigner.PDF_SIGNATURE_VERSION, null, true);
PdfSignatureAppearance appearance = stamper.getSignatureAppearance();
appearance.setCrypto(privateKey, chain, null, PdfSignatureAppearance.SELF_SIGNED);
appearance.setContact(this.parameters.getContactInfo());
appearance.setLocation(this.parameters.getLocation());
appearance.setReason(this.parameters.getReason());
appearance.setSignDate(calendar);