@@ -217,7 +217,22 @@ public PadesTwoPhaseSigningHelper setStampingProperties(StampingProperties stamp
217217 this .stampingProperties = stampingProperties ;
218218 return this ;
219219 }
220-
220+
221+ /**
222+ * Creates CMS container compliant with PAdES level. Prepares document and placeholder for the future signature
223+ * without actual signing process.
224+ *
225+ * @param certificates certificates to be added to the CMS container
226+ * @param digestAlgorithm the algorithm to generate the digest with
227+ * @param inputDocument reader {@link PdfReader} instance to read original PDF file
228+ * @param outputStream {@link OutputStream} output stream to write the resulting PDF file into
229+ * @param signerProperties properties to be used in the signing operations
230+ *
231+ * @return prepared CMS container without signature.
232+ *
233+ * @throws IOException if an I/O error occurs.
234+ * @throws GeneralSecurityException if some problem with signature or security occur.
235+ */
221236 public CMSContainer createCMSContainerWithoutSignature (Certificate [] certificates , String digestAlgorithm ,
222237 PdfReader inputDocument , OutputStream outputStream , SignerProperties signerProperties )
223238 throws IOException , GeneralSecurityException {
@@ -248,6 +263,17 @@ public CMSContainer createCMSContainerWithoutSignature(Certificate[] certificate
248263 return cms ;
249264 }
250265
266+ /**
267+ * Follow-up step that signs prepared document with PAdES Baseline-B profile.
268+ *
269+ * @param externalSignature external signature to do the actual signing
270+ * @param inputDocument reader {@link PdfReader} instance to read prepared document
271+ * @param outputStream the output PDF
272+ * @param signatureFieldName the field to sign
273+ * @param cmsContainer the finalized CMS container (e.g. created in the first step)
274+ *
275+ * @throws Exception if some exception occur.
276+ */
251277 public void signCMSContainerWithBaselineBProfile (IExternalSignature externalSignature , PdfReader inputDocument ,
252278 OutputStream outputStream , String signatureFieldName , CMSContainer cmsContainer ) throws Exception {
253279 setSignatureAlgorithmAndSignature (externalSignature , cmsContainer );
@@ -258,7 +284,18 @@ public void signCMSContainerWithBaselineBProfile(IExternalSignature externalSign
258284 outputStream .close ();
259285 }
260286 }
261-
287+
288+ /**
289+ * Follow-up step that signs prepared document with PAdES Baseline-T profile.
290+ *
291+ * @param externalSignature external signature to do the actual signing
292+ * @param inputDocument reader {@link PdfReader} instance to read prepared document
293+ * @param outputStream the output PDF
294+ * @param signatureFieldName the field to sign
295+ * @param cmsContainer the finalized CMS container (e.g. created in the first step)
296+ *
297+ * @throws Exception if some exception occur.
298+ */
262299 public void signCMSContainerWithBaselineTProfile (IExternalSignature externalSignature , PdfReader inputDocument ,
263300 OutputStream outputStream , String signatureFieldName , CMSContainer cmsContainer ) throws Exception {
264301 byte [] signature = setSignatureAlgorithmAndSignature (externalSignature , cmsContainer );
@@ -281,7 +318,18 @@ public void signCMSContainerWithBaselineTProfile(IExternalSignature externalSign
281318 outputStream .close ();
282319 }
283320 }
284-
321+
322+ /**
323+ * Follow-up step that signs prepared document with PAdES Baseline-LT profile.
324+ *
325+ * @param externalSignature external signature to do the actual signing
326+ * @param inputDocument reader {@link PdfReader} instance to read prepared document
327+ * @param outputStream the output PDF
328+ * @param signatureFieldName the field to sign
329+ * @param cmsContainer the finalized CMS container (e.g. created in the first step)
330+ *
331+ * @throws Exception if some exception occur.
332+ */
285333 public void signCMSContainerWithBaselineLTProfile (IExternalSignature externalSignature , PdfReader inputDocument ,
286334 OutputStream outputStream , String signatureFieldName , CMSContainer cmsContainer ) throws Exception {
287335 PdfPadesSigner padesSigner = createPadesSigner (inputDocument , outputStream );
@@ -301,6 +349,17 @@ public void signCMSContainerWithBaselineLTProfile(IExternalSignature externalSig
301349 }
302350 }
303351
352+ /**
353+ * Follow-up step that signs prepared document with PAdES Baseline-LTA profile.
354+ *
355+ * @param externalSignature external signature to do the actual signing
356+ * @param inputDocument reader {@link PdfReader} instance to read prepared document
357+ * @param outputStream the output PDF
358+ * @param signatureFieldName the field to sign
359+ * @param cmsContainer the finalized CMS container (e.g. created in the first step)
360+ *
361+ * @throws Exception if some exception occur.
362+ */
304363 public void signCMSContainerWithBaselineLTAProfile (IExternalSignature externalSignature , PdfReader inputDocument ,
305364 OutputStream outputStream , String signatureFieldName , CMSContainer cmsContainer ) throws Exception {
306365 PdfPadesSigner padesSigner = createPadesSigner (inputDocument , outputStream );
0 commit comments