SafeCrypt icon indicating copy to clipboard operation
SafeCrypt copied to clipboard

Encryption exception handling

Open selfmadecode opened this issue 1 year ago • 2 comments

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) { } }`

selfmadecode avatar Dec 17 '23 00:12 selfmadecode

I would like to implement the encryption exception handling

successJohn avatar Dec 19 '23 21:12 successJohn

sure @successJohn you can take this👍, I will work on reviewing the async implementation.

selfmadecode avatar Jan 21 '24 16:01 selfmadecode