Error Found During Encryption/Decryption (Invalid Header Marker)
Posted: Thu May 03, 2018 4:28 pm
Hi,
I am using the "AES Crypt" in my Application to Encrypt the PDF and Mysql Database Files Like "FRM, MYD and MYI" Files.
My Application is Windows based and application is developed in C# Environment.
During running the Application I found that, Encrypted Files could not Decrypt due to "Invalid Header Marker/File Length is Invalid". When I opened the Encrypted Files in Edit Mode. The Files are blank or it contains some junk Character"
I am using the same Code, which is available on Internet and my Program is given below
public static bool Encrypt_only_pdf(string Decrypted_file, string Encrypted_file)
{
bool retVal = true;
ParallelOptions po = new ParallelOptions();
po.MaxDegreeOfParallelism = maxThreadCount;
try
{
using (Stream inputstream = (Decrypted_file != null) ? File.OpenRead(Decrypted_file) : Console.OpenStandardInput())
{
using (Stream outputstream = (Encrypted_file != null) ? File.Create(Encrypted_file) : Console.OpenStandardOutput())
{
SharpAESCrypt.SharpAESCrypt.Encrypt(inputstream, outputstream, maxThreads);
}
}
}
catch (Exception ex)
{
if (ex is SharpAESCrypt.SharpAESCrypt.WrongPasswordException)
Environment.ExitCode = 4;
if (ex is SharpAESCrypt.SharpAESCrypt.HashMismatchException)
Environment.ExitCode = 3;
else
Environment.ExitCode = 1;
retVal = false;
}
return retVal;
}
I am also sharing the Files where I am facing the Problem.
where in *.dpe file is Encrypted file and ot
I am using the "AES Crypt" in my Application to Encrypt the PDF and Mysql Database Files Like "FRM, MYD and MYI" Files.
My Application is Windows based and application is developed in C# Environment.
During running the Application I found that, Encrypted Files could not Decrypt due to "Invalid Header Marker/File Length is Invalid". When I opened the Encrypted Files in Edit Mode. The Files are blank or it contains some junk Character"
I am using the same Code, which is available on Internet and my Program is given below
public static bool Encrypt_only_pdf(string Decrypted_file, string Encrypted_file)
{
bool retVal = true;
ParallelOptions po = new ParallelOptions();
po.MaxDegreeOfParallelism = maxThreadCount;
try
{
using (Stream inputstream = (Decrypted_file != null) ? File.OpenRead(Decrypted_file) : Console.OpenStandardInput())
{
using (Stream outputstream = (Encrypted_file != null) ? File.Create(Encrypted_file) : Console.OpenStandardOutput())
{
SharpAESCrypt.SharpAESCrypt.Encrypt(inputstream, outputstream, maxThreads);
}
}
}
catch (Exception ex)
{
if (ex is SharpAESCrypt.SharpAESCrypt.WrongPasswordException)
Environment.ExitCode = 4;
if (ex is SharpAESCrypt.SharpAESCrypt.HashMismatchException)
Environment.ExitCode = 3;
else
Environment.ExitCode = 1;
retVal = false;
}
return retVal;
}
I am also sharing the Files where I am facing the Problem.
where in *.dpe file is Encrypted file and ot