AESDecoder() padding bytes

Just starting out? Need help? Post your questions and find answers here.
infratec
Always Here
Always Here
Posts: 7622
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

AESDecoder() padding bytes

Post by infratec »

Hi,

with which bytes is the data padded when the data is larger then 16 but smaller then 32 :?:

I'm not able to read a PB AES code in C#
I tried 00 padding, 1,2,3,4... padding and missing length to 16 padding.

Any idea?

Bernd
said
Enthusiast
Enthusiast
Posts: 342
Joined: Thu Apr 14, 2011 6:07 pm

Re: AESDecoder() padding bytes

Post by said »

Hi Bernd,

I dont think there is any padding!

There are other factors that affect AES but i am sure you know all of them :!:

I wish i could help once (in return to your many many helpful replies/contributions :D )

Said
infratec
Always Here
Always Here
Posts: 7622
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: AESDecoder() padding bytes

Post by infratec »

The problem is that the C# AES throws an error if the data ends not on a 16 byte boundary :cry:
So I have to pad it with something.
Unfortunately I don't padded the PB AES stuff (manually), so I'm not able at the moment to decode this.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: AESDecoder() padding bytes

Post by walbus »

@Bernd
Primary you should ever use AES with a 16 byte padding, ever, never without.
A padding can are very different, the simplest are zero bytes, but all other bytes are available.
The used bytes for the padding change the encrypted block absolutelly.
One other bit in the padding and you can not decrypt this block.
The PB documentation treats AES only superficially.
The use of AES by users therefore often resembles a chaos.
Even the inventor of AES saw these problems.
He said it's not good to leave it to the developers how they want to implement AES.
He wanted to offer a solution in the future, as far as I know...
It is simply not good if there is no standardized way.
The problem you have there is nothing unusual.
It can take a lot of time and nerves.
User avatar
JHPJHP
Addict
Addict
Posts: 2258
Joined: Sat Oct 09, 2010 3:47 am

Re: AESDecoder() padding bytes

Post by JHPJHP »

Hi infratec,

See if there is anything here that can help: Services, Stuff & Shellhook
- \Stuff\AESEncryption\AES_EncoderDecoder.pb

NB*: Various parts of the package can be downloaded separately.

If you're not investing in yourself, you're falling behind.

My PureBasic StuffFREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: AESDecoder() padding bytes

Post by walbus »

Sorry, no offense, but your implementation is flawed
infratec
Always Here
Always Here
Posts: 7622
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: AESDecoder() padding bytes

Post by infratec »

Hi,

for new stuff I'll pad it manually with zeroes to the 16 byte border.
Then it's no problem to decode it with C#.

But there are a lot of encoded ini files at our customers and I have to decode them with a new
program written in C# (cause of using list and labels).

So best is Fred tell us which padding is used by the PB AESEncoder.

Bernd
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: AESDecoder() padding bytes

Post by walbus »

There is no reason not to use zeros per se Bernd
You don't get a higher security if you don't use zeros
But often weird things are done because people think it would be safer
Post Reply