From eaf084c24dbd477f1180c037aae89e48af443396 Mon Sep 17 00:00:00 2001 From: Alexander Pliushchou Date: Wed, 27 Dec 2023 07:55:54 +0000 Subject: [PATCH 1/2] add test for double increment update DEVSIX-1686 Autoported commit. Original commit hash: [22b636b99] --- .../kernel/pdf/XrefStreamDocumentUpdatesTest.cs | 15 +++++++++++++++ port-hash | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/itext.tests/itext.kernel.tests/itext/kernel/pdf/XrefStreamDocumentUpdatesTest.cs b/itext.tests/itext.kernel.tests/itext/kernel/pdf/XrefStreamDocumentUpdatesTest.cs index 0107ef5bf3..0e1525787f 100644 --- a/itext.tests/itext.kernel.tests/itext/kernel/pdf/XrefStreamDocumentUpdatesTest.cs +++ b/itext.tests/itext.kernel.tests/itext/kernel/pdf/XrefStreamDocumentUpdatesTest.cs @@ -221,5 +221,20 @@ public virtual void CloseDocumentWithoutModificationsTest() { doc.Close(); NUnit.Framework.Assert.AreEqual(1, xrefTableCounter); } + + [NUnit.Framework.Test] + public virtual void HybridReferenceIncrementTwiceTest() { + String inFileName = sourceFolder + "hybridReferenceDocument.pdf"; + String outFileName = destinationFolder + "hybridReferenceDocumentUpdateTwice.pdf"; + PdfDocument pdfDoc1 = new PdfDocument(new PdfReader(inFileName), new PdfWriter(destinationFolder + "hybridReferenceDocumentUpdate.pdf" + ), new StampingProperties().UseAppendMode()); + pdfDoc1.Close(); + PdfDocument pdfDoc2 = new PdfDocument(new PdfReader(destinationFolder + "hybridReferenceDocumentUpdate.pdf" + ), CompareTool.CreateTestPdfWriter(outFileName), new StampingProperties().UseAppendMode()); + pdfDoc2.Close(); + //if document processed correctly, no errors should occur + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, inFileName, destinationFolder + )); + } } } diff --git a/port-hash b/port-hash index 1800e31a6b..bd20359a10 100644 --- a/port-hash +++ b/port-hash @@ -1 +1 @@ -0171de5c2fffc772b0f7d9107ada5624e84c9b4a +22b636b9983d9119521f8ad3c1152dacddb9e2bd From dc85516848cdf4a42e28c727fdf5fc307044a9f6 Mon Sep 17 00:00:00 2001 From: Angelina Pavlovets Date: Wed, 27 Dec 2023 14:32:28 +0000 Subject: [PATCH 2/2] Fix javadocs warnings DEVSIX-7842 Autoported commit. Original commit hash: [073375082] --- .../itext/signatures/cms/CMSContainer.cs | 7 ++++++- .../itext/signatures/cms/SignerInfo.cs | 17 ++++++++++------- port-hash | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/itext/itext.sign/itext/signatures/cms/CMSContainer.cs b/itext/itext.sign/itext/signatures/cms/CMSContainer.cs index fa64e569f7..800dc3fd60 100644 --- a/itext/itext.sign/itext/signatures/cms/CMSContainer.cs +++ b/itext/itext.sign/itext/signatures/cms/CMSContainer.cs @@ -133,9 +133,14 @@ public virtual int GetCmsVersion() { /// /// The digest algorithm OID and parameters used by the signer. /// This class only supports one signer for use in pdf signatures, so only one digest algorithm is supported. - ///

+ /// /// This field is set when adding the signerInfo. ///
+ /// + /// + /// + /// digest algorithm. + /// public virtual AlgorithmIdentifier GetDigestAlgorithm() { if (signerInfo == null) { return null; diff --git a/itext/itext.sign/itext/signatures/cms/SignerInfo.cs b/itext/itext.sign/itext/signatures/cms/SignerInfo.cs index 3f470ba943..3840f06ccd 100644 --- a/itext/itext.sign/itext/signatures/cms/SignerInfo.cs +++ b/itext/itext.sign/itext/signatures/cms/SignerInfo.cs @@ -237,18 +237,20 @@ public virtual void SetSignatureAlgorithm(AlgorithmIdentifier algorithm) { this.signingAlgorithm = algorithm; } - /// - /// Value 0 when no signerIdentifier is available - /// Value 1 when signerIdentifier is of type issuerAndSerialNumber - /// Value 3 when signerIdentifier is of type subjectKeyIdentifier - /// + /// Value 0 when no signerIdentifier is available. + /// + /// Value 0 when no signerIdentifier is available. + /// Value 1 when signerIdentifier is of type issuerAndSerialNumber. + /// Value 3 when signerIdentifier is of type subjectKeyIdentifier. + /// + /// CMS version. public virtual int GetCmsVersion() { return 1; } - /// Optional + /// Optional. /// - /// Optional + /// Optional. /// /// Attributes that should be part of the signed content /// optional, but it MUST be present if the content type of @@ -265,6 +267,7 @@ public virtual int GetCmsVersion() { /// digest of the content. Section 11.2 defines the message-digest /// attribute. /// + /// collection of the signed attributes. public virtual ICollection GetSignedAttributes() { return JavaCollectionsUtil.UnmodifiableCollection(signedAttributes); } diff --git a/port-hash b/port-hash index bd20359a10..f04abfa73d 100644 --- a/port-hash +++ b/port-hash @@ -1 +1 @@ -22b636b9983d9119521f8ad3c1152dacddb9e2bd +073375082c73abe6f93c8f416be40400a10cd107