File tree Expand file tree Collapse file tree
SafeCrypt.Lib/Encryption/AesEncryption Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public async Task<DecryptionData> DecryptFromHexStringAsync(DecryptionParameters
3838 return responseData ;
3939 }
4040 // Convert input string to bytes
41- byte [ ] dataBytes = param . IV . ConvertKeysToBytes ( ) ;
41+ byte [ ] dataBytes = param . IV . HexadecimalStringToByteArray ( ) ;
4242
4343 // Validate block size based on AES algorithm's requirements
4444 if ( ! Validators . IsValidBlockSize ( dataBytes . Length ) )
@@ -80,7 +80,7 @@ public async Task<DecryptionData> DecryptFromBase64StringAsync(DecryptionParamet
8080 var responseData = new DecryptionData ( ) ;
8181
8282 Validators . ValidateNotNull ( param ) ;
83-
83+
8484
8585 if ( ! Validators . IsBase64String ( param . SecretKey ) )
8686 {
Original file line number Diff line number Diff line change 1- using System ;
2- using System . Security . Cryptography ;
3- using System . Threading . Tasks ;
4- using SafeCrypt . AesEncryption ;
1+ using SafeCrypt . AesEncryption ;
52using SafeCrypt . Helpers ;
63using SafeCrypt . Models ;
4+ using System ;
5+ using System . Security . Cryptography ;
6+ using System . Threading . Tasks ;
77
88namespace SafeCrypt . AESEncryption
99{
@@ -35,7 +35,7 @@ public async Task<EncryptionData> EncryptToHexStringAsync(EncryptionParameters p
3535 }
3636
3737 // Convert input string to bytes
38- byte [ ] dataBytes = param . IV . ConvertKeysToBytes ( ) ;
38+ byte [ ] dataBytes = param . IV . HexadecimalStringToByteArray ( ) ;
3939
4040 // Validate block size based on AES algorithm's requirements
4141 if ( ! Validators . IsValidBlockSize ( dataBytes . Length ) )
@@ -139,14 +139,14 @@ private void NullChecks(string data, string secretKey)
139139 if ( data == null || data . Length <= 0 )
140140 throw new ArgumentNullException ( nameof ( data ) ) ;
141141
142- if ( secretKey == null )
142+ if ( secretKey == null )
143143 throw new ArgumentNullException ( nameof ( secretKey ) ) ;
144144 }
145145
146146 private void AddError ( EncryptionData responseData , string error )
147147 {
148148 responseData . HasError = true ;
149149 responseData . Errors . Add ( error ) ;
150- }
150+ }
151151 }
152152}
Original file line number Diff line number Diff line change 3232var decryptionData = await decryptor . DecryptFromBase64StringAsync ( decryptorParam ) ;
3333
3434Console . WriteLine ( "............Decryption Started............" ) ;
35- Console . WriteLine ( $ "Decrypted data: { decryptionData . DecryptedData } ") ;
35+ Console . WriteLine ( $ "Decrypted data: { decryptionData . DecryptedData } ") ;
3636Console . WriteLine ( $ "IV key: { decryptionData . Iv } ") ;
3737Console . WriteLine ( $ "Secret key: { decryptionData . SecretKey } ") ;
3838
You can’t perform that action at this time.
0 commit comments