Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AES DECRYPT and ENCRYPT in edit view not working #14026

Closed
cperrot opened this issue Feb 18, 2018 · 10 comments
Closed

AES DECRYPT and ENCRYPT in edit view not working #14026

cperrot opened this issue Feb 18, 2018 · 10 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete ui Issues relating to the user interface
Projects
Milestone

Comments

@cperrot
Copy link

cperrot commented Feb 18, 2018

Steps to reproduce

  1. take any table and go to into a record edit view and choose function AES_DECRYPT, this will result in an error. right of the function.

Expected behaviour

no error

Actual behaviour

having an error

Server configuration

Ubuntu 16.04 and Windows too.

Database server

Server: Localhost via UNIX socket
Server type: MySQL
Server version: 5.7.21-0ubuntu0.16.04.1 - (Ubuntu)
Protocol version: 10
User: root@localhost
Server charset: UTF-8 Unicode (utf8)

Web server

Apache
Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $
PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation
PHP version: 7.0.25-0ubuntu0.16.04.1

phpMyAdmin

Version information: 4.7.4

Client configuration

Firefox 58.0.2

Operating system:
Ubuntu 16.04

@aroralakshya
Copy link
Contributor

According to the documentation (https://www.w3resource.com/mysql/encryption-and-compression-functions/aes_decrypt().php)
AES_DECRYPT returns a binary string, so you should use it for a field defined as binary or varbinary, ot it will show the error.
I can confirm that it doesn't show any error for binary/varbinary fields.
asdf

@nijel nijel added the question Used when we need feedback from the submitter or when the issue is a question about PMA label Mar 1, 2018
@ibennetch
Copy link
Member

Also, what is the error message shown?

@aroralakshya
Copy link
Contributor

abcd

@williamdes williamdes added the ui Issues relating to the user interface label Jun 24, 2019
@williamdes
Copy link
Member

@cperrot What should be done ?
@ibennetch We can enable AES_ENCRYPT for varchar fields ?

@cperrot
Copy link
Author

cperrot commented Jun 26, 2019

After 1.5 years it's hard to remember what the issue was. Apparently AES_Encrypt only works for BINARY and VARBINARY fields.

@pmarquesmota
Copy link

Also, aes_decrypt returns binary in phpmyadmin and must be CASTed to CHAR, unlike the mysql client and the mysql documentation which says it returns the original plaintext string. See Stackoverflow

@williamdes williamdes added this to Needs triage in issues via automation Sep 23, 2019
@williamdes
Copy link
Member

Can you please send a step by step guide to help me know what you expect?

@williamdes williamdes moved this from Needs triage to to be fixed soon in issues Oct 20, 2019
@williamdes
Copy link
Member

williamdes commented Jan 23, 2020

@pmarquesmota @cperrot 🏓

@williamdes
Copy link
Member

One year later, I am back on this issue and you out this block of code is blocking the execution.
It makes no sense for me, but I am investigating.

To make the functions works:

diff --git a/js/src/table/change.js b/js/src/table/change.js
index 31a09ca6c1..9b64f4c498 100644
--- a/js/src/table/change.js
+++ b/js/src/table/change.js
@@ -270,6 +270,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
         $('#salt_' + target.id).remove();
     }
 
+    /*
     if (target.value === 'AES_DECRYPT'
             || target.value === 'AES_ENCRYPT'
             || target.value === 'MD5') {
@@ -281,7 +282,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
                 }
             }
         });
-    }
+    }*/
 
     if (target.value === 'HEX' && theType.substring(0,3) === 'int') {
         // Add note when HEX function is selected on a int

williamdes added a commit to williamdes/phpmyadmintest that referenced this issue Feb 10, 2021
…AES_* functions

Fixes phpmyadmin#14026
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes williamdes self-assigned this Feb 10, 2021
@williamdes williamdes added Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete and removed question Used when we need feedback from the submitter or when the issue is a question about PMA labels Feb 10, 2021
@williamdes williamdes moved this from to be fixed soon to ready to merge in issues Feb 10, 2021
@williamdes
Copy link
Member

I made a fix for it: #16632

@williamdes williamdes added this to the 5.1.0 milestone Feb 10, 2021
@ibennetch ibennetch modified the milestones: 5.1.0, 5.1.1 Feb 24, 2021
williamdes added a commit that referenced this issue Mar 6, 2021
… and AES_* functions

Pull-request: #16632
Fixes: #14026

Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit to williamdes/phpmyadmintest that referenced this issue Mar 6, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from ready to merge to Closed Mar 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete ui Issues relating to the user interface
Projects
issues
  
Closed
Development

No branches or pull requests

6 participants