I'm encrypting bitmap image(accessed from ms-access database) using RSACryptoServiceProvider.
private
{
string
OleDbConnection connection =
OleDbCommand cmd =
connection.Open();
toEncrypt = (Byte[]) cmd.ExecuteScalar();
connection.Close();
RSAParameters rsaPubParams;
RSAParameters rsaPrivateParams;
RSACryptoServiceProvider rsaCSP = new RSACryptoServiceProvider();
//Generate public and private key data.
rsaPrivateParams = rsaCSP.ExportParameters(
rsaPubParams = rsaCSP.ExportParameters(
rsaCSP.ImportParameters(rsaPubParams);
}
But i get "Bad Length" error at "byte[] encrypted = rsaCSP.Encrypt(toEncrypt,false);"
Please help me to resolve this problem...I m in great trouble...