Re: AES Questions From Another Dummy.



Larry Lindstrom <nobody@xxxxxxxxxxx> wrote:
ECB, CBC or CFB? It's all alphabet soup to me, and a single
argument to the encrypt and decrypt functions. ECB doesn't seem to
be favored by those who post in this group.

ECB is bad. CBC is the best of the three listed, but beware:
- make sure you use an initialization vector (think of is as a perturbating
agent in encryption to ensure identical texts don't encode to the same result)
... you're on the right track just below ...

Pad the front of the clear text with some random ASCII, probably
16 bytes.

Terminate the text with a zero, then pad out to a multiple of the
block size with random text.

Then encrypt it.

Am I missing anything?

With all the recent news about breaches of computer security and
identity theft, I'm leary of keeping Social Security and credit card
numbers in the database. But customers may want that option. Would
you consider the precautions I've mentioned, together with the advice
I hope to receive from you folks, adequate protection for such
sensitive information?


My suggestion is to use a ready made (and reliable) library which does all this low level stuff for you.

Ideally something that looks like:
ciphertext = AES-128-CBC-Encrypt(plaintext); // ciphertext should be between 32 and 64 bytes larger than plaintext
plaintext2 = AES-128-CBC-Decrypt(ciphertext); // plaintext and plaintext2 should be identical

The increase in size is due to:
a) the use of an IV (random text)
b) the use of a MAC (for authentication and integrity checking)

Deriving a key from a password is a problem you have not addressed. Also, how to pass
the ciphertext/plaintext to/from the users is an open question. Feel free to email
me directly with questions (or post to the group, many helpful people here, and a few
trouble makers).

Cheers,

JLC




--
.



Relevant Pages

  • Re: Is triple DES in ECB mode secure?
    ... ]> the reason why they use ECB is to increase the speed of data processing. ... it is not easy to find files on your hard disk ... So, assuming that they encrypt file by file, ... Security is not a dongle. ...
    (sci.crypt)
  • Re: Fastcode AES B&V 0.1
    ... TAESContext; Encrypt: Boolean); ... procedure EncryptAES_TurboLock(const Context: TAESContext; var Block: ... These functions implements the core AES/Rijndael block cipher functionality. ... They define no modes such as ECB etc. ...
    (borland.public.delphi.language.basm)
  • Re: ECB+CTR Mode?
    ... both ECB and CTR modes. ... How would that compare with a Double-AES where you first encrypt a counter, ... Would you use two independent keys or two related keys or one key? ...
    (sci.crypt)
  • Re: Purpose and generation of initialization vector
    ... In ECB mode, you split your message into 16 byte chunks, ... account to another looked like this, ... amount to transfer ... blocks of 16 bytes, and encrypt each separately. ...
    (sci.crypt)
  • AES256EncryptionFormatter unable to handle ECB CipherMode
    ... The plaintext is encrypted in CBC mode, rather than ECB. ... Encrypt() sets rijndael.Mode to CBC. ... other fields in the rijndael object. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)