I am writing a C# app designed to encrypt text files using Rijndeal (block size 128, key size 256, in other words AES256). I use the user supplied password and a random salt to generate a key using PBKDF2. (The IV is also derived from the password and salt)
I want to store the salt as cleartext prepended to the ciphertext. In other words, line 1 would contain something like >>>SALTGOESHERE. Line 3 and onward would store the ciphertext.
How should I go about retrieving the salt for decryption?
I’m very new to C#, this is my first real app, so please bear with my ignorance. Thanks.
yourString.Substring(0, yourString.IndexOf(Environment.NewLine));change 0 to 3 if “>>>” is not just the placeholder