public class SignatureServiceImpl extends DefaultComponent implements SignatureService
The main document is signed. If it's not already a PDF, then a PDF conversion is done.
Once signed, it can replace the main document or be stored as the first attachment. If replacing the main document, an archive of the original can be kept.
SignatureService.SigningDisposition, SignatureService.StatusWithBlob| Modifier and Type | Field and Description | 
|---|---|
protected static String | 
ALREADY_SIGNED_BY  | 
protected static String | 
FILE_CONTENT  | 
protected static String | 
FILES_FILE  | 
protected static String | 
FILES_FILES  | 
protected static String | 
MIME_TYPE_PDF  | 
protected static int | 
PAGE_TO_SIGN  | 
protected static String | 
PDFA1_PARAM
From JODBasedConverter 
 | 
protected static int | 
SIGNATURE_FIELD_HEIGHT  | 
protected static int | 
SIGNATURE_FIELD_WIDTH  | 
protected static int | 
SIGNATURE_MARGIN  | 
protected Map<String,SignatureDescriptor> | 
signatureRegistryMap  | 
protected static String | 
USER_EMAIL  | 
protected static String | 
XP_SIGNATURE  | 
lastModified| Constructor and Description | 
|---|
SignatureServiceImpl()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected boolean | 
certificatePresentInPDF(Certificate userCert,
                       List<X509Certificate> pdfCertificates)  | 
protected List<X509Certificate> | 
getCertificates(Blob pdfBlob)  | 
List<X509Certificate> | 
getCertificates(DocumentModel doc)
Returns a list of certificates associated with a given document. 
 | 
protected List<X509Certificate> | 
getCertificates(com.lowagie.text.pdf.PdfReader pdfReader)  | 
protected com.lowagie.text.Rectangle | 
getNextCertificatePosition(com.lowagie.text.pdf.PdfReader pdfReader,
                          List<X509Certificate> pdfCertificates)  | 
protected SignatureAppearanceFactory | 
getSignatureAppearanceFactory()  | 
SignatureLayout | 
getSignatureLayout()  | 
protected SignatureService.StatusWithBlob | 
getSignedPdfBlobAndStatus(DocumentModel doc,
                         DocumentModel user)
Finds the first signed PDF blob. 
 | 
protected String | 
getSigningReason()  | 
protected int | 
getSigningStatus(Blob pdfBlob,
                DocumentModel user)  | 
SignatureService.StatusWithBlob | 
getSigningStatus(DocumentModel doc,
                DocumentModel user)
Finds the signing status for the document. 
 | 
void | 
registerContribution(Object contribution,
                    String extensionPoint,
                    ComponentInstance contributor)  | 
Blob | 
signDocument(DocumentModel doc,
            DocumentModel user,
            String keyPassword,
            String reason,
            boolean pdfa,
            SignatureService.SigningDisposition disposition,
            String archiveFilename)
Signs a document with a user certificate (converts it into a PDF first if needed). 
 | 
Blob | 
signPDF(Blob pdfBlob,
       DocumentModel doc,
       DocumentModel user,
       String keyPassword,
       String reason)
Signs a PDF document with a user certificate. 
 | 
void | 
unregisterContribution(Object contribution,
                      String extensionPoint,
                      ComponentInstance contributor)  | 
protected void | 
validatePageBounds(com.lowagie.text.pdf.PdfReader pdfReader,
                  int pageNo,
                  float valueToCheck,
                  boolean isHorizontal)
Verifies that a provided value fits within the page bounds. 
 | 
activate, deactivate, getAdapter, getLastModified, registerExtension, setLastModified, setModifiedNow, start, stop, unregisterExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplicationStarted, getApplicationStartedOrderprotected static final int SIGNATURE_FIELD_HEIGHT
protected static final int SIGNATURE_FIELD_WIDTH
protected static final int SIGNATURE_MARGIN
protected static final int PAGE_TO_SIGN
protected static final String XP_SIGNATURE
protected static final String ALREADY_SIGNED_BY
protected static final String MIME_TYPE_PDF
protected static final String PDFA1_PARAM
protected static final String FILE_CONTENT
protected static final String FILES_FILES
protected static final String FILES_FILE
protected static final String USER_EMAIL
protected final Map<String,SignatureDescriptor> signatureRegistryMap
public SignatureServiceImpl()
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution in class DefaultComponentpublic void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution in class DefaultComponentpublic SignatureService.StatusWithBlob getSigningStatus(DocumentModel doc, DocumentModel user)
SignatureServiceA signature user is determined according to its email.
getSigningStatus in interface SignatureServicedoc - the documentprotected int getSigningStatus(Blob pdfBlob, DocumentModel user)
protected SignatureService.StatusWithBlob getSignedPdfBlobAndStatus(DocumentModel doc, DocumentModel user)
public Blob signDocument(DocumentModel doc, DocumentModel user, String keyPassword, String reason, boolean pdfa, SignatureService.SigningDisposition disposition, String archiveFilename)
SignatureServiceRequires a password to retrieve the certificate from the user keystore.
Does not save the modified document.
signDocument in interface SignatureServicedoc - the document to signuser - the signing userkeyPassword - the password for the user's signing certificatereason - the signing reasonpdfa - true if the generated PDF should be a PDF/A-1bdisposition - the signing dispositionarchiveFilename - the archive filename when using an archivepublic Blob signPDF(Blob pdfBlob, DocumentModel doc, DocumentModel user, String keyPassword, String reason)
SignatureServicesignPDF in interface SignatureServicepdfBlob - the blob containing the PDF to signdoc - Document model beign signeduser - the signing userkeyPassword - the password for the user's signing certificatereason - the signing reasonpublic SignatureLayout getSignatureLayout()
getSignatureLayout in interface SignatureServiceprotected SignatureAppearanceFactory getSignatureAppearanceFactory() throws InstantiationException, IllegalAccessException
protected String getSigningReason() throws SignException
SignExceptionprotected boolean certificatePresentInPDF(Certificate userCert, List<X509Certificate> pdfCertificates) throws SignException
SignExceptionprotected com.lowagie.text.Rectangle getNextCertificatePosition(com.lowagie.text.pdf.PdfReader pdfReader, List<X509Certificate> pdfCertificates) throws SignException
SignExceptionprotected void validatePageBounds(com.lowagie.text.pdf.PdfReader pdfReader, int pageNo, float valueToCheck, boolean isHorizontal) throws SignException
isHorizontal - - if false, the current value is checked agains the vertical page dimensionSignExceptionpublic List<X509Certificate> getCertificates(DocumentModel doc)
SignatureServicegetCertificates in interface SignatureServicedoc - the documentprotected List<X509Certificate> getCertificates(Blob pdfBlob) throws SignException
SignExceptionprotected List<X509Certificate> getCertificates(com.lowagie.text.pdf.PdfReader pdfReader) throws SignException
SignExceptionCopyright © 2018 Nuxeo. All rights reserved.