Encryptor's security

Hi, there

***************************************************************
RijndaelManaged RMCrypto = new RijndaelManaged();

byte[] Key = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16};
byte[] IV = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16};

CryptoStream CryptStream = new CryptoStream(NetStream, 
RMCrypto.CreateEncryptor(Key, IV), CryptoStreamMode.Write);

StreamWriter SWriter = new StreamWriter(CryptStream);

SWriter.WriteLine("Hello World!");
***************************************************************

Compile and run it, is possible that the Key[] value would be stealed

Thanks...


Answer this question

Encryptor's security

  • iifu

    Yeah, procedurally that is a pretty simply Key value to steal.  The managed crypto classes have methods for generating keys that you might want to use instead.
  • maheshci

    Thanks, you are great.
    But now I have some problems, I don't find out any sample.
    So, I don't know how to use the PasswordDeriveBytes class.

    What can I do
    Please...

  • lamp

    Would you please show me a direction
    Thank you very much.

  • Nelson Neves

    Hi,

    What's the NameSpace of PasswordDerivedBytes class
    I cann't find out in MSDN.

    Thanks...

  • Teknologik

    The best thing for you is going to be using PasswordDerivedBytes class to accept a user's password and then turn that into the Key.  Namely construct it with the password then use CryptDeriveKey to create the byte array.


  • Blerus

    I snuck an extra d in there.  Should be PasswordDeriveBytes.  Sorry about that.  It is in the same namespace as the rest of the cryptography classes, System.Security.Cryptography
  • Encryptor's security