AES Help Please

2023-10-05 Thread dissolved_girl
It's impossible to say without the encryption code. Fairly sure this padding is added while encrypting.

AES Help Please

2023-10-04 Thread Cyb3rC3lt
If I could trouble you again dissolved_girl I think what we spoke about above is what is causing me trouble today. I have started writing out the Non Encrypted Raw file then adding the Decrypted Raw data underneath and I can see after 16 entries the data is padded out with 16 entries of 16 then

AES Help Please

2023-10-04 Thread Cyb3rC3lt
Thank you, understood now.

AES Help Please

2023-10-04 Thread dissolved_girl
That's PKCS padding. It's literally just the number of bytes of padding (in hex) repeated until the end of the block.

AES Help Please

2023-10-04 Thread Cyb3rC3lt
Thank you that worked a treat and I appreciate I will definitely need to improve my best practices with this code. Just dipping my toe in at the moment. One thing I noticed is that it seems to be padded with extra characters compared to what I think it should be in HEX and a String output. Any i

AES Help Please

2023-10-04 Thread Cyb3rC3lt
Thanks jtv, that is really useful code and very much appreciated. Definitely going to incorporate that into my future projects. One catch for me is the tool I am using only spits out AES CBC 128 given it is only worried about some minor obsfucation so I still need to somehow crack my issue. If

AES Help Please

2023-10-04 Thread dissolved_girl
Regarding your code, your problem is that your input is hex-encoded, but you decode it as bytes. A simple fix would be replacing this line: let cryptedInput = toByteSeq(encryptedInput) ... with this: let cryptedInput = cast[seq[byte]](parseHexStr(encryptedInput)) and

AES Help Please

2023-10-04 Thread jtv
BTW, I see you're on windows; I only develop for Posix systems, and def don't test on wsl2, but OpenSSL should be there on windows. All you need from it are aes.nim and random.nim which are built only on OpenSSL, so you should be able to yank those two files out. I also used `strDump()` and

AES Help Please

2023-10-04 Thread jtv
First, you should never be using CBC mode for a number of reasons, including no tamper detection, and potential issues with padding attacks, such as ones that have hit TLS in the past. Instead, you should be using a more modern encryption mode that does integrity checking by default. NimCrypto

AES Help Please

2023-10-04 Thread Cyb3rC3lt
Hi all, I have only recently started working with NIM and I am loving it but I have hit a little stumbling block. I am trying to get some simple AES encryption working and for the life of me I can't seem to be able to do it. I have no doubt some AES experts on here will spot my mistake instantl