Pular para o conteúdo principal

ASP.NET MVC samples project

The ASP.NET MVC samples project shows how to use Rest PKI together with Web PKI on a project using ASP.NET MVC 5. It is hosted on GitHub at:

https://github.com/LacunaSoftware/PkiSuiteSamples/tree/master/dotnet/mvc

Running the project

  1. Download the project or clone the repository
  2. Open the project folder (dotnet\mvc)
  3. Open the solution file (.sln) on Visual Studio
  4. Run the solution. Make sure your system allows automatic Nuget package restore (if it doesn't, manually restore the packages).

Project map

This section lists where to find the relevant parts in each feature sample on the project.

Authentication with digital certificate

PAdES signature with file already on server

PAdES signature with file uploaded by user

After the file upload (which is crudely implemented merely for demonstration purposes on the controller UploadController and view Upload/Index.cshtml) is done the control flow is the same as in the sample PAdES signature with file already on server, but with the URL parameter userfile filled.

PAdES co-signature

After the control flow of the sample PAdES signature with file already on server is completed and the link Co-sign with another certificate is clicked, the same control flow is repeated, but now with the URL parameter userfile filled.

PAdES marks

This feature is demonstrated as an optional configuration on the PAdES signature with file already on server sample which by default starts commented out. To enable it, uncomment the following line on PadesSignatureController:

signatureStarter.PdfMarks.Add(PadesVisualElements.GetPdfMark(1));
dica

Try changing the argument to the GetPdfMark(int) method to see different PDF mark configurations

The relevant code is on the class PadesVisualElements, method GetPdfMark(int).

PAdES signature without client communication

Open/validate an existing PAdES signature

Printer-friendly version

CAdES signature with file already on server

CAdES signature with file uploaded by user

After the file upload (which is crudely implemented merely for demonstration purposes on the controller UploadController and view Upload/Index.cshtml) is done the control flow is the same as in the sample CAdES signature with file already on server, but with the URL parameter userfile filled.

CAdES co-signature

After the control flow of the sample CAdES signature with file already on server is completed and the link Co-sign with another certificate is clicked, the same control flow is repeated, but now with the URL parameter cmsfile filled.

Open/validate an existing CAdES signature

XML signature of the entire document

XML signature of an element

Open/validate signatures on an existing XML file

Batch of PAdES signatures

Optimized batch of PAdES signatures

Batch of CAdES signatures

Batch of XML signatures of elements on the same document

Not yet available on this project.