48 lines
2.5 KiB
C#
48 lines
2.5 KiB
C#
using EnvelopeGenerator.Application.Common.Dto;
|
|
|
|
namespace EnvelopeGenerator.Application.Common.Interfaces.Services;
|
|
|
|
/// <summary>
|
|
/// Defines PDF digital-signing operations for the application boundary.
|
|
/// </summary>
|
|
public interface IPdfDigitalSignatureService
|
|
{
|
|
/// <summary>
|
|
/// Creates a digital signature for the provided PDF bytes and returns
|
|
/// a new signed PDF document.
|
|
/// </summary>
|
|
/// <param name="pdfBytes">Source PDF content as a byte array.</param>
|
|
/// <param name="options">Optional signing options that map to PDF signature metadata fields.</param>
|
|
/// <param name="cancellationToken">Cancellation token for cooperative cancellation.</param>
|
|
/// <returns>The signed PDF as a byte array.</returns>
|
|
Task<byte[]> SignPdfAsync(byte[] pdfBytes, PdfSignOptionsDto? options = null, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Applies multiple signatures to the provided PDF in sequence and returns
|
|
/// the final signed PDF document.
|
|
/// </summary>
|
|
/// <param name="pdfBytes">Source PDF content as a byte array.</param>
|
|
/// <param name="optionsList">Ordered signing options; one signature is applied per item.</param>
|
|
/// <param name="cancellationToken">Cancellation token for cooperative cancellation.</param>
|
|
/// <returns>The signed PDF as a byte array.</returns>
|
|
Task<byte[]> SignPdfAsync(byte[] pdfBytes, IReadOnlyList<PdfSignOptionsDto> optionsList, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Checks whether the provided PDF contains signature field(s) and whether
|
|
/// those signatures are cryptographically valid.
|
|
/// </summary>
|
|
/// <param name="pdfBytes">PDF content to inspect.</param>
|
|
/// <param name="cancellationToken">Cancellation token for cooperative cancellation.</param>
|
|
/// <returns>A structured result containing signature presence and per-signature details.</returns>
|
|
Task<PdfSignatureCheckResultDto> CheckPdfSignatureAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Extracts the original signed revision from a signed PDF.
|
|
/// For multi-revision files this returns the first signed revision bytes.
|
|
/// </summary>
|
|
/// <param name="pdfBytes">Signed PDF bytes.</param>
|
|
/// <param name="cancellationToken">Cancellation token for cooperative cancellation.</param>
|
|
/// <returns>PDF bytes of the original signed revision.</returns>
|
|
Task<byte[]> ExtractOriginalPdfAsync(byte[] pdfBytes, CancellationToken cancellationToken = default);
|
|
}
|