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 432469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:04:40+00:00 2026-05-12T20:04:40+00:00

I have an encrypted bit of text that I need to decrypt. It’s encrypted

  • 0

I have an encrypted bit of text that I need to decrypt. It’s encrypted with AES-256-CBC. I have the encrypted text, key, and iv. However, no matter what I try I just can’t seem to get it to work.

The internet has suggested that mcrypt’s Rijndael cypher should be able to do this, so here’s what I have now:

function decrypt_data($data, $iv, $key) {
    $cypher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');

    // initialize encryption handle
    if (mcrypt_generic_init($cypher, $key, $iv) != -1) {
        // decrypt
        $decrypted = mdecrypt_generic($cypher, $data);

        // clean up
        mcrypt_generic_deinit($cypher);
        mcrypt_module_close($cypher);

        return $decrypted;
    }

    return false;
}

As it stands now I get 2 warnings and the output is gibberish:

Warning: mcrypt_generic_init() [function.mcrypt-generic-init]: Key size too large; supplied length: 64, max: 32 in /var/www/includes/function.decrypt_data.php on line 8
Warning: mcrypt_generic_init() [function.mcrypt-generic-init]: Iv size incorrect; supplied length: 32, needed: 16 in /var/www/includes/function.decrypt_data.php on line 8

Any help would be appreciated.

  • 1 1 Answer
  • 1 View
  • 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-12T20:04:40+00:00Added an answer on May 12, 2026 at 8:04 pm

    I’m not terribly familiar with this stuff, but it seems like trying MCRYPT_RIJNDAEL_256 in place of MCRYPT_RIJNDAEL_128 would be an obvious next step…

    Edit: You’re right — this isn’t what you need. MCRYPT_RIJNDAEL_128 is in fact the right choice. According to the link you provided, your key and IV are twice as long as they should be:

    // How do you do 256-bit AES encryption in PHP vs. 128-bit AES encryption???
    // The answer is:  Give it a key that's 32 bytes long as opposed to 16 bytes long.
    // For example:
    $key256 = '12345678901234561234567890123456';
    $key128 = '1234567890123456';
    
    // Here's our 128-bit IV which is used for both 256-bit and 128-bit keys.
    $iv =  '1234567890123456';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an aes encrypted mp3 file that I need to play in iOS;
I have some encrypted NSString store in a transformable field. I need to decrypt
I have a pgp-encrypted file that I need to extract data from at runtime.
I need to create an application that decrypts data that is encrypted using AES
I have a text file that I have to sign with RSA private key
I have a bunch of encrypted files that I want to decrypt (duh). I
OK, I have a 35 MB file, that is Encrypted with Bit to Bit
Hi I have 1000 encrypted workbooks which I would like to decrypt by providing
I have a project where I receive an encrypted RSA private key for a
We are adding AES 256 bit encryption to our server and client applications for

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.