Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/SafeCrypt.Lib/Encryption/AesEncryption/Decrypting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task<DecryptionData> 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))
Expand Down Expand Up @@ -80,7 +80,7 @@ public async Task<DecryptionData> DecryptFromBase64StringAsync(DecryptionParamet
var responseData = new DecryptionData();

Validators.ValidateNotNull(param);


if (!Validators.IsBase64String(param.SecretKey))
{
Expand Down
14 changes: 7 additions & 7 deletions src/SafeCrypt.Lib/Encryption/AesEncryption/Encrypting.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -35,7 +35,7 @@ public async Task<EncryptionData> 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))
Expand Down Expand Up @@ -139,14 +139,14 @@ 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));
}

private void AddError(EncryptionData responseData, string error)
{
responseData.HasError = true;
responseData.Errors.Add(error);
}
}
}
}
15 changes: 7 additions & 8 deletions src/SafeCrypt.Lib/SafeCrypt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,26 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseFile>MitLicense.txt</PackageLicenseFile>
<PackageReleaseNotes>SafeCrypt Library - Release Notes - Version 1.0.1
<PackageReleaseNotes>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!</PackageReleaseNotes>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/SafeCrypt.Test/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");

Expand Down