Re: Encrypt a string to a string and vice versa

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 10/20/04


Date: Wed, 20 Oct 2004 17:48:49 +0100

Matthias S. <matthias@_e_m_v_o_i_d_.de> wrote:
> sorry if I didn't make myself clear enough. The encryption method works
> fine (at least I don't get an exception anywhere, if the string is
> correctly encryption is left aside). The problem lies in the
> Decryption-part of the task, where I'm just creating a MemoryStream by
> converting the result of my previously mentioned encryption method using
> Convert.FromBase64String().
>
> The problem is, as soon as I call ReadByte on the CryptoStream, I get the
> CryptographicException mentioned below.

The problem is that the encryption *hasn't* worked - you've not got all
the data. You didn't get an exception, but you didn't get the right
data, either.

-- 
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Relevant Pages

  • Re: .NET encryption
    ... I've tried this at home .NET2.0 and it seems to give me a string that will ... a basic encryption on strings passed to it. ... /// A class that uses the Rijndael encryption method to encrypt or decrypt ... bytebyteKey; ...
    (microsoft.public.dotnet.framework)
  • encryption question
    ... I would like to use an encryption method where no record of the secret key ... correctly otherwise a meaningless stream will be returned.) ... If I keep a "test" string stored somewhere, where I know what this string ...
    (borland.public.delphi.thirdpartytools.general)