How a tools knows it's successfully decrypted a file?



Hi, folks,

A newbie question (I couldn't find the right Googlism to hit a result,
nor did the FAQ shine a light).

I've used a couple of tools to encrypt and decrypt files for me based
on a password of my choice. When I try decrypting an encrypted file
with the wrong password, tools generally respectfully tell me that I've
made a tit of myself, and ask me to use the right password.

I hadn't thought much about this till the other day, using a new(ish)
tool to decrypt. I entered the wrong password (unknowingly, of course)
and it told me that the file was decrypted successfully; but a look at
the contents told me that this was not so. I think it just re-encrypted
the file using the, "New," password.

My question is: how does a tool know that it's successfully decrypted a
file?

I can think of a way of doing it, but it seems a little ... insecure:
the tool adds the password to the plaintext before encryption and then
encrypts it along with everything else. Then, after decryption, the
tool checks that the first X bytes match the password, and if so:
success.

Can anyone answer my question above?

Thanks for your time,

..ed

.



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)