MySQL Forums
Forum List  »  French

AES_ENCRYPT et AES_DECRYPT
Posted by: Stéphane LAVERGNE
Date: October 10, 2019 04:51AM

Bonjour,

Je cherche à chiffrer du texte, mais bizarrement, cela ne semble pas fonctionner comme attendu.

Par exemple, si je cherche à exécuter la requête SQL :

SELECT AES_DECRYPT(AES_ENCRYPT('mytext','mykeystring'),'mykeystring');

Le résultat attendu est celui-ci :

mysql> SELECT AES_DECRYPT(AES_ENCRYPT('mytext','mykeystring'),'mykeystring');
+----------------------------------------------------------------+
| AES_DECRYPT(AES_ENCRYPT('mytext','mykeystring'),'mykeystring') |
+----------------------------------------------------------------+
| mytext |
+----------------------------------------------------------------+
1 row in set (0.00 sec)

Cependant, lorsque j'exécute cette même requête dans la zone SQL de phpMyAdmin, j'ai ce résultat complètement inattendu :

AES_DECRYPT(AES_ENCRYPT('mytext','mykeystring'),'mykeystring')
6d7974657874

Il semble que le résultat soit affiché en hexa...
Du coup, j'essaye :
select unhex(AES_DECRYPT(AES_ENCRYPT('mytext','mykeystring'),'mykeystring'))
mais ça me retourne NULL...

et select unhex('6d7974657874') me retourne :
6d7974657874

J'ai même été à vérifier :
select 'test'
mais ça, c'est bon, ça retourne bien test

Bref, je suis perdu... merci d'avance pour votre aide.


Ce serveur hébergé chez OVH utilise :
MYSQL v.5.6
phpfpm-7.3

Options: ReplyQuote


Subject
Views
Written By
Posted
AES_ENCRYPT et AES_DECRYPT
996
October 10, 2019 04:51AM
384
October 10, 2019 01:28PM
464
October 11, 2019 05:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.