From 5c88fefdcbd8c35d41f2589a846b75ab3f7986c4 Mon Sep 17 00:00:00 2001 From: Klaus Fischer <klaus.fischer@eloware.com> Date: Fri, 17 Mar 2023 11:31:03 +0100 Subject: [PATCH] Removed compiler warnings --- Examples/ConsoleAppExample/SubscriberDemo.cs | 2 +- FitConnect/Encryption/FitEncryption.cs | 7 +++++-- FitConnect/Encryption/JoseEncryptor.cs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Examples/ConsoleAppExample/SubscriberDemo.cs b/Examples/ConsoleAppExample/SubscriberDemo.cs index 5de8ac9a..17fb28a6 100644 --- a/Examples/ConsoleAppExample/SubscriberDemo.cs +++ b/Examples/ConsoleAppExample/SubscriberDemo.cs @@ -25,7 +25,7 @@ public static class SubscriberDemo { await File.ReadAllTextAsync(privateKeySigning), logger); - var submissionForPickups = await subscriber.GetAvailableSubmissionsAsync(Guid.Parse(config["FitConnect:Subscriber:DestinationId"])); + var submissionForPickups = await subscriber.GetAvailableSubmissionsAsync(Guid.Parse(config["FitConnect:Subscriber:DestinationId"]!)); foreach (var submission in submissionForPickups) { var outputDirectory = Directory.CreateDirectory( diff --git a/FitConnect/Encryption/FitEncryption.cs b/FitConnect/Encryption/FitEncryption.cs index d50f3bb6..9d8c688b 100644 --- a/FitConnect/Encryption/FitEncryption.cs +++ b/FitConnect/Encryption/FitEncryption.cs @@ -39,7 +39,9 @@ public class FitEncryption { public FitEncryption( KeySet keySet, ILogger? logger) : this(logger) { - PrivateDecryptionKeys = new List<string>() { keySet.PrivateKeyDecryption }; + PrivateDecryptionKeys = keySet.PrivateKeyDecryption != null + ? new List<string>() { keySet.PrivateKeyDecryption } + : null; PrivateSigningKey = keySet.PrivateKeySigning; PublicEncryptionKey = keySet.PublicKeyEncryption; PublicSignatureVerificationKey = keySet.PublicKeySignatureVerification; @@ -55,7 +57,8 @@ public class FitEncryption { public string? PublicSignatureVerificationKey { get; set; } - public (string plainText, byte[] plainBytes, byte[] tag) Decrypt(string cypherText, List<string> key) => _encryptor.Decrypt(key, cypherText); + public (string plainText, byte[] plainBytes, byte[] tag) Decrypt(string cypherText, + List<string> key) => _encryptor.Decrypt(key, cypherText); public (string plainText, byte[] plainBytes, byte[] tag) Decrypt(string cypherText) { if (PrivateDecryptionKeys == null) diff --git a/FitConnect/Encryption/JoseEncryptor.cs b/FitConnect/Encryption/JoseEncryptor.cs index b0c91f3e..28de8577 100644 --- a/FitConnect/Encryption/JoseEncryptor.cs +++ b/FitConnect/Encryption/JoseEncryptor.cs @@ -21,7 +21,7 @@ public class JoseEncryptor : IEncryptor { catch (PlatformNotSupportedException e) { throw new PlatformNotSupportedException(ErrorMessage, e); } - catch (Exception e){ + catch { // Try other key... } } -- GitLab