Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7062509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:36:09+00:00 2026-05-28T04:36:09+00:00

Before spending any time reading this, see the self-answer below. The problem was invalid

  • 0

Before spending any time reading this, see the self-answer below. The problem was invalid input.


When I try to decrypt some strings it throws this exception:

    "   at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
       at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
       at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
       at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing)
       at System.IO.Stream.Close()
       at System.IO.Stream.Dispose()
       at EBookReader.cryptography.DecryptString(String message, String KeyString, String IVString) in C:\\Users\\XWare\\Documents\\Visual Studio 2008\\Projects\\EBookReader\\EBookReader\\cryptography.cs:line 94"

Under debugging it throws the exception on this line :

    byte[] messageBytes = Convert.FromBase64String(message);

I think this problem just appears when string to decrypt is too big because when I try to encrypt and decrypt short strings like “Hi there I am X-Ware” it works fine

    public static string DecryptString(string message, string KeyString, string IVString)
    {
        byte[] Key = ASCIIEncoding.UTF8.GetBytes(KeyString);
        byte[] IV = ASCIIEncoding.UTF8.GetBytes(IVString);

        string decrypted = null;
        RijndaelManaged rj = new RijndaelManaged();
        rj.BlockSize = 256;
        rj.Key = Key;
        rj.IV = IV;
        rj.Mode = CipherMode.CBC;
        rj.Padding = PaddingMode.PKCS7;
        try
        {
            MemoryStream ms = new MemoryStream();
            Encoding enc = new ASCIIEncoding();
            using (CryptoStream cs = new CryptoStream(ms, rj.CreateDecryptor(Key, IV), CryptoStreamMode.Write))
            {
                byte[] messageBytes = Convert.FromBase64String(message);
                cs.Write(messageBytes, 0, messageBytes.Length);
                cs.FlushFinalBlock();  
            }// This is line 94
            byte[] encoded = ms.ToArray();
            decrypted = enc.GetString(encoded);

            ms.Close();
        }
        catch (Exception e)
        {
            Console.WriteLine("An error occurred: {0}", e.Message);
        }
        finally
        {
            rj.Clear();
        }

        return decrypted;
    }

any suggestions ?!

P.S. I wrote a comment to show you line 94 // This is line 94

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:36:10+00:00Added an answer on May 28, 2026 at 4:36 am

    The problem is that the string I pass as Base64 string is invalid the problem is just in the input file which makes decryption impossible

    Thanx all

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would appreciate some help before spending any more time on trial and error.
Before you answer this I have never developed anything popular enough to attain high
Before I start, I know there is this post and it doesn't answer my
After spending 14 hours on this I think its time to share my woes
I have been spending too much time trying to extract this. I have the
Update: NSURLConnection now seems to properly support 100-Continue. In any case, this answer contains
Before I do this I figured I would ask if it was the best
After spending a little time wondering why my app was running a particular scenario
I'm pretty sure this has been asked before but I can't seem to find
I was just reading this thread and it occurred to me that there is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.