diff --git a/Examples/ConsoleAppExample/SubscriberDemo.cs b/Examples/ConsoleAppExample/SubscriberDemo.cs index 5de8ac9ae26023c7f97ca4482bdeac6161e68206..17fb28a6d678b052058675c6b42d556f3a63e87f 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 d50f3bb6e18909b5cf0e3fb62e80d37aa115f914..9d8c688bad4667053f7da13e7f526f496ed94382 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 b0c91f3eb43145a3f0a16f641425281c79065143..28de857708ef02b9a6e16bd0493ef163c2c76d5d 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... } }