Ask a Question related to ASP.NET Security, Design and Development.
-
Gordon #1
Problem decrypting data
I'm having a problem with the decryption part of the code below. An
exception is generated when creating the CryptoStream for decryption. It's
the error "Stream does not support seeking". I can't figure out what's
causing the error...
ASCIIEncoding textConverter = new ASCIIEncoding();
byte[] bin = textConverter.GetBytes("some text to encrypt");
RijndaelManaged tdes = new RijndaelManaged();
tdes.GenerateKey();
tdes.GenerateIV();
byte[] bkey = tdes.Key;
byte[] biv = tdes.IV;
byte[] bout = new byte[100];
byte[] bres = new byte[100];
int count;
try
{
using (MemoryStream msout = new MemoryStream(100))
{
CryptoStream encStream = new CryptoStream(msout,
tdes.CreateEncryptor(bkey,biv), CryptoStreamMode.Write);
encStream.Write(bin, 0, bin.GetLength(0));
encStream.FlushFinalBlock();
msout.Seek(0, SeekOrigin.Begin);
count = msout.Read(bout, 0, (int)msout.Length);
}
using (MemoryStream msin = new MemoryStream(bout))
{
CryptoStream encStream = new CryptoStream(msin,
tdes.CreateDecryptor(bkey,biv), CryptoStreamMode.Read);
count = encStream.Read(bres, 0, (int)encStream.Length);
}
}
catch (Exception e)
{
//HandleException(e);
}
Gordon Guest
-
Bad Data CryptographicException when RSA decrypting
Hi you try with this sample. I am not sure where the problem in your code. But you always yous UnicodeEncoding class. Here the working... -
url encryption/encoding not decrypting correctly
Hi, Encrypting URL using this sequence: <a href="tiercontrol.cfm?page=#urlencodedformat(encrypt("addmember",session.employe e.userid))#"> ... -
decrypting key in EncryptedKey using X509SubjectKeyIdentifier
Hi, I am trying to figure out how to retrieve the decrypted key from an <EncryptedKey> element. The <KeyInfo> has a X509SubjectKeyIdentifier... -
Reading/Decrypting ASP.Net auth cookie from ASP
I have mixed ASP & ASP.Net sites. I want to read an encrypted FormsAuthenticationTicket from an ASP page (I already have multiple ASP.Net apps... -
Decrypting files
Well I'm in a huge mess. I formated my computer and moved all my encrypted files onto a diff drive so I didn't have to burn them all to cd. Well...



Reply With Quote

