Skip to content

Commit 66eafce

Browse files
committed
remove unused code from rsa class
1 parent f5d1e26 commit 66eafce

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

  • src/SafeCrypt.Lib/Encryption/RsaEncryption

src/SafeCrypt.Lib/Encryption/RsaEncryption/Rsa.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,23 @@ public static async Task<EncryptionResult> EncryptAsync(RsaEncryptionParameters
3535

3636
if(data.Errors.Count > 0)
3737
{
38-
// If there are errors in the encryption process, add them to the result and return
3938
result.Errors.AddRange(data.Errors);
4039
return result;
4140
}
4241

43-
// Convert the encrypted data to a hexadecimal string
44-
//result.EncryptedData = data.EncryptedData;
45-
//result.EncryptedData = Convert.ToBase64String(data.EncryptedData);
46-
//result.EncryptedData = BitConverter.ToString(data.EncryptedData);
47-
//result.EncryptedData = Encoding.UTF8.GetString(data.EncryptedData); //Encoding.UTF8.GetString(decryptedData)
48-
result.EncryptedData = data.EncryptedData; //Encoding.UTF8.GetString(decryptedData)
42+
result.EncryptedData = data.EncryptedData;
4943
return result;
5044
}
5145

5246
public static async Task<DecryptionResult> DecryptAsync(RsaDecryptionParameters model)
5347
{
5448
var result = new DecryptionResult();
5549

56-
//if (string.IsNullOrWhiteSpace(model.DataToDecrypt))
57-
//{
58-
// result.Errors.Add($"Data cannot be null {nameof(model.DataToDecrypt)}");
59-
// return result;
60-
//}
50+
if(model.DataToDecrypt == null)
51+
{
52+
result.Errors.Add($"DataToDecrypt cannot be null {nameof(model.DataToDecrypt)}");
53+
return result;
54+
}
6155

6256
if (string.IsNullOrWhiteSpace(model.PrivateKey))
6357
{
@@ -70,7 +64,6 @@ public static async Task<DecryptionResult> DecryptAsync(RsaDecryptionParameters
7064

7165
if (data.Errors.Count > 0)
7266
{
73-
// if there are errors in the encryption process, add them to the result and return
7467
result.Errors.AddRange(data.Errors);
7568
return result;
7669
}

0 commit comments

Comments
 (0)