public class PadesSignatureStarter extends SignatureStarter
Note on confidentiality: the PDF to be signed is stored on the server between the first and second steps, but never unencrypted. The content is encrypted using AES-128 and the key is not stored on the server, it is instead mixed into the token that is returned and which is necessary on the second step. In other words, the server stores the PDF but is unable to read it on its own, therefore the PDF contents cannot be compromised, even in the event of a complete data leakage.
callbackArgument, certificate, certificateInfo, client, done, securityContextId, signaturePolicyId
Constructor and Description |
---|
PadesSignatureStarter(RestPkiClient client)
Create a new instance using the given RestPkiClient.
|
Modifier and Type | Method and Description |
---|---|
void |
addPdfMark(PdfMark pdfMark)
Adds a new PDF mark to the list
|
void |
setBypassMarksIfSigned(boolean bypassMarksIfSigned)
Denotes whether to bypass the PDF marks if the PDF is already signed (default true).
|
void |
setMeasurementUnits(PadesMeasurementUnits measurementUnits)
Optional, sets the unit of measurement used to edit the pdf marks and visual representations
|
void |
setPageOptimization(PadesPageOptimization pageOptimization)
Optional, sets the page size used to calculate the conversion between centimeter measurements
and PDF points.
|
void |
setPdfMarks(java.util.List<PdfMark> pdfMarks)
Optional, sets the setting to mark the pdf with the signature
|
void |
setPdfToSign(byte[] content)
Sets the PDF to be signed
|
void |
setPdfToSign(java.io.InputStream stream)
Sets the PDF to be signed
|
void |
setPdfToSign(java.nio.file.Path path)
Sets the file path of the PDF to be signed
|
void |
setPdfToSign(java.lang.String path)
Sets the file path of the PDF to be signed
|
void |
setVisualRepresentation(PadesVisualRepresentation visualRepresentation)
Optional, sets the settings for the signature's visual representation.
|
ClientSideSignatureInstructions |
start()
Performs the first step, should be called after setting the necessary parameters.
|
java.lang.String |
startWithWebPki()
Performs the first step, should be called after setting the necessary parameters.
|
getCertificateInfo, setCallbackArgument, setSecurityContext, setSignaturePolicy, setSignerCertificate
public PadesSignatureStarter(RestPkiClient client)
client
- the RestPkiClient which shall be used.public void setPdfToSign(java.io.InputStream stream) throws java.io.IOException
stream
- a pre-opened InputStream linked to the PDF that will be signed. The stream is NOT closed by this method.java.io.IOException
- if an error occurs while reading the stream.public void setPdfToSign(byte[] content)
content
- Binary content of the PDFpublic void setPdfToSign(java.lang.String path) throws java.io.IOException
path
- File path of the PDF to be signed.java.io.IOException
- if an error occurs while reading the file.public void setPdfToSign(java.nio.file.Path path) throws java.io.IOException
path
- File path of the PDF to be signed.java.io.IOException
- if an error occurs while reading the file.public void setBypassMarksIfSigned(boolean bypassMarksIfSigned)
bypassMarksIfSigned
- Chosen behaviorpublic void setPageOptimization(PadesPageOptimization pageOptimization)
pageOptimization
- Page size and orientationpublic void setMeasurementUnits(PadesMeasurementUnits measurementUnits)
measurementUnits
- Unit of Measurementpublic void setVisualRepresentation(PadesVisualRepresentation visualRepresentation)
visualRepresentation
- The visual representation's settings.public void setPdfMarks(java.util.List<PdfMark> pdfMarks)
pdfMarks
- List with PDF markspublic void addPdfMark(PdfMark pdfMark)
pdfMark
- PDF markpublic ClientSideSignatureInstructions start() throws RestException
start
in class SignatureStarter
RestException
- if an error occurs when calling REST PKIpublic java.lang.String startWithWebPki() throws RestException
startWithWebPki
in class SignatureStarter
RestException
- if an error occurs when calling REST PKI