Backup restore fails: ciphertext has an invalid padding length #986

Closed
opened 2023-03-28 20:29:07 +00:00 by marcusivanhoe · 3 comments
Member

Steps to reproduce the issue

Installing a fresh copy of joomla
Installing JCB
Restore backup file made in previous install either via directoy or upload of zip file

Expected result

Complete restore on JCB components

Actual result

Truncated restore, Displayed message is:

Error 0 The ciphertext has an invalid padding length (118) compared to the block size (16)
/home/.../libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php:2597

System information (as much as possible)

  • OS Name & Version: Linux CentOS 4.18.0-372.19.1.lve.el7h.x86_64
  • MySql Version: 10.3.38-MariaDB-log
  • Apache Version: 2.4.55
  • PHP Version: 8.2
  • Joomla Version: 3.10.11.
  • JCB Version: 3.1.19
  • Browser: Opera 96.0.4693.80, Chromium:110.0.5481.192
### Steps to reproduce the issue Installing a fresh copy of joomla Installing JCB Restore backup file made in previous install either via directoy or upload of zip file ### Expected result Complete restore on JCB components ### Actual result Truncated restore, Displayed message is: Error 0 The ciphertext has an invalid padding length (118) compared to the block size (16) /home/.../libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php:2597 ### System information (as much as possible) - OS Name & Version: Linux CentOS 4.18.0-372.19.1.lve.el7h.x86_64 - MySql Version: 10.3.38-MariaDB-log - Apache Version: 2.4.55 - PHP Version: 8.2 - Joomla Version: 3.10.11. - JCB Version: 3.1.19 - Browser: Opera 96.0.4693.80, Chromium:110.0.5481.192
Owner

I have also seen this issue, and I am not sure how we will resolve this, I have tried to fix this already once. The problem we have is that the way FOF encryption worked did not follow industry standards, and so now moving to a more serious and stable solution we are having trouble with the matching up of the differences.

These are the new classes I wrote to try and solve the issue, but as you see its back.

I am open for ideas... But in simple terms, the padding added to the string during encryption by the FOFEncryptAes was not done correctly, and can therefore just be opened with FOFEncryptAes again, and not with another tool (that follows industry standard approach) as you can see.

I am at this point thinking we need to build a migration script/component/tool or something, as this will effect all encrypted datasets. Will you believe that one of the main reasons the transition to Joomla 4 has been so slow is this issue. So I spend a great deal of time trying to remedy this, and though it seems to work at times, it also seems to fail at other times.

I have also seen this issue, and I am not sure how we will resolve this, I have tried to [fix this already once](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/libraries/phpseclib3/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php#L2593). The problem we have is that the way FOF encryption worked did not follow industry standards, and so now moving to a more serious and stable solution we are having trouble with the matching up of the differences. These are the [new classes I wrote](https://git.vdm.dev/joomla/Component-Builder/src/branch/staging/libraries/jcb_powers/VDM.Joomla/src/Componentbuilder/Crypt/FOF.php) to try and solve the issue, but as you see its back. I am open for ideas... But in simple terms, the padding added to the string during encryption by the FOFEncryptAes was not done correctly, and can therefore just be opened with FOFEncryptAes again, and not with another tool (that follows industry standard approach) as you can see. I am at this point thinking we need to build a migration script/component/tool or something, as this will effect all encrypted datasets. Will you believe that one of the main reasons the transition to Joomla 4 has been so slow is this issue. So I spend a great deal of time trying to remedy this, and though it seems to work at times, it also seems to fail at other times.
Author
Member

Thank you, I trust you will find a good solution.

Thank you, I trust you will find a good solution.
Owner

The current work around is to import the component in the same version of JCB in-which it the JCB package was exported, and then to upgrade that JCB to the current version and export it again... then the import will work.

The current work around is to import the component in the same version of JCB in-which it the JCB package was exported, and then to upgrade that JCB to the current version and export it again... then the import will work.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#986
No description provided.