Skip to content

Commit 47ff7dd

Browse files
Merge pull request #17 from SyncfusionExamples/EJDOTNETCORE-4295
EJDOTNETCORE-4295 Added sample for customized revocation validation and get LTV info
2 parents 19315aa + 5362f5a commit 47ff7dd

File tree

21 files changed

+316
-4
lines changed

21 files changed

+316
-4
lines changed

Digital Signature/Adding-a-timestamp-in-digital-signature-of-PDF/.NET/Adding-a-timestamp-in-digital-signature-of-PDF/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
//Creates a digital signature.
2222
PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
2323

24+
//Change the digital signature standard and hashing algorithm.
25+
signature.Settings.CryptographicStandard = CryptographicStandard.CADES;
26+
signature.Settings.DigestAlgorithm = DigestAlgorithm.SHA512;
27+
2428
//Sets an image for signature field.
2529
FileStream imageStream = new FileStream(Path.GetFullPath("../../../syncfusion_logo.png"), FileMode.Open, FileAccess.Read);
2630

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32901.215
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Customized-revocation-validation", "Customized-revocation-validation\Customized-revocation-validation.csproj", "{2D15430B-26B9-4B45-A05D-827810C81D67}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{2D15430B-26B9-4B45-A05D-827810C81D67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{2D15430B-26B9-4B45-A05D-827810C81D67}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{2D15430B-26B9-4B45-A05D-827810C81D67}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{2D15430B-26B9-4B45-A05D-827810C81D67}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {C47797F2-938A-40CA-8904-6FCF1DE918D8}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<RootNamespace>Customized_revocation_validation</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="20.3.0.60" />
13+
</ItemGroup>
14+
15+
</Project>
Binary file not shown.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Syncfusion.Pdf.Parsing;
2+
using Syncfusion.Pdf.Security;
3+
4+
5+
//Gets the stream from the document
6+
FileStream documentStream = new FileStream(Path.GetFullPath("../../../Input.pdf"), FileMode.Open, FileAccess.Read);
7+
8+
//Loads an existing signed PDF document
9+
10+
PdfLoadedDocument document = new PdfLoadedDocument(documentStream);
11+
12+
// Gets the signature field
13+
14+
PdfLoadedSignatureField signatureField = document.Form.Fields[0] as PdfLoadedSignatureField;
15+
16+
// Signature validation options
17+
18+
PdfSignatureValidationOptions options = new PdfSignatureValidationOptions();
19+
20+
// Sets the revocation type
21+
22+
options.RevocationValidationType = RevocationValidationType.Crl;
23+
24+
// Validate signature and get validation result
25+
26+
PdfSignatureValidationResult result = signatureField.ValidateSignature(options);
27+
28+
// Closes the document
29+
30+
document.Close(true);

Digital Signature/Deferred-signing-in-PDF-document/.NET/Deferred-signing-in-PDF-document/Program.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ class Program
1414

1515
static void Main(string[] args)
1616
{
17-
//Register Syncfusion license
18-
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MDAxQDMyMzAyZTMyMmUzMEpFWWZ3RUVveVJLeWJNTmpSaU5Gd0crYXpISyszcWxNcGo2QzVaRnd4aW89");
19-
2017
CreateEmptySignedPDF();
2118
DeferredSign();
2219
}
Binary file not shown.

Digital Signature/Enable-LTV-PDF-signature/.NET/Enable-LTV-PDF-signature/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616

1717
//Creates a certificate instance from PFX file with private key.
1818
FileStream certificateStream = new FileStream(Path.GetFullPath("../../../PDF.pfx"), FileMode.Open, FileAccess.Read);
19-
PdfCertificate pdfCert = new PdfCertificate(certificateStream, "syncfusion");
19+
PdfCertificate pdfCert = new PdfCertificate(certificateStream, "DigitalPass123");
2020

2121
//Creates a digital signature.
2222
PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature");
23+
signature.Settings.CryptographicStandard = CryptographicStandard.CADES;
24+
signature.Settings.DigestAlgorithm = DigestAlgorithm.SHA256;
25+
2326

2427
//Sets an image for signature field.
2528
FileStream imageStream = new FileStream(Path.GetFullPath("../../../syncfusion_logo.png"), FileMode.Open, FileAccess.Read);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32901.215
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Get-LTV-information", "Get-LTV-information\Get-LTV-information.csproj", "{A44A2258-14A3-48EC-A261-EFBBC062F4E6}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A44A2258-14A3-48EC-A261-EFBBC062F4E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A44A2258-14A3-48EC-A261-EFBBC062F4E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A44A2258-14A3-48EC-A261-EFBBC062F4E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A44A2258-14A3-48EC-A261-EFBBC062F4E6}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {325FB01E-627E-48D6-A6B5-2E12D62DBF96}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net6.0</TargetFramework>
6+
<RootNamespace>Get_LTV_information</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="20.3.0.60" />
13+
</ItemGroup>
14+
15+
</Project>

0 commit comments

Comments
 (0)