Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
realmerx authored and mrts committed Apr 26, 2024
1 parent 2414e87 commit e03dddf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/WebEid.AspNetCore.Example/Signing/SigningService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public SigningService(DigiDocConfiguration configuration, ILogger logger)
{
this.configuration = configuration;
this.logger = logger;

// The current implementation of the static DigiDoc library assumes that SigningService is used as a singleton.
// In the ASP.NET Core application, we initialize it using the AddSingleton method in Startup.cs.
// The DigiDoc library is initialized in the constructor and terminated in Dispose.
Expand All @@ -57,14 +57,14 @@ public DigestDto PrepareContainer(CertificateDto data, ClaimsIdentity identity,
throw new ArgumentException(
"Authenticated subject ID code differs from signing certificate subject ID code");
}

this.logger?.LogDebug("Creating container file: '{0}'", tempContainerName);
Container container = Container.create(tempContainerName);
container.addDataFile(FileToSign, "application/octet-stream");
logger?.LogInformation("Preparing container for signing for file '{0}'", tempContainerName);
var signature =
container.prepareWebSignature(certificate.Export(X509ContentType.Cert), "time-stamp");
var hashFunction = GetSupportedHashAlgorithm(data.SupportedSignatureAlgorithms, signature.signatureMethod());
var hashFunction = GetSupportedHashAlgorithm(data.SupportedSignatureAlgorithms, signature.signatureMethod());
container.save();
return new DigestDto
{
Expand Down Expand Up @@ -110,9 +110,9 @@ private static bool FragmentEquals(string fragment, SignatureAlgorithmDto signat
{ CryptoAlgorithm: "RSA", PaddingScheme: "PSS", HashFunction: "SHA-512" } => fragment == "#sha512-rsa-MGF1",
_ => false
};

~SigningService() => Dispose(false);

public void Dispose()
{
Dispose(true);
Expand All @@ -123,7 +123,8 @@ private void Dispose(bool disposing)
{
if (!_disposedValue)
{
if (disposing) {
if (disposing)
{
// You can release managed resources here if needed.
}

Expand Down

0 comments on commit e03dddf

Please sign in to comment.