Refactor and rename to DocumentService
Renamed namespaces and projects from DocumentOperator to DocumentService, updating all references accordingly. Refactored PdfSignatureAppearanceDto and related enums to use properties with init accessors for improved clarity. Removed and re-added IPkcs11SelfTestStatusProvider with updated namespace. Simplified dependency injection by removing DocumentOperatorApplication registration. Updated appsettings.json with a specific AssetsRootPath. Incremented version numbers in project files for a new release. Introduced PdfSignatureClient and IPdfSignatureClient for PDF digital-signing operations. Updated project files to use newer Microsoft.Extensions package versions. Removed all DocumentOperator references, completing the transition to DocumentService. Added new DTOs and enums for PDF signature options and appearance.
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
namespace DocumentOperator.Application.Common.Dto;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum PdfSignatureCoordinateUnit
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Point = 0,
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Inch = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum PdfSignatureCoordinateOrigin
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
BottomLeft = 0,
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
TopLeft = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="PageNumber"></param>
|
||||
/// <param name="Left"></param>
|
||||
/// <param name="Bottom"></param>
|
||||
/// <param name="Width"></param>
|
||||
/// <param name="Height"></param>
|
||||
/// <param name="ShowLabels"></param>
|
||||
/// <param name="ShowName"></param>
|
||||
/// <param name="ShowDate"></param>
|
||||
/// <param name="ShowReason"></param>
|
||||
/// <param name="ShowLocation"></param>
|
||||
/// <param name="ShowDistinguishedName"></param>
|
||||
/// <param name="DateTimeFormat"></param>
|
||||
/// <param name="CoordinateUnit"></param>
|
||||
/// <param name="CoordinateOrigin"></param>
|
||||
public sealed record PdfSignatureAppearanceDto(
|
||||
int PageNumber,
|
||||
double Left,
|
||||
double Bottom,
|
||||
double Width,
|
||||
double Height,
|
||||
bool ShowLabels = false,
|
||||
bool ShowName = false,
|
||||
bool ShowDate = false,
|
||||
bool ShowReason = false,
|
||||
bool ShowLocation = false,
|
||||
bool ShowDistinguishedName = false,
|
||||
string DateTimeFormat = "dd.MM.yyyy HH:mm:ss zzz",
|
||||
PdfSignatureCoordinateUnit CoordinateUnit = PdfSignatureCoordinateUnit.Point,
|
||||
PdfSignatureCoordinateOrigin CoordinateOrigin = PdfSignatureCoordinateOrigin.BottomLeft)
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="FamilyName"></param>
|
||||
/// <param name="Size"></param>
|
||||
/// <param name="IsBold"></param>
|
||||
/// <param name="IsItalic"></param>
|
||||
/// <param name="IsUnderline"></param>
|
||||
public sealed record FontDto(string FamilyName = "Helvetica", float Size = 10, bool IsBold = false, bool IsItalic = false, bool IsUnderline = false)
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public RgbaColorDto Color { get; init; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="R"></param>
|
||||
/// <param name="G"></param>
|
||||
/// <param name="B"></param>
|
||||
public sealed record RgbaColorDto(double R = 0, double G = 0, double B = 0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public FontDto Font { get; init; } = new();
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DocumentOperator.Application.Common.Dto;
|
||||
|
||||
namespace DocumentOperator.Application.Common.Interfaces.Services;
|
||||
|
||||
public interface IPkcs11SelfTestStatusProvider
|
||||
{
|
||||
Pkcs11SelfTestStatusDto GetStatus();
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DocumentOperator.Application;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
public static IServiceCollection AddDocumentOperatorApplication(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddMediatR(cfg =>
|
||||
{
|
||||
cfg.LicenseKey = configuration.GetValue<string>("LuckyPennySoftLicenseKey");
|
||||
cfg.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly);
|
||||
});
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MediatR" Version="14.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.10" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,5 +1,5 @@
|
||||
using DocumentOperator.Application.Common.Dto;
|
||||
using DocumentOperator.Application.SignPdf;
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
using DocumentService.Application.SignPdf;
|
||||
using DocumentService.Domain.Common.Exceptions;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<Authors>Digital Data GmbH</Authors>
|
||||
<Company>Digital Data GmbH</Company>
|
||||
<Product>DocumentOperator.API</Product>
|
||||
<Version>1.1.0</Version>
|
||||
<FileVersion>1.1.0.0</FileVersion>
|
||||
<AssemblyVersion>1.1.0.0</AssemblyVersion>
|
||||
<InformationalVersion>1.1.0</InformationalVersion>
|
||||
<Version>2.0.0</Version>
|
||||
<FileVersion>2.1.0.0</FileVersion>
|
||||
<AssemblyVersion>2.1.0.0</AssemblyVersion>
|
||||
<InformationalVersion>2.1.0</InformationalVersion>
|
||||
<Copyright>Copyright © 2026 Digital Data GmbH. All rights reserved.</Copyright>
|
||||
<Description>PDF Document Operations REST API - Validation, Swiss QR Code extraction, attachments, merge, annotation, stamp operations powered by DevExpress Office File API</Description>
|
||||
<PackageTags>pdf document operator validation swiss-qr-code annotations stamp devexpress</PackageTags>
|
||||
@@ -36,7 +36,6 @@
|
||||
<ProjectReference Include="..\DocumentService.Client\DocumentService.Client.csproj" />
|
||||
<ProjectReference Include="..\DocumentService.Domain\DocumentService.Domain.csproj" />
|
||||
<ProjectReference Include="..\DocumentService.Infrastructure\DocumentService.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\DocumentOperator.Application\DocumentOperator.Application.csproj" />
|
||||
<ProjectReference Include="..\DocumentService.Infrastructure.Crypt\DocumentService.Infrastructure.Crypt.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ using DocumentService.Infrastructure;
|
||||
using DocumentService.Infrastructure.Crypt.DependencyInjection;
|
||||
using DocumentService.API.Middleware;
|
||||
using DocumentService.API.Configuration;
|
||||
using DocumentOperator.Application;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -52,7 +51,6 @@ try
|
||||
// ========================================
|
||||
builder.Services.AddApplication(builder.Configuration); // Application Layer (MediatR, FluentValidation, Behaviors)
|
||||
builder.Services.AddInfrastructure(); // Infrastructure Layer (DevExpress, Services)
|
||||
builder.Services.AddDocumentOperatorApplication(builder.Configuration); // PDF signing Application (MediatR)
|
||||
builder.Services.AddCryptInfrastructure(builder.Configuration); // PKCS#11 PDF signing (DevExpress)
|
||||
|
||||
builder.Services.AddControllers(); // Controllers (Controller-based API)
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
},
|
||||
"Crypt": {
|
||||
"Pkcs11": {
|
||||
"AssetsRootPath": null,
|
||||
"AssetsRootPath": "E:\\DataFiles\\Digital Data\\DocumentService.API\\resources",
|
||||
"SlotId": 2021549410,
|
||||
"TokenLabel": "CompanyProdToken",
|
||||
"ProxySocket": "tcp://172.24.12.64:5657",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using DocumentOperator.Application.Common.Enums;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DocumentOperator.Application.Common.Configurations;
|
||||
namespace DocumentService.Application.Common.Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Represents PKCS#11 signing configuration for PDF signing workflows.
|
||||
@@ -1,6 +1,4 @@
|
||||
using DocumentOperator.Application.Common.Enums;
|
||||
|
||||
namespace DocumentOperator.Application.Common.Dto;
|
||||
namespace DocumentService.Application.Common.DTOs;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -40,7 +38,7 @@ public sealed record PdfSignOptionsDto
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ApplicationName { get; set; } = null!;
|
||||
public string? ApplicationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -0,0 +1,171 @@
|
||||
namespace DocumentService.Application.Common.DTOs;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum PdfSignatureCoordinateUnit
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Point = 0,
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
Inch = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum PdfSignatureCoordinateOrigin
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
BottomLeft = 0,
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
TopLeft = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed record PdfSignatureAppearanceDto
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int PageNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double Left { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double Bottom { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double Width { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double Height { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool ShowLabels { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool ShowName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool ShowDate { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool ShowReason { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool ShowLocation { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool ShowDistinguishedName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string DateTimeFormat { get; init; } = "dd.MM.yyyy HH:mm:ss zzz";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public PdfSignatureCoordinateUnit CoordinateUnit { get; init; } = PdfSignatureCoordinateUnit.Point;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public PdfSignatureCoordinateOrigin CoordinateOrigin { get; init; } = PdfSignatureCoordinateOrigin.BottomLeft;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public FontDto Font { get; init; } = new();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed record FontDto
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string FamilyName { get; init; } = "Helvetica";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public float Size { get; init; } = 10;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool IsBold { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool IsItalic { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool IsUnderline { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public RgbaColorDto Color { get; init; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public sealed record RgbaColorDto
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double R { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double G { get; init; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double B { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace DocumentOperator.Application.Common.Enums;
|
||||
namespace DocumentService.Application.Common.DTOs;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace DocumentOperator.Application.Common.Dto;
|
||||
namespace DocumentService.Application.Common.DTOs;
|
||||
|
||||
public sealed record PdfSignaturePrincipalDto(
|
||||
string? CommonName,
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace DocumentOperator.Application.Common.Dto;
|
||||
namespace DocumentService.Application.Common.DTOs;
|
||||
|
||||
public sealed record Pkcs11SelfTestStatusDto(
|
||||
bool Completed,
|
||||
@@ -1,6 +1,6 @@
|
||||
using DocumentOperator.Application.Common.Dto;
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
|
||||
namespace DocumentOperator.Application.Common.Interfaces.Services;
|
||||
namespace DocumentService.Application.Common.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Defines PDF digital-signing operations for the application boundary.
|
||||
@@ -0,0 +1,8 @@
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
|
||||
namespace DocumentService.Application.Common.Interfaces;
|
||||
|
||||
public interface IPkcs11SelfTestStatusProvider
|
||||
{
|
||||
Pkcs11SelfTestStatusDto GetStatus();
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using DocumentOperator.Application.Common.Dto;
|
||||
using DocumentOperator.Application.Common.Interfaces.Services;
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
using DocumentService.Application.Common.Interfaces;
|
||||
using MediatR;
|
||||
|
||||
namespace DocumentOperator.Application.SignPdf;
|
||||
namespace DocumentService.Application.SignPdf;
|
||||
|
||||
public sealed record SignPdfCommand : IRequest<byte[]>
|
||||
{
|
||||
@@ -90,6 +90,8 @@ public static class Client
|
||||
|
||||
public static IZugferdClient Zugferd => GetRequiredServiceOfScope<IZugferdClient>();
|
||||
|
||||
public static IPdfSignatureClient Signature => GetRequiredServiceOfScope<IPdfSignatureClient>();
|
||||
|
||||
public static IWorkflowsClient Workflows => GetRequiredServiceOfScope<IWorkflowsClient>();
|
||||
#endregion
|
||||
}
|
||||
|
||||
25
DocumentService.Client/Clients/PdfSignatureClient.cs
Normal file
25
DocumentService.Client/Clients/PdfSignatureClient.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using DocumentService.Client.Interfaces;
|
||||
using DocumentService.Client.Models.Requests;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace DocumentService.Client.Clients;
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of the PDF digital-signing client.
|
||||
/// </summary>
|
||||
public class PdfSignatureClient(HttpClient httpClient, ILogger<PdfSignatureClient> logger) : BaseDocumentClient(httpClient, logger), IPdfSignatureClient
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public async Task<Stream> SignAsync(byte[] pdfBytes, SignPdfOptions options, byte[]? signatureImageBytes = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var request = new SignPdfRequest
|
||||
{
|
||||
Base64Pdf = ToBase64(pdfBytes),
|
||||
Base64SignatureImage = signatureImageBytes is null ? null : ToBase64(signatureImageBytes),
|
||||
Options = options
|
||||
};
|
||||
|
||||
return await SendJsonForStreamAsync("/api/pdf/signature/sign", request, cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net462;net480;net8.0</TargetFrameworks>
|
||||
@@ -11,9 +11,9 @@
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
<RepositoryUrl>http://git.dd:3000/AppStd/Rec.git</RepositoryUrl>
|
||||
<PackageTags>digital data document service api client</PackageTags>
|
||||
<Version>1.2.2</Version>
|
||||
<AssemblyVersion>1.2.2.0</AssemblyVersion>
|
||||
<FileVersion>1.2.2.0</FileVersion>
|
||||
<Version>1.3.2</Version>
|
||||
<AssemblyVersion>1.3.2.0</AssemblyVersion>
|
||||
<FileVersion>1.3.2.0</FileVersion>
|
||||
<Description></Description>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@@ -53,6 +53,9 @@ public static class ServiceCollectionExtensions
|
||||
services.AddHttpClient<IZugferdClient, ZugferdClient>(ConfigureClient)
|
||||
.ConfigurePrimaryHttpMessageHandler(configureHandler);
|
||||
|
||||
services.AddHttpClient<IPdfSignatureClient, PdfSignatureClient>(ConfigureClient)
|
||||
.ConfigurePrimaryHttpMessageHandler(configureHandler);
|
||||
|
||||
// Conversion client is registered but all methods throw NotImplementedException
|
||||
// until the server-side endpoints are ready.
|
||||
services.AddHttpClient<IPdfConversionClient, PdfConversionClient>(ConfigureClient)
|
||||
|
||||
19
DocumentService.Client/Interfaces/IPdfSignatureClient.cs
Normal file
19
DocumentService.Client/Interfaces/IPdfSignatureClient.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using DocumentService.Client.Models.Requests;
|
||||
|
||||
namespace DocumentService.Client.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Client for PDF digital signing.
|
||||
/// </summary>
|
||||
public interface IPdfSignatureClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Digitally signs a PDF (Base64 JSON).
|
||||
/// </summary>
|
||||
/// <param name="pdfBytes">PDF to sign</param>
|
||||
/// <param name="options">Signing options (metadata + appearance)</param>
|
||||
/// <param name="signatureImageBytes">Optional signature image (PNG/JPEG)</param>
|
||||
/// <param name="cancellationToken">Cancellation token</param>
|
||||
/// <returns>Signed PDF as stream</returns>
|
||||
Task<Stream> SignAsync(byte[] pdfBytes, SignPdfOptions options, byte[]? signatureImageBytes = null, CancellationToken cancellationToken = default);
|
||||
}
|
||||
190
DocumentService.Client/Models/Requests/SignPdfRequest.cs
Normal file
190
DocumentService.Client/Models/Requests/SignPdfRequest.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
namespace DocumentService.Client.Models.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Request DTO for the PDF digital-signing endpoint (JSON payload).
|
||||
/// </summary>
|
||||
public sealed record SignPdfRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Base64-encoded PDF to sign.
|
||||
/// </summary>
|
||||
public required string Base64Pdf { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional Base64-encoded signature image (PNG/JPEG).
|
||||
/// </summary>
|
||||
public string? Base64SignatureImage { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Signing options (metadata + appearance).
|
||||
/// </summary>
|
||||
public required SignPdfOptions Options { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Signing metadata and appearance options.
|
||||
/// </summary>
|
||||
public sealed record SignPdfOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Document element id embedded into the signature metadata.
|
||||
/// </summary>
|
||||
public long DocumentElementId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Signer name.
|
||||
/// </summary>
|
||||
public required string Name { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Signing reason.
|
||||
/// </summary>
|
||||
public string? Reason { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Signing location.
|
||||
/// </summary>
|
||||
public string? Location { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Signer email (optional contact info).
|
||||
/// </summary>
|
||||
public string? Email { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Signer phone (optional contact info).
|
||||
/// </summary>
|
||||
public string? Phone { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Application name embedded into the signature metadata.
|
||||
/// </summary>
|
||||
public string? ApplicationName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Certification level applied to the signature.
|
||||
/// </summary>
|
||||
public PdfSignatureCertificationLevel CertificationLevel { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional visual appearance of the signature field.
|
||||
/// </summary>
|
||||
public PdfSignatureAppearance? Appearance { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Visual appearance of the signature field.
|
||||
/// </summary>
|
||||
public sealed record PdfSignatureAppearance
|
||||
{
|
||||
/// <summary>
|
||||
/// Page number (1-based) where the signature is placed.
|
||||
/// </summary>
|
||||
public int PageNumber { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Left bound of the signature field.
|
||||
/// </summary>
|
||||
public double Left { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Bottom bound of the signature field.
|
||||
/// </summary>
|
||||
public double Bottom { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Width of the signature field.
|
||||
/// </summary>
|
||||
public double Width { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Height of the signature field.
|
||||
/// </summary>
|
||||
public double Height { get; init; }
|
||||
|
||||
public bool ShowLabels { get; init; }
|
||||
public bool ShowName { get; init; }
|
||||
public bool ShowDate { get; init; }
|
||||
public bool ShowReason { get; init; }
|
||||
public bool ShowLocation { get; init; }
|
||||
public bool ShowDistinguishedName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Date/time format used in the signature appearance.
|
||||
/// </summary>
|
||||
public string DateTimeFormat { get; init; } = "dd.MM.yyyy HH:mm:ss zzz";
|
||||
|
||||
/// <summary>
|
||||
/// Coordinate unit of the signature bounds.
|
||||
/// </summary>
|
||||
public PdfSignatureCoordinateUnit CoordinateUnit { get; init; } = PdfSignatureCoordinateUnit.Point;
|
||||
|
||||
/// <summary>
|
||||
/// Coordinate origin of the signature bounds.
|
||||
/// </summary>
|
||||
public PdfSignatureCoordinateOrigin CoordinateOrigin { get; init; } = PdfSignatureCoordinateOrigin.BottomLeft;
|
||||
|
||||
/// <summary>
|
||||
/// Font settings of the signature appearance.
|
||||
/// </summary>
|
||||
public PdfSignatureFont Font { get; init; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Font settings of the signature appearance.
|
||||
/// </summary>
|
||||
public sealed record PdfSignatureFont
|
||||
{
|
||||
public string FamilyName { get; init; } = "Helvetica";
|
||||
public float Size { get; init; } = 10;
|
||||
public bool IsBold { get; init; }
|
||||
public bool IsItalic { get; init; }
|
||||
public bool IsUnderline { get; init; }
|
||||
public PdfSignatureColor Color { get; init; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RGB color (0-255 channels) of the signature appearance font.
|
||||
/// </summary>
|
||||
public sealed record PdfSignatureColor
|
||||
{
|
||||
public double R { get; init; }
|
||||
public double G { get; init; }
|
||||
public double B { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Certification level of the PDF signature.
|
||||
/// </summary>
|
||||
public enum PdfSignatureCertificationLevel
|
||||
{
|
||||
/// <summary>All changes are allowed.</summary>
|
||||
NoCertification = 0,
|
||||
|
||||
/// <summary>No changes are allowed.</summary>
|
||||
NoChangesAllowed,
|
||||
|
||||
/// <summary>Allows form filling and signing.</summary>
|
||||
FillForms,
|
||||
|
||||
/// <summary>Allows form filling, annotation and signing.</summary>
|
||||
FillFormsAndAnnotate
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coordinate unit of the signature bounds.
|
||||
/// </summary>
|
||||
public enum PdfSignatureCoordinateUnit
|
||||
{
|
||||
Point = 0,
|
||||
Inch = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Coordinate origin of the signature bounds.
|
||||
/// </summary>
|
||||
public enum PdfSignatureCoordinateOrigin
|
||||
{
|
||||
BottomLeft = 0,
|
||||
TopLeft = 1
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using DocumentOperator.Application.Common.Configurations;
|
||||
using DocumentOperator.Application.Common.Interfaces.Services;
|
||||
using DocumentService.Application.Common.Configuration;
|
||||
using DocumentService.Application.Common.Interfaces;
|
||||
using DocumentService.Infrastructure.Crypt.Services;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
<PackageReference Include="DevExpress.Document.Processor" Version="26.1.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.0.6" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="9.0.6" />
|
||||
<PackageReference Include="Pkcs11Interop" Version="5.3.0" />
|
||||
@@ -29,7 +29,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DocumentOperator.Application\DocumentOperator.Application.csproj" />
|
||||
<ProjectReference Include="..\DocumentService.Application\DocumentService.Application.csproj" />
|
||||
<ProjectReference Include="..\DocumentService.Domain\DocumentService.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DevExpress.Pdf;
|
||||
using DocumentOperator.Application.Common.Enums;
|
||||
using DevExpress.Pdf;
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
|
||||
namespace DocumentService.Infrastructure.Crypt.Helper;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using DevExpress.Office.DigitalSignatures;
|
||||
using DevExpress.Pdf;
|
||||
using DocumentService.Domain.Common.Exceptions;
|
||||
using DocumentOperator.Application.Common.Configurations;
|
||||
using DocumentOperator.Application.Common.Dto;
|
||||
using DocumentOperator.Application.Common.Interfaces.Services;
|
||||
using DocumentService.Application.Common.Configuration;
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
using DocumentService.Application.Common.Interfaces;
|
||||
using DocumentService.Infrastructure.Crypt.Helper;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Formats.Asn1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DocumentOperator.Application.Common.Configurations;
|
||||
using DocumentService.Application.Common.Configuration;
|
||||
using DevExpress.Office.DigitalSignatures;
|
||||
using DevExpress.Pdf;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DocumentOperator.Application.Common.Configurations;
|
||||
using DocumentService.Application.Common.Configuration;
|
||||
|
||||
namespace DocumentService.Infrastructure.Crypt.Services;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DocumentOperator.Application.Common.Configurations;
|
||||
using DocumentService.Application.Common.Configuration;
|
||||
using Net.Pkcs11Interop.Common;
|
||||
using Net.Pkcs11Interop.HighLevelAPI;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DocumentOperator.Application.Common.Dto;
|
||||
using DocumentOperator.Application.Common.Interfaces.Services;
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
using DocumentService.Application.Common.Interfaces;
|
||||
using System.Threading;
|
||||
|
||||
namespace DocumentService.Infrastructure.Crypt.Services;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DocumentOperator.Application.Common.Configurations;
|
||||
using DocumentService.Application.Common.Configuration;
|
||||
using Net.Pkcs11Interop.Common;
|
||||
using Net.Pkcs11Interop.HighLevelAPI;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using DocumentOperator.Application.Common.Configurations;
|
||||
using DocumentOperator.Application.Common.Dto;
|
||||
using DocumentService.Application.Common.Configuration;
|
||||
using DocumentService.Application.Common.DTOs;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using DocumentOperator.Application.Common.Configurations;
|
||||
using DocumentService.Application.Common.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user