From a53a9046304de6375fc6045ff7b731d2bc8c5546 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 2 Feb 2024 11:43:52 +0100 Subject: [PATCH 1/2] feat: update release note in csproj --- src/SafeCrypt.Lib/SafeCrypt.csproj | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/SafeCrypt.Lib/SafeCrypt.csproj b/src/SafeCrypt.Lib/SafeCrypt.csproj index cf1749e..2368bc6 100644 --- a/src/SafeCrypt.Lib/SafeCrypt.csproj +++ b/src/SafeCrypt.Lib/SafeCrypt.csproj @@ -15,27 +15,26 @@ README.md True MitLicense.txt - SafeCrypt Library - Release Notes - Version 1.0.1 + SafeCrypt Library - Release Notes - Version 1.0.2 -This release (version 1.0.1) includes updates to the documentation and namespace changes. We have improved the README document to provide more comprehensive information about the library and made adjustments to the namespaces for better organization. +We are excited to announce the latest version of SafeCrypt (v1.0.2), featuring a significant enhancement to our encryption methods. In this release, all encryption operations are now asynchronous, providing improved performance and responsiveness. -Changes - -- Updated README document with detailed usage instructions, API references, and contribution guidelines. -- Made changes to namespaces for better organization and clarity in the codebase. +What's New: +Async Encryption and Decryption: +We have made all encryption methods asynchronous to better align with modern programming practices and enhance the overall responsiveness of SafeCrypt. Bug Fixes No bug fixes in this release. Upgrade Command: -dotnet add package SafeCrypt --version 1.0.1 +dotnet add package SafeCrypt --version 1.0.2 Feedback and Contributions: We appreciate your feedback and contributions! If you encounter any issues or have suggestions, please create an issue on GitHub: https://github.com/selfmadecode/SafeCrypt/issues Thank you for using the SafeCrypt Library! - 1.0.1 + 1.0.2 From c2180a93c7e4866ca44a7885b650f828d6cdaadc Mon Sep 17 00:00:00 2001 From: Casido1 Date: Sun, 11 Feb 2024 11:33:58 +0100 Subject: [PATCH 2/2] Resolved exception --- .../Encryption/AesEncryption/Decrypting.cs | 4 ++-- .../Encryption/AesEncryption/Encrypting.cs | 14 +++++++------- src/SafeCrypt.Test/Program.cs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/SafeCrypt.Lib/Encryption/AesEncryption/Decrypting.cs b/src/SafeCrypt.Lib/Encryption/AesEncryption/Decrypting.cs index ae42d21..62cf941 100644 --- a/src/SafeCrypt.Lib/Encryption/AesEncryption/Decrypting.cs +++ b/src/SafeCrypt.Lib/Encryption/AesEncryption/Decrypting.cs @@ -38,7 +38,7 @@ public async Task DecryptFromHexStringAsync(DecryptionParameters return responseData; } // Convert input string to bytes - byte[] dataBytes = param.IV.ConvertKeysToBytes(); + byte[] dataBytes = param.IV.HexadecimalStringToByteArray(); // Validate block size based on AES algorithm's requirements if (!Validators.IsValidBlockSize(dataBytes.Length)) @@ -80,7 +80,7 @@ public async Task DecryptFromBase64StringAsync(DecryptionParamet var responseData = new DecryptionData(); Validators.ValidateNotNull(param); - + if (!Validators.IsBase64String(param.SecretKey)) { diff --git a/src/SafeCrypt.Lib/Encryption/AesEncryption/Encrypting.cs b/src/SafeCrypt.Lib/Encryption/AesEncryption/Encrypting.cs index ca76d78..75fa8ae 100644 --- a/src/SafeCrypt.Lib/Encryption/AesEncryption/Encrypting.cs +++ b/src/SafeCrypt.Lib/Encryption/AesEncryption/Encrypting.cs @@ -1,9 +1,9 @@ -using System; -using System.Security.Cryptography; -using System.Threading.Tasks; -using SafeCrypt.AesEncryption; +using SafeCrypt.AesEncryption; using SafeCrypt.Helpers; using SafeCrypt.Models; +using System; +using System.Security.Cryptography; +using System.Threading.Tasks; namespace SafeCrypt.AESEncryption { @@ -35,7 +35,7 @@ public async Task EncryptToHexStringAsync(EncryptionParameters p } // Convert input string to bytes - byte[] dataBytes = param.IV.ConvertKeysToBytes(); + byte[] dataBytes = param.IV.HexadecimalStringToByteArray(); // Validate block size based on AES algorithm's requirements if (!Validators.IsValidBlockSize(dataBytes.Length)) @@ -139,7 +139,7 @@ private void NullChecks(string data, string secretKey) if (data == null || data.Length <= 0) throw new ArgumentNullException(nameof(data)); - if (secretKey == null ) + if (secretKey == null) throw new ArgumentNullException(nameof(secretKey)); } @@ -147,6 +147,6 @@ private void AddError(EncryptionData responseData, string error) { responseData.HasError = true; responseData.Errors.Add(error); - } + } } } diff --git a/src/SafeCrypt.Test/Program.cs b/src/SafeCrypt.Test/Program.cs index 79b733e..812e804 100644 --- a/src/SafeCrypt.Test/Program.cs +++ b/src/SafeCrypt.Test/Program.cs @@ -32,7 +32,7 @@ var decryptionData = await decryptor.DecryptFromBase64StringAsync(decryptorParam); Console.WriteLine("............Decryption Started............"); -Console.WriteLine($"Decrypted data: { decryptionData.DecryptedData }"); +Console.WriteLine($"Decrypted data: {decryptionData.DecryptedData}"); Console.WriteLine($"IV key: {decryptionData.Iv}"); Console.WriteLine($"Secret key: {decryptionData.SecretKey}");