Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PREVIEW changes to support external signature devices #6

Open
wants to merge 19 commits into
base: signature-feature
Choose a base branch
from

Conversation

Havunen
Copy link

@Havunen Havunen commented Oct 30, 2024

This PR is made on top of PDFSharp 6.2 prev1 + KDS:signature-feature + Packadats incremental save

It might be easier to check the changes in my repositorys commit history due to so many files being changed here

After merging all the above branches together I had to do some changes.

@packdat 's incremental save depends on the owner of the document, which caused problems because in some places of the code it was using parameterless constructors to create pdf objects losing the reference to owner document.

I removed all those constructors to ensure the owner is not being lost:
Havunen@7bd26eb
Havunen@f9f3b08

MS security patches:
Havunen@69ff104

Added GetSize method to ISigner interface
Havunen@17d0fa9
Havunen@39741e4

I removed the need to provide certificate, because in my use case the signature is made by external card reader (SCS device) and the application does not have access to the certificate.

I changed PDFSigner to support changing filter and subfilter types, because I had to use: ETSI.CAdES.detached

I Fixed An item with the same key has already been added Key. -exception
(Havunen@7b7d5d2)

ThomasHoevel and others added 19 commits June 21, 2024 13:57
…rp-net6

# Conflicts:
#	src/Directory.Packages.props
#	src/foundation/src/PDFsharp/src/PdfSharp-gdi/PdfSharp-gdi.csproj
#	src/foundation/src/PDFsharp/src/PdfSharp-wpf/PdfSharp-wpf.csproj
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf.AcroForms/PdfAcroField.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf.AcroForms/PdfSignatureField.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf.Advanced/PdfCatalog.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf.Advanced/PdfCrossReferenceTable.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf.Annotations/IAnnotationAppearanceHandler.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf.IO/PdfReader.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf.IO/PdfWriter.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf.Signatures/DefaultSignatureAppearanceHandler.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf/PdfDictionary.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf/PdfDocument.cs
#	src/foundation/src/PDFsharp/src/PdfSharp/Pdf/PdfPage.cs
/// <param name="modified"></param>
internal void SetModified(bool modified)
{
if (Owner == null || !Owner.IsAppending || !Owner.IrefTable.FullyLoaded)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this null check should not be here otherwise the IrefTable is not updated

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if i get your point here, you mean the if (Owner == null - check ?
The code would crash without it (on the Owner.IsAppending statement)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it was added by me

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me it feels that we should ensure owner is never null rather than null check here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants