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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ''
---

If you think there is a bug in PDFsharp then please use the IssueSubmissionTemplate to make the issue replicable.
https://docs.pdfsharp.net/General/IssueReporting.html
https://docs.pdfsharp.net/General/Issue-Reporting.html

Thanks.

Expand All @@ -27,4 +27,4 @@ http://forum.pdfsharp.net/

## Steps to Reproduce the Behavior
We strongly recommend using the IssueSubmissionTemplate to make sure we can replicate the issue.
https://docs.pdfsharp.net/General/IssueReporting.html
https://docs.pdfsharp.net/General/Issue-Reporting.html
47 changes: 47 additions & 0 deletions PdfSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{18E75E2F-2
ProjectSection(SolutionItems) = preProject
src\foundation\src\PDFsharp\docs\AboutFonts.md = src\foundation\src\PDFsharp\docs\AboutFonts.md
src\foundation\src\PDFsharp\docs\AboutImages.md = src\foundation\src\PDFsharp\docs\AboutImages.md
src\foundation\src\PDFsharp\docs\Coding-Issues.md = src\foundation\src\PDFsharp\docs\Coding-Issues.md
src\foundation\src\PDFsharp\docs\GlobalStuff.md = src\foundation\src\PDFsharp\docs\GlobalStuff.md
src\foundation\src\PDFsharp\docs\Notebook.md = src\foundation\src\PDFsharp\docs\Notebook.md
src\foundation\src\PDFsharp\docs\PortingNotes.md = src\foundation\src\PDFsharp\docs\PortingNotes.md
Expand All @@ -59,6 +60,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D564E33D
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{9EB8E8CC-3BA3-4B0F-B853-5B2443C40015}"
ProjectSection(SolutionItems) = preProject
AboutLineSpacing.md = AboutLineSpacing.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MigraDoc.Tests", "src\foundation\src\MigraDoc\tests\MigraDoc.Tests\MigraDoc.Tests.csproj", "{CA022FCC-7A23-4759-8789-9FC86C805557}"
EndProject
Expand Down Expand Up @@ -191,6 +195,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PDFsharp.NuGet-wpf", "src\f
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{76BA9372-65AE-479C-AEF7-D50E6B486CEF}"
ProjectSection(SolutionItems) = preProject
docs\BeforeReleases.md = docs\BeforeReleases.md
docs\BoilerplateText.md = docs\BoilerplateText.md
docs\DevNotes.md = docs\DevNotes.md
docs\MakeNewReleaseNotes.md = docs\MakeNewReleaseNotes.md
Expand Down Expand Up @@ -252,6 +257,29 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdfSharp.Testing-gdi", "src
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdfSharp.Testing-wpf", "src\foundation\src\shared\src\PdfSharp.Testing-wpf\PdfSharp.Testing-wpf.csproj", "{1F9EE0B3-4BA1-4CE4-9301-1735732B61B6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "psf", "psf", "{D2B0EC1F-CF81-4756-B20C-9BB786A151E0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdfSharp.Cryptography", "src\foundation\src\shared\src\PdfSharp.Crytography\PdfSharp.Cryptography.csproj", "{2BA35CF7-9851-4B19-A170-0B66BE87ACE5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Signatures", "Signatures", "{8CE97B3D-BECA-436D-86EC-E053A99E3A81}"
ProjectSection(SolutionItems) = preProject
docs\Signatures\CertificateCreation.md = docs\Signatures\CertificateCreation.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "changes", "changes", "{C39DF31C-2938-4EC3-B50D-52FFA8453866}"
ProjectSection(SolutionItems) = preProject
docs\changes\v6.2.0-log.md = docs\changes\v6.2.0-log.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CopyAsLink", "src\tools\src\CopyAsLink\CopyAsLink.csproj", "{60D307AC-D7D6-4AA4-BF9F-DDC6809CBCC7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdfSharp.Shared", "src\foundation\src\shared\src\PdfSharp.Shared\PdfSharp.Shared.csproj", "{8C20115B-AA17-41A7-837D-F5CFD286DFC9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MigraDoc", "MigraDoc", "{08BB5B79-D6B5-4EEF-8D37-77FBD0F04AA6}"
ProjectSection(SolutionItems) = preProject
docs\MigraDoc\AboutLineSpacing.md = docs\MigraDoc\AboutLineSpacing.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -518,6 +546,18 @@ Global
{1F9EE0B3-4BA1-4CE4-9301-1735732B61B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F9EE0B3-4BA1-4CE4-9301-1735732B61B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F9EE0B3-4BA1-4CE4-9301-1735732B61B6}.Release|Any CPU.Build.0 = Release|Any CPU
{2BA35CF7-9851-4B19-A170-0B66BE87ACE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2BA35CF7-9851-4B19-A170-0B66BE87ACE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BA35CF7-9851-4B19-A170-0B66BE87ACE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BA35CF7-9851-4B19-A170-0B66BE87ACE5}.Release|Any CPU.Build.0 = Release|Any CPU
{60D307AC-D7D6-4AA4-BF9F-DDC6809CBCC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60D307AC-D7D6-4AA4-BF9F-DDC6809CBCC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60D307AC-D7D6-4AA4-BF9F-DDC6809CBCC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60D307AC-D7D6-4AA4-BF9F-DDC6809CBCC7}.Release|Any CPU.Build.0 = Release|Any CPU
{8C20115B-AA17-41A7-837D-F5CFD286DFC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C20115B-AA17-41A7-837D-F5CFD286DFC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C20115B-AA17-41A7-837D-F5CFD286DFC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C20115B-AA17-41A7-837D-F5CFD286DFC9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -617,6 +657,13 @@ Global
{BA039CC9-132E-4103-BB47-87C3E3398F82} = {31FE507C-F342-4DA4-9BE5-B3D2ED93E9CC}
{C7CCB288-8372-41AD-9F65-6224CE0D6358} = {DE458BB2-5942-4588-A74A-AE9CA86F284C}
{1F9EE0B3-4BA1-4CE4-9301-1735732B61B6} = {DE458BB2-5942-4588-A74A-AE9CA86F284C}
{D2B0EC1F-CF81-4756-B20C-9BB786A151E0} = {18E75E2F-2A27-408C-BC02-9B68D7F0817F}
{2BA35CF7-9851-4B19-A170-0B66BE87ACE5} = {DE458BB2-5942-4588-A74A-AE9CA86F284C}
{8CE97B3D-BECA-436D-86EC-E053A99E3A81} = {76BA9372-65AE-479C-AEF7-D50E6B486CEF}
{C39DF31C-2938-4EC3-B50D-52FFA8453866} = {76BA9372-65AE-479C-AEF7-D50E6B486CEF}
{60D307AC-D7D6-4AA4-BF9F-DDC6809CBCC7} = {CC13B431-6963-480F-8C21-1F78A220A399}
{8C20115B-AA17-41A7-837D-F5CFD286DFC9} = {DE458BB2-5942-4588-A74A-AE9CA86F284C}
{08BB5B79-D6B5-4EEF-8D37-77FBD0F04AA6} = {76BA9372-65AE-479C-AEF7-D50E6B486CEF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D5FF5562-3C79-434B-B951-B84542D01625}
Expand Down
3 changes: 3 additions & 0 deletions PdfSharp.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IO/@EntryIndexedValue">IO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IV/@EntryIndexedValue">IV</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SASL/@EntryIndexedValue">SASL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TSA/@EntryIndexedValue">TSA</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=URI/@EntryIndexedValue">URI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=URL/@EntryIndexedValue">URL</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=AESV/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ARGB/@EntryIndexedValue">True</s:Boolean>
Expand Down
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# PDFsharp & MigraDoc 6
# This is fork of PDFSharp & MigraDoc 6.2.0 Preview 1
The branch contains following changes:
- All changes from PDFSharp 6.2.0 Preview 1
- Support for multiple digital signatures https://github.com/empira/PDFsharp/pull/48
- Support for incremental saving https://github.com/KDS/PDFsharp/pull/5

Version **6.1.0**
Published **2024-05-28**
## Changes applied on top of above changesets

This is a version of the **PDFsharp** project, the main project of PDFsharp & MigraDoc 6 with updates for C# 12 and .NET 6.
- Parameterless constructors for PDF Objects were removed to avoid issues where owner document is null for incremental saving
- Fixes an exception: "fix System.ArgumentException : An item with the same key has already been added. Key"
- netstandard2.0 & .NET Framework TFMs were removed
- Added GetSize method to ISigner interface to allow pre-allocating space for digital signature
- Updated some nuget packages to include security updates

# PDFsharp & MigraDoc 6

Version **6.2.0 Preview 1**
Published **2024-08-12**

This is a preview version of the **PDFsharp** project, the main project of PDFsharp & MigraDoc 6 with updates for C# 12 and .NET 6.

PDFsharp: Copyright (c) 2005-2024 empira Software GmbH, Troisdorf (Cologne Area), Germany
MigraDoc: Copyright (c) 2001-2024 empira Software GmbH, Troisdorf (Cologne Area), Germany
Expand Down Expand Up @@ -35,7 +49,7 @@ Execute
* You need the latest .NET SDK version installed
* Please note that you need a git repository with at least one commit in order to build the PDFsharp solution.
Without a git repo with at least one commit, you will get an error message from `GitVersion.MsBuild` while building the solution.
You can set a tag to define a valid version, e.g.: `git tag v6.1.0` to make it build with a specific version number. Without tag, version 0.1.0 will be used.
You can set a tag to define a valid version, e.g.: `git tag v6.2.0` to make it build with a specific version number. Without tag, version 0.1.0 will be used.

### Central package management

Expand Down
88 changes: 66 additions & 22 deletions dev/run-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

.DESCRIPTION
The script builds the solution located in the script’s root parent folder and runs 'dotnet test' for all libraries to test, that are found via its projects.
These tests are run in the following environment, as far as available: Windows with net6, Windows with net472 and Linux/WSL (net6).
For each environment libraries not to be run (like WPF in Linux or Linux-targeting DLLs in Windows) are excluded from testing.
These tests are run in the following environment, as far as available: Windows with NET8 or NET6, Windows with NET462 and Linux/WSL (NET8 or NET6).
For each environment, libraries not to be run (like WPF in Linux or Linux-targeting DLLs in Windows) are excluded from testing.
The test results are displayed in tables per library / code base comparing the test results in the different environments.

.PARAMETER Config
Specifies the configuration to build and test the solution ("Debug" or "Release"). "Debug" is the default.

.PARAMETER Net6
Specifies whether NET6 shall be tested instead of NET8. $False is the default.

.PARAMETER SkipBuild
Specifies whether the build of the solution shall be skipped. $False is the default.

Expand All @@ -28,7 +31,7 @@

Not implemented: The test result was only found for other environments. Maybe the project is not targeting or the test is not implemented for this environment.

Not Applicable: The test library was not expected to be executed, as it is not intended to be run in this environment or as this environment is not available.
Not applicable: The test library was not expected to be executed, as it is not intended to be run in this environment or as this environment is not available.

No trx file: The test library was expected to be executed, but no trx file was found. Maybe an error occurred in this script or in the 'dotnet test' call.

Expand Down Expand Up @@ -64,15 +67,17 @@ BUG: Allow to run all tests, including GBE.

param (
[Parameter(Mandatory = $false)] [string]$Config = 'Debug',
[Parameter(Mandatory = $false)] [bool]$Net6 = $false,
[Parameter(Mandatory = $false)] [bool]$SkipBuild = $false,
[Parameter(Mandatory = $false)] [bool]$RunAllTests = $false
)

$script:SystemNameWindows = "Windows"
$script:SystemNameLinux = "Linux"
$script:SystemNameWsl = "WSL"
$script:NetName472 = "net472"
$script:NetName462 = "net462"
$script:NetName6 = "net6"
$script:NetName8 = "net8"


$script:Solution
Expand Down Expand Up @@ -173,6 +178,12 @@ function InitializeScript()
}
Write-Host

if ($script:Net6)
{
Write-Host "NET6 Tests will be run instead of NET8."
Write-Host
}

if ($script:SkipBuild)
{
Write-Host "Building solution in $script:Config build will be skipped."
Expand Down Expand Up @@ -232,6 +243,23 @@ function LoadTestDllInfos()

$testDllInfos = $dllInfos | Where-Object { $_.IsTestDll }

# If Net6 parameter is true, remove net8 DLLs.
if ($script:Net6)
{
$testDllInfos = $testDllInfos | Where-Object `
{
$_.TargetFramework.Contains("net8") -eq $false
}
}
# If Net6 parameter is false, remove net6 DLLs.
else
{
$testDllInfos = $testDllInfos | Where-Object `
{
$_.TargetFramework.Contains("net6") -eq $false
}
}

# Test-HACK: Only include explicit projects.
#$testDllInfos = $testDllInfos | Where-Object {$_.DllFileName.EndsWith("PdfSharp.Tests.dll", "OrdinalIgnoreCase") -or $_.DllFileName.EndsWith("Shared.Tests.dll", "OrdinalIgnoreCase")}

Expand All @@ -252,12 +280,12 @@ function LoadTestDllInfos()
# Set $script:TestDllInfosLinux list if running on Linux host or if tests will run in hosted WSL.
if ($script:RunOnLinuxHost -or $script:RunOnHostedWsl)
{
# Exclude WPF and GDI projects and net472 and Windows target frameworks for Linux.
# Exclude WPF and GDI projects and net462 and Windows target frameworks for Linux.
$script:TestDllInfosLinux = $testDllInfos | Where-Object `
{
$_.DllFileName.EndsWith("-gdi.dll", "OrdinalIgnoreCase") -eq $false -and `
$_.DllFileName.EndsWith("-wpf.dll", "OrdinalIgnoreCase") -eq $false -and `
$_.TargetFramework.Contains("net472") -eq $false -and `
$_.TargetFramework.Contains("net462") -eq $false -and `
$_.TargetFramework.Contains("windows") -eq $false
} | ForEach-Object { $_.PSObject.Copy() }

Expand Down Expand Up @@ -527,14 +555,17 @@ function RunTestsForSystem($testDllInfos, $systemName, $isHostedWsl)
# Gets the name of the environment for the given system and framework.
function GetEnvironmentName($systemName, $targetFramework)
{
# HACK: Some projects use net7.0 instead of net6.0, but we don’t want to differentiate this in the environment names which define the test result columns.
if ($targetFramework.Contains("net6") -or $targetFramework.Contains("net7"))
if ($script:Net6 -and $targetFramework.Contains("net6"))
{
$frameworkName = $script:NetName6
}
elseif ($targetFramework.Contains("net472"))
elseif ($script:Net6 -eq $false -and $targetFramework.Contains("net8"))
{
$frameworkName = $script:NetName8
}
elseif ($targetFramework.Contains("net462"))
{
$frameworkName = $script:NetName472
$frameworkName = $script:NetName462
}
else
{
Expand All @@ -544,9 +575,13 @@ function GetEnvironmentName($systemName, $targetFramework)
# HACK: For Linux the frameworkName shall not be shown.
if ($systemName -eq $script:SystemNameCurrentLinux)
{
if ($frameworkName -ne "net6")
if ($script:Net6 -and $frameworkName -ne "net6")
{
Write-Error ("For Linux there’s only one column supported (net6) by test script with Net6 parameter set to true.")
}
elseif ($script:Net6 -eq $false -and $frameworkName -ne "net8")
{
Write-Error ("For Linux there’s only one column supported for net6 by test script.")
Write-Error ("For Linux there’s only one column supported (net8) by test script with Net6 parameter set to false.")
}
return "$systemName"
}
Expand Down Expand Up @@ -590,12 +625,21 @@ function LoadAndShowTestResults()
Write-Host "TestResults" -ForegroundColor Green # Green color is used to make it the same conspicuity like the given green Format-Table header output.
Write-Host "==================================================" -ForegroundColor Green

if ($script:Net6)
{
$netNameX = $script:NetName6
}
else
{
$netNameX = $script:NetName8
}

# Environment names to be displayed in separate columns.
$environmentNameWindowsNet6 = GetEnvironmentName $script:SystemNameWindows $script:NetName6
$environmentNameWindowsNet472 = GetEnvironmentName $script:SystemNameWindows $script:NetName472
$environmentNameLinuxNet6 = GetEnvironmentName $script:SystemNameCurrentLinux $script:NetName6
$environmentNameWindowsNetX = GetEnvironmentName $script:SystemNameWindows $netNameX
$environmentNameWindowsNet462 = GetEnvironmentName $script:SystemNameWindows $script:NetName462
$environmentNameLinuxNetX = GetEnvironmentName $script:SystemNameCurrentLinux $netNameX

$environmentNames = @($environmentNameWindowsNet6, $environmentNameWindowsNet472, $environmentNameLinuxNet6)
$environmentNames = @($environmentNameWindowsNetX, $environmentNameWindowsNet462, $environmentNameLinuxNetX)

# Get unique GenericCodeBaseinformation for all Windows and Linux test DLLs.
$genericCodeBaseInfos = ($script:TestDllInfosWindows + $script:TestDllInfosLinux) | Select-Object -Property GenericCodeBase, GenericCodeBaseExtension, ProjectFolder -Unique
Expand All @@ -621,18 +665,18 @@ function LoadAndShowTestResults()
Width = $testColumnWidth
},
@{
Label = $firstResultColumnLeftPaddingStr + "$environmentNameWindowsNet6"
Expression = { ColorizedCellFormatExpressionResult($firstResultColumnLeftPaddingStr + $_.($environmentNameWindowsNet6)) }
Label = $firstResultColumnLeftPaddingStr + "$environmentNameWindowsNetX"
Expression = { ColorizedCellFormatExpressionResult($firstResultColumnLeftPaddingStr + $_.($environmentNameWindowsNetX)) }
Width = $firstResultColumnLeftPadding + $resultColumnWidth
},
@{
Label = "$environmentNameWindowsNet472"
Expression = { ColorizedCellFormatExpressionResult($_.($environmentNameWindowsNet472)) }
Label = "$environmentNameWindowsNet462"
Expression = { ColorizedCellFormatExpressionResult($_.($environmentNameWindowsNet462)) }
Width = $resultColumnWidth
},
@{
Label = "$environmentNameLinuxNet6"
Expression = { ColorizedCellFormatExpressionResult($_.($environmentNameLinuxNet6)) }
Label = "$environmentNameLinuxNetX"
Expression = { ColorizedCellFormatExpressionResult($_.($environmentNameLinuxNetX)) }
Width = $resultColumnWidth
}
)
Expand Down
Loading