Menu

#320 des , des-mode parameter and key padding

open
5
2010-05-17
2010-05-17
Gaetan Riou
No

At the moment , the des module defines which DES mode to use based on the key length (64 bit for DES and 192 bit for 3DES) , so you have to provide a key with a right length.
I think it'd be easier to have a parameter that let's the developer indicates which mode to use. Then if the key is to short, it should be padded with nulls to meet the required length. Something like :
::DES::des ? -des-mode [DES|3DES] ? -mode [ecb|cbc|cfb|ofb] ? ? -dir [encrypt|decrypt] ? -key keydata ? -iv vector ? ? -hex ? ? -weak ? ? -out channel ? ? -chunksize size ? [ -in channel | data ]
It's a method used in some other language like php , .net probably others.

The documentation is not really clear on how to use DES or 3DES, there should be something that explain that the DES mode used is based on the key length.

Gaetan

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.