Skip to content

Commit

Permalink
Merge branch 'develop' into devsecops
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-ivanov committed Dec 29, 2023
2 parents ed8510a + dc85516 commit 289c4f8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
));
}
}
}
7 changes: 6 additions & 1 deletion itext/itext.sign/itext/signatures/cms/CMSContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,14 @@ public virtual int GetCmsVersion() {
/// <remarks>
/// 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.
/// </p>
/// <para />
/// This field is set when adding the signerInfo.
/// </remarks>
/// <returns>
///
/// <see cref="AlgorithmIdentifier"/>
/// digest algorithm.
/// </returns>
public virtual AlgorithmIdentifier GetDigestAlgorithm() {
if (signerInfo == null) {
return null;
Expand Down
17 changes: 10 additions & 7 deletions itext/itext.sign/itext/signatures/cms/SignerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,20 @@ public virtual void SetSignatureAlgorithm(AlgorithmIdentifier algorithm) {
this.signingAlgorithm = algorithm;
}

/// <summary>
/// Value 0 when no signerIdentifier is available
/// Value 1 when signerIdentifier is of type issuerAndSerialNumber
/// Value 3 when signerIdentifier is of type subjectKeyIdentifier
/// </summary>
/// <summary>Value 0 when no signerIdentifier is available.</summary>
/// <remarks>
/// Value 0 when no signerIdentifier is available.
/// Value 1 when signerIdentifier is of type issuerAndSerialNumber.
/// Value 3 when signerIdentifier is of type subjectKeyIdentifier.
/// </remarks>
/// <returns>CMS version.</returns>
public virtual int GetCmsVersion() {
return 1;
}

/// <summary>Optional</summary>
/// <summary>Optional.</summary>
/// <remarks>
/// Optional
/// Optional.
/// <para />
/// Attributes that should be part of the signed content
/// optional, but it MUST be present if the content type of
Expand All @@ -265,6 +267,7 @@ public virtual int GetCmsVersion() {
/// digest of the content. Section 11.2 defines the message-digest
/// attribute.
/// </remarks>
/// <returns>collection of the signed attributes.</returns>
public virtual ICollection<Attribute> GetSignedAttributes() {
return JavaCollectionsUtil.UnmodifiableCollection(signedAttributes);
}
Expand Down
2 changes: 1 addition & 1 deletion port-hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0171de5c2fffc772b0f7d9107ada5624e84c9b4a
073375082c73abe6f93c8f416be40400a10cd107

0 comments on commit 289c4f8

Please sign in to comment.