selfmadecode / safecrypt Goto Github PK
View Code? Open in Web Editor NEWA reliable C# nugget package for encrypting and decrypting data.
License: MIT License
A reliable C# nugget package for encrypting and decrypting data.
License: MIT License
refactor validator class to use a generic validation method instead of multiple validation
The readme file is outdated and needs to be updated to show the new class name and how to use the encrypt methods for AES
Alligning codes written to sonarqube's guidelines, Solid Principles etc.
Readme and usage examples should also be updated to reflect this change
Hey there! Right now, our encryption automatically goes for the Cipher Block Chaining (CBC) mode, we need to add a cool feature that allows users, pick the encryption mode that suits their needs.
Implement robust error handling during encryption or decryption, including specific exceptions for different error scenarios, and provide meaningful error messages.
example:
try { // encryption or decryption algorithm here } catch (ArgumentNullException ex) { throw new ArgumentException("Invalid parameter. Ensure all parameters are not null.", ex); } catch (Exception ex) { throw new DecryptionException("Decryption failed. See inner exception for details.", ex); }
// catch IV key and secret key exception
`public class EncryptionException : Exception
{
public EncryptionException(string message, Exception innerException) : base(message, innerException)
{
}
}
public class DecryptionException : Exception
{
public DecryptionException(string message, Exception innerException) : base(message, innerException)
{
}
}`
the code below will generate an exception
var iv = KeyGenerators.GenerateRandomIVKeyAsString();
var secretKey = KeyGenerators.GenerateAesSecretKey(128);
//assigning values to the params
var encryptionParameters = new EncryptionParameters
{
DataToEncrypt = "YourDataToEncrypt",
IV = iv,
SecretKey = secretKey
};
var encryptionResult = await encryptor.EncryptToHexStringAsync(encryptionParameters);
The EncryptToHexStringAsync method needs to convert the IV key from Hex string to byte array
THE Cause of the error:
byte[] dataBytes = param.IV.ConvertKeysToBytes();
THE FIX: use the HexadecimalStringToByteArray() e=method to convert the IV to
byte[] dataBytes = param.IV.HexadecimalStringToByteArray();
We need to add asynchronous support to the encryption and decryption methods. This upgrade will allow users to leverage asynchronous programming patterns, making the whole process smoother and more responsive.
There is no documentation (XML comments) for any of the methods in the codebase
Currently, there is a lack of a comprehensive suite of unit tests to validate the correctness of the encryption and decryption logic.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.