encrypt

Discussion in 'ASP .Net Security' started by JW, Nov 14, 2003.

  1. JW

    JW Guest

    I can encrypt the contents of a memory stream with no problems, however when
    decrypting( I'm using the same key an IV ) I get an exception stating bad
    data.

    I'm at a lost. I'm actually creating a new memory stream, filling it with
    the encrypted bytes then trying to read from the crypto stream object. I
    have used the same approach encrypting to a file handle and then decrypting
    from the same file and it works.



    sample: (this same code works with a file stream but not memory stream) what
    am I missing?

    MemoryStream memStrEnc2 = new MemoryStream(newByte, 0, newByte.Length);

    CryptoStream decStream = new CryptoStream(memStrEnc2,
    tdes.CreateDecryptor(random, random), CryptoStreamMode.Read);

    byte[] memString2 = new Byte[memStrEnc2.Length];

    decStream.Read(memString2, 0, 16);

    decStream.Close();



    Thank you for your time

    Josiah
     
    JW, Nov 14, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    500
    Jonathan Allen
    Sep 25, 2004
  2. Markus Stehle

    Encrypt string for POSTing

    Markus Stehle, Jul 5, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    587
    Thomas Stehle
    Jul 6, 2003
  3. Anand

    Encrypt identity password

    Anand, Jul 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    553
  4. Tushar Karsan

    Encrypt connection channel

    Tushar Karsan, Jul 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    328
    Tushar Karsan
    Jul 22, 2003
  5. http://ejobseek.com

    Encrypt in Perl, De-encrypt in Javascript

    http://ejobseek.com, Sep 1, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    290
    James Willmore
    Sep 1, 2003
Loading...

Share This Page