EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Low-level AES usage

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#8147
Posted: 11/10/2008 07:43:29
by Scratch  (Standard support level)
Joined: 02/07/2008
Posts: 34

I'm going to use only SBAES unit to encrypt/decrypt a block of memory. just don't want to use classes\etc.
As far as I understood PKCS#5 padding scheme (for 16 byte AES256 block)- if data is for example 3 bytes long than for last block I should use data+13 bytes of "13". and remove 13 bytes after decryption. But what if blocksize equals 16 and data looks like (3 bytes smth)+ 13 bytes of 13?

Tried to dig in SBCryptoProvBuiltInSym unit but got my brain broken )
#8148
Posted: 11/10/2008 07:53:39
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Hi. The data is also padded with 0xBlockSize, if it's size is a multiple of the block size.
#8150
Posted: 11/10/2008 08:06:25
by Scratch  (Standard support level)
Joined: 02/07/2008
Posts: 34

So, we always delete the last block after decryption if it is filled by bytes of its size.
Ok, I've got it ) thanks
#8152
Posted: 11/10/2008 08:31:23
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

To be more precise, you should look at the last byte of decrypted data, and drop <value-of-the-last-byte> bytes from the end.
#8154
Posted: 11/10/2008 08:41:48
by Ken Ivanov (EldoS Corp.)

...remembering to check that the values of <value-of-the-last-byte> bytes from the end of the last block are equal to the <value-of-the-last-byte>.
#8166
Posted: 11/11/2008 23:02:37
by Scratch  (Standard support level)
Joined: 02/07/2008
Posts: 34

yep ) thanks so much for help
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 1586 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!