Re: Choosing encryption method?

From: Alek Davis (alek_xDOTx_davis_xATx_intel_xDOTx_com)
Date: 04/27/04

  • Next message: Ayende Rahien: "Re: Choosing encryption method?"
    Date: Mon, 26 Apr 2004 15:35:00 -0700
    
    

    Ayende,

    Verifying whether decryption was successful does not come out-of-the-box,
    but you can implement it yourself with little effort.
    For example, before encrypting data, hash it using MD5 or SHA-1 algorithm
    and append the resulting hash bytes at the end of the plain text. When you
    decrypt data, split the decrypted bytes into original plain text and hash
    (which should be trivial, since the size of hash is always the same and you
    know that the hash bytes are at the end), and hash the decrypted plain text
    again. If the generated hash value matches the decrypted hash value, you can
    assume that decryption worked.

    Alek

    "Ayende Rahien" <Ayende@nospam.com> wrote in message
    news:eFIe458KEHA.1120@TK2MSFTNGP11.phx.gbl...
    > I'll check that out, thanks.
    >
    > Another question, how can I tell if I'm decrypting with the wrong
    > password? Having garbage data is too late, I think ;-)
    >
    > Michel Gallant wrote:
    >
    > > You are manually trying to do what password-derived symmetric
    > > encryption already does (derives a symmetric key from hash of pswd
    etc..).
    > > See comments here:
    > > http://www.jensign.com/JavaScience/dotnet/SimCryptNET
    > > and details of adding extra entropy to weak passwords here:
    > >
    http://www.jensign.com/JavaScience/dotnet/SimCryptNET/indexdetails.html
    > >
    > > - Mitch Gallant
    > > MVP Security
    > >
    > > "Ayende Rahien" <Ayende@nospam.com> wrote in message
    news:%23slvMN8KEHA.2012@TK2MSFTNGP11.phx.gbl...
    > >
    > >>I want to secure sensitive data (bank & money) using
    > >>System.Security.Cryptography, my problem is what strategy to take?
    > >>
    > >>The requirements (in order of importance):
    > >>0> Has to work on Win9x (so CryptoAPI is probably out)
    > >>1> Has to survive client's reinstalls - moving to another computer, etc.
    > >>2> As secure as possible.
    > >>3> Datasets of a few MB.
    > >>4> Require resounable performance.
    > >>5> Data is usually text (XML data)
    > >>
    > >>
    > >>At first I thought about using RjindaelManaged with a user-generated
    > >>password.
    > >>The way I'm doing it is SHA386 the password, grab the first 256 bits for
    > >>key and the rest for IV, and the encrypting it.
    > >>The question is how secure it is? I understand that using a password
    > >>choosen by the user (and it'll have to be this) weaken the bit-range of
    > >>the encryption, but does SHAing the password helps?
    > >>
    > >>I suppose I could generate a random key and use asymmertric encryption,
    > >>but then I face the same problem, how do I survive a reinstall/moving to
    > >>another computer?
    > >>
    > >>Any other suggestions would be appriciated.
    > >>
    > >>Thanks in advance,
    > >>Ayende Rahien
    > >
    > >
    > >


  • Next message: Ayende Rahien: "Re: Choosing encryption method?"

    Relevant Pages

    • Re: encryption question
      ... of the password and store that. ... Then you can run the same hash on the entered password and see if it matches the saved value. ... where do you store the actual encryption key? ... For decryption the key is entered and we decrypt the data. ...
      (borland.public.delphi.thirdpartytools.general)
    • RE: CryptHashData user password
      ... Store ANOTHER hash (eg. concatenate the password with a fixed string then ... derive the decryption key). ... Note that in any case dictionary attacks cannot be avoided. ... > could be encrypted data. ...
      (microsoft.public.platformsdk.security)
    • Re: Validating Encrypted Data
      ... However you may insert a hash (i.e ... validate the hash after decryption and compare with the original ... > before encrypting it, so that after it is decrypted this ...
      (microsoft.public.dotnet.security)
    • Re: ActiveX Encryption
      ... >> They are hash function. ... >> Hash functions are one way. ... >> Encryption is by definition a TWO way process. ... The reversed process is called "decryption". ...
      (sci.crypt)
    • Re: [Full-Disclosure] Google Desktop Search
      ... The added value is that if you have the plain ... I mean, the MD5 hash will be the same for the same password, ... > otherwise it is plain pointless. ...
      (Full-Disclosure)