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
Constructor and Description |
---|
SignatureServiceImpl() |
Modifier and Type | Method and Description |
---|---|
List<X509Certificate> |
getCertificates(DocumentModel doc)
Returns a list of certificates associated with a given document.
|
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 user,
String keyPassword,
String reason)
Signs a PDF document with a user certificate.
|
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
activate, applicationStarted, deactivate, getAdapter, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, unregisterExtension
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public SignatureService.StatusWithBlob getSigningStatus(DocumentModel doc, DocumentModel user) throws ClientException
SignatureService
A signature user is determined according to its email.
getSigningStatus
in interface SignatureService
doc
- the documentClientException
public Blob signDocument(DocumentModel doc, DocumentModel user, String keyPassword, String reason, boolean pdfa, SignatureService.SigningDisposition disposition, String archiveFilename) throws ClientException
SignatureService
Requires a password to retrieve the certificate from the user keystore.
Does not save the modified document.
signDocument
in interface SignatureService
doc
- 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 archiveSignException
ConversionException
ClientException
public Blob signPDF(Blob pdfBlob, DocumentModel user, String keyPassword, String reason) throws ClientException
SignatureService
signPDF
in interface SignatureService
pdfBlob
- the blob containing the PDF to signuser
- the signing userkeyPassword
- the password for the user's signing certificatereason
- the signing reasonSignException
ClientException
public List<X509Certificate> getCertificates(DocumentModel doc) throws ClientException
SignatureService
getCertificates
in interface SignatureService
doc
- the documentClientException
Copyright © 2015 Nuxeo SA. All rights reserved.