Re: Newbie question about AES encryption



Say you have a 128 bit block encrypted with AES. If you change as
little as a single bit of that block, and then decrypt it, the result
will be totally random. It will not look anything like the original
plaintext block.

So, as I understand it, the full answer is as follows.

(1) Block ciphers (like AES) have "modes".

(2) If you encrypt in ECB mode, you can decrypt each block seperately
from any other block.

(3) Point (2) is generally considered to be a /dis/advantage - not an
advantage.

(4) If you encrypt in other modes, you can /not/ decrypt each block
seperately.

(5) In any case, regardless of mode, if you make /any change/ to the
bits within a single block, the decryption of that block will look like
random data. It will not look anything like the original plaintext
block.

I'm sure that someone else will jump in here, if any of that is wrong.

This about sums it up. One additional note though: if you encrypt in
other modes, you cannot decrypt each block separately. But you _can_
successfully decrypt the first blocks of cipher text without knowing
the last few. So the TS's example can still occur.

As already mentioned, the correct way to find out about it is to
include a MAC. Either send the MAC of the original message as a
separate block with the cipher text, or concatenate it to the plain
text before encryption. Then don't forget to check whether the MAC is
still valid after decryption.

Good luck!
Peter

.



Relevant Pages

  • RE: NTE_BAD_DATA
    ... They are NOT used DIRECTLY to encrypt / decrypt data; ... you should generate a RANDOM SESSION KEY and select a SYMMETRIC ENCRYPTION ... // imported from a BLOB read in from the source file or having ...
    (microsoft.public.platformsdk.security)
  • Re: Back Doors
    ... >> Design into the system a master key. ... Encrypt that with public key. ... Decrypt random symmetric key with private key. ...
    (sci.crypt)
  • Re: CAPI and RC4: can not decrypt when Final parameter is set to F
    ... to store ASYMMETRIC key pairs - never symmetric keys like RC4, ... Now when you need to encrypt at one place and decrypt at the other normally ... Get a HCRYPTPROV handle to a key container with CryptAcquireContext ...
    (microsoft.public.platformsdk.security)
  • Re: RSA - Public vs. Private Keys
    ... This is a common pattern for license software ... your client will send a unique machine hash to the ... will let us decrypt with a Public Key (or simply not ... |> RSA is intended to encrypt messages with public keys only. ...
    (microsoft.public.dotnet.security)
  • Re: .NET Crypto Classes Interoperability with Win32 Crypto APIs
    ... when i encrypt a string using .NET classes and try to ... > decrypt it using Win32 APIs, ... > UnicodeEncoding(); ...
    (microsoft.public.dotnet.security)