1. Tag Results
digitally-signed (6)
1 - 6 of 6
How to Sign PDF Document Using C# and VB.NET in .NET PDF Library?
The Syncfusion Essential PDF is a feature rich and high-performance .NET PDF library used to create, read, and edit PDF documents programmatically without Adobe dependencies. This library also offers functionality to merge, split, stamp, forms, compress, and secure PDF files. Using this library, you can sign the PDF document from external digital signature created from various sources such as HSM, USB token, smart card, or other cloud services such as DigiSign. Digitally sign PDF document with an external signature Create a new C# console application project. Install the Syncfusion.Pdf.WinForms NuGet package as reference to your .NET framework application from NuGet.org. Include the following namespaces in the Program.cs file. C# using Syncfusion.Pdf.Parsing; using Syncfusion.Pdf.Security; using System.Security.Cryptography; using System.Security.Cryptography.Pkcs; using System.Security.Cryptography.X509Certificates;   VB.NET Imports Syncfusion.Pdf.Parsing Imports Syncfusion.Pdf.Security Imports System.Security.Cryptography Imports System.Security.Cryptography.Pkcs Imports System.Security.Cryptography.X509Certificates 4.    The following code example shows how to sign the PDF document from external signature.        C#       //Load existing PDF document PdfLoadedDocument document = new PdfLoadedDocument("PDF_Succinctly.pdf");   //Creates a digital signature PdfSignature signature = new PdfSignature(document, document.Pages[0], null, "DigitalSignature"); signature.ComputeHash += Signature_ComputeHash;   //Save the PDF document document.Save("ExternalSignature.pdf");   //Close the document. document.Close(true);   void Signature_ComputeHash(object sender, PdfSignatureEventArgs arguments) { //Get the document bytes. byte[] documentBytes = arguments.Data;   SignedCms signedCms = new SignedCms(new ContentInfo(documentBytes), detached: true); //Compute the signature using the specified digital ID file and the password. X509Certificate2 certificate = new X509Certificate2("DigitalSignatureTest.pfx", "DigitalPass123"); var cmsSigner = new CmsSigner(certificate); //Set the digest algorithm SHA256 cmsSigner.DigestAlgorithm = new Oid("2.16.840.1.101.3.4.2.1"); signedCms.ComputeSignature(cmsSigner); //Embed the encoded digital signature to the PDF document. arguments.SignedData = signedCms.Encode(); }            VB.NET        'Load existing PDF document Dim document As PdfLoadedDocument = New PdfLoadedDocument("PDF_Succinctly.pdf") 'Creates a digital signature Dim signature As PdfSignature = New PdfSignature(document, document.Pages(0), Nothing, "DigitalSignature") AddHandler signature.ComputeHash, AddressOf Signature_ComputeHash 'Save the PDF document document.Save("ExternalSignature.pdf") 'Close the document document.Close(True)   Private Sub Signature_ComputeHash(ByVal sender As Object, ByVal arguments As PdfSignatureEventArgs) 'Get the document bytes Dim documentBytes As Byte() = arguments.Data Dim signedCms As SignedCms = New SignedCms(New ContentInfo(documentBytes), detached:=True) 'Compute the signature using the specified digital ID file and the password Dim certificate As X509Certificate2 = New X509Certificate2("DigitalSignatureTest.pfx", "DigitalPass123") Dim cmsSigner = New CmsSigner(certificate) 'Set the digest algorithm SHA256 cmsSigner.DigestAlgorithm = New Oid("2.16.840.1.101.3.4.2.1") signedCms.ComputeSignature(cmsSigner) 'Embed the encoded digital signature to the PDF document arguments.SignedData = signedCms.Encode() End Sub   A complete work sample for digitally signed PDF document with an external signature can be downloaded from DigitallySignatureSample.ZIP. By executing the example, you will get the following PDF document.   Take a moment to peruse the documentation, where you will find other options like digitally sign a pdf file, digitally sign an existing pdf document ,remove the digital signature from an existing pdf document and more with code examples. Click here to explore the rich set of Syncfusion Essential PDF features. See Also: How to digitally sign an existing PDF document using C# and VB.NET How to digitally sign a PDF file in C#, VB.NET How to apply one or more digital signatures to a PDF using C# and VB.NET PDF digital signature and timestamp in .NET Note:Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.ConclusionI hope you enjoyed learning about how to Sign PDF Document Using C# and VB.NET in .Net Pdf Library.You can refer to our .Net Pdf Library feature tour page to learn about its other groundbreaking feature representations. You can also explore our Documentation to understand how to present and manipulate data.For current customers, you can check out our Flutter components on the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to explore our .Net Pdf Library.If you have any queries or require clarifications, please let us know in the comments below. You can also contact us through our support forums, Direct-Trac or feedback portal, or the feedback portal. We are always happy to assist you!  
How can I check if a Syncfusion assembly is digitally signed and time stamped?
Information of “Digitally Signed” in Syncfusion assemblies   Syncfusion assemblies are digitally signed and time stamped. This can be verified with the help of signtool.exe tool. Please see to the following article for more information. http://msdn2.microsoft.com/en-us/library/8s9b9yaz(VS.80).aspx The Sign Tool is a command-line tool that digitally signs files, verifies signatures in files, or time stamps files. The Sign Tool is a command-line tool that digitally signs, verifies signatures and time stamps files. Kindly refer the screen shot given below:
How to remove the digital signature from an existing PDF using C# and VB.NET
Syncfusion Essential® PDF is a .NET PDF library used to create, read, and edit the PDF documents. Using this library, you can remove the digital signature from an existing PDF using C# and VB.NET. Steps to remove digital signature from an existing PDF programmatically: Create a new C# console application project. Install the Syncfusion.Pdf.WinForms NuGet packages as reference to your .NET Framework application from NuGet.org. Include the following namespaces in the Program.cs file. C# using Syncfusion.Pdf.Parsing;   VB.NET Imports Syncfusion.Pdf.Parsing   Use the following code snippet to remove digital signature from an existing PDF document. C# //Loads an existing PDF document PdfLoadedDocument loadedDocument = new PdfLoadedDocument("DigitallySigned.pdf"); //Get the signature field from PdfloadedDocument form field collection PdfLoadedSignatureField signatureField = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField; //Remove signature field from PdfLoadedDocument form field collection loadedDocument.Form.Fields.Remove(signatureField); //Save the document loadedDocument.Save("DigitalSignatureRemoved.pdf"); //Close the document loadedDocument.Close(true); //This will open the PDF file so, the result will be seen in default PDF Viewer Process.Start("DigitalSignatureRemoved.pdf");   VB.NET 'Loads an existing PDF document Dim loadedDocument As New PdfLoadedDocument("DigitallySigned.pdf") 'Get the signature field from PdfloadedDocument form field collection Dim signatureField As PdfLoadedSignatureField = TryCast(loadedDocument.Form.Fields(0), PdfLoadedSignatureField) 'Remove signature field from PdfLoadedDocument form field collection loadedDocument.Form.Fields.Remove(signatureField) 'Save the document loadedDocument.Save("DigitalSignatureRemoved.pdf") 'Close the document loadedDocument.Close(True) 'This will open the PDF file so, the result will be seen in default PDF Viewer Process.Start("DigitalSignatureRemoved.pdf")   A complete working sample can be downloaded from DigitalSignatureRemovalSample.zip By executing the program, you will get the PDF document as follows. Take a moment to peruse the documentation for using digital signature in PDF, where you will find other options like support for adding digital signature to PDF, signing an existing document, and also validate the signature appearance based on signature. You can also add the signature field to a PDF document. An online sample link demonstrates how to sign a PDF document using digital signature. Refer here to explore the rich set of Syncfusion Essential® PDF features. Note:Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion® license key in your application to use the components without trail message.  
How to digitally sign PDF with certificate in Xamarin Forms?
Syncfusion Essential PDF is a .NET PDF library used to create, read, and edit PDF documents. Using this library, you can digitally sign a PDF with certificate in Xamarin Forms. Steps to digitally sign a PDF with certificate programmatically: Create a new C# Xamarin.Forms application project. Select a project template and required platforms to deploy the application. In this application, to share the portable assemblies across multiple platforms, the .NET Standard code sharing strategy has been selected. For more details about code sharing, refer here. Note:If .NET Standard is not available in the code sharing strategy, the Portable Class Library (PCL) can be selected. Install the Syncfusion.Xamarin.Pdf NuGet package as reference to your .NET Framework application from NuGet.org. Add new Forms XAML page in portable project if there is no XAML page is defined in the App class. Otherwise, proceed to the next step. To add the new XAML page, right-click the project and select Add>New Items and add a Forms XAML page from the list. Name it as MainPage. In the App class of portable project (App.cs), replace the existing constructor of App class with the following code snippet, which invokes the MainPage. C# public App () {     InitializeComponent();     //The root page of your application     MainPage = new MainPage(); }   In the MainPage.Xaml, add new button as follows.<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"              xmlns:local="clr-namespace:DigitalSignatureSample"              x:Class="DigitalSignatureSample.MainPage">     <StackLayout VerticalOptions="Center">         <Button Text="Generate Document" Clicked="OnButtonClicked" HorizontalOptions="Center"/>     </StackLayout> </ContentPage>   Include the following namespaces in the MainPage.xmal.cs file. C# using Syncfusion.Pdf; using Syncfusion.Pdf.Graphics; using Syncfusion.Pdf.Security; using Syncfusion.Drawing;   Use the following code snippet in the click event method in MainPage.Xaml.cs to digitally sign a PDF with certificate and save it in a stream. C# //Creates a new PDF document PdfDocument document = new PdfDocument(); //Adds a new page PdfPageBase page = document.Pages.Add(); PdfGraphics graphics = page.Graphics; graphics.DrawString("Signature", new PdfStandardFont(PdfFontFamily.Helvetica, 10, PdfFontStyle.Bold), PdfBrushes.Black, new PointF(10,30)); //Creates a certificate instance from PFX file with private key Stream certificateStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("DigitalSignatureSample.Assets.PDF.pfx"); PdfCertificate pdfCert = new PdfCertificate(certificateStream, "syncfusion"); //Creates a digital signature PdfSignature signature = new PdfSignature(document, page, pdfCert, "Signature"); //Sets an image Stream imageStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("DigitalSignatureSample.Assets.signature.jpg"); PdfBitmap signatureImage = new PdfBitmap(imageStream); //Sets signature information signature.Bounds = new RectangleF(new PointF(100, 30), new SizeF(100,30)); signature.ContactInfo = "johndoe@owned.us"; signature.LocationInfo = "Honolulu, Hawaii"; signature.Reason = "I am author of this document."; //Draws the signature image graphics.DrawImage(signatureImage, 100, 30,100,30); //Save the PDF document to stream MemoryStream stream = new MemoryStream(); document.Save(stream); //Closes the document document.Close(true); //Save the stream into PDF file Xamarin.Forms.DependencyService.Get<ISave>().SaveAndView("DigitalSignature.pdf", "application/pdf", stream);   Download the helper files from this link and add them into the mentioned project. These helper files saves the stream as a physical file and open the file for viewing. Compile and execute the application. This creates a digitally signed PDF document. By executing the program, you will get the PDF document as follows. Download the complete work sample from DigitalSignatureSample.zip. Take a moment to peruse the documentation, where you can find other options like adding a digital signature using stream, signing an existing document, adding a timestamp in digital signature and features like redacting PDF document and protect PDF document with code examples. Refer here to explore the rich set of Syncfusion Essential PDF features. See Also: Create a digitally signed PDF file in Windows Forms Note:Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.  Conclusion I hope you enjoyed learning about how to digitally sign PDF with certificate in Xamarin Forms.You can refer to our PDF feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to create and manipulate data.For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
How to digitally sign PDF documents using .pfx certificates in UWP
We can digitally sign PDF document using .pfx certificates with the help of PdfCertificate and PdfSignature classes and find the code snippet and sample link below. Stream inputStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("DigitalSignature.Assets.Barcode.pdf"); Stream certificateStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("DigitalSignature.Assets.PDF.pfx"); Stream imageStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("DigitalSignature.Assets.syncfusion_logo.gif");   //Loads a input pdf document. PdfLoadedDocument loadedDocument = new PdfLoadedDocument(inputStream);   //Gets the first page of the document. PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;   //Creates a certificate instance from PFX file stream with private key. PdfCertificate certificate = new PdfCertificate(certificateStream, "syncfusion");   //Creates a pdf signature using certificate.. PdfSignature signature = new PdfSignature(loadedDocument, page, certificate, "SignatureField"); signature.Bounds = new System.Drawing.RectangleF(50, 0, 100, 100); PdfImage image = PdfImage.FromStream(imageStream); page.Graphics.DrawImage(image, new System.Drawing.RectangleF(50, 0, 100, 100)); MemoryStream stream = new MemoryStream();   //Save the document in stream. loadedDocument.Save(stream);   SaveFile(stream, "output.pdf"); //Close the document loadedDocument.Close(true);     Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DigitalSignature-274645343.zip  
Check if Syncfusion assembly is digitally signed and time stamped
The Sign Tool    Syncfusion assemblies are digitally signed and time stamped. This can be verified with the help of signtool.exe tool. Please see to the following article for more information. http://msdn2.microsoft.com/en-us/library/8s9b9yaz(VS.80).aspx The Sign Tool is a command-line tool that digitally signs files, verifies signatures in files, or time stamps files. The Sign Tool is a command-line tool that digitally signs, verifies signatures and time stamps files. Kindly refer the screen shot given below:
No articles found
No articles found
1 of 1 pages (6 items)