Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: OT: MySQL AES_ENCRYPT/AES_DECRYPT (was: Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT)) Date: Wed, 05 Jun 2013 14:51:55 +0200 Lines: 35 Message-ID: <51AF346B.40309@arnowelzel.de> References: <71677bf2-490b-4a9f-8f23-4cee4262031f@k3g2000vbn.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net bCO9Z9wQaIbq7pk6qkYUcwV/fu2r83MaIBToaJpEcp75i2M1aQ Cancel-Lock: sha1:2TvCelTvyiitSYSRfnYtawvF9N8= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 In-Reply-To: <71677bf2-490b-4a9f-8f23-4cee4262031f@k3g2000vbn.googlegroups.com> Xref: csiph.com comp.lang.php:9765 Am 30.05.2013 16:38, schrieb ViVi: > i'm definetly a moron: > i've defined the encrypted field too short: > `categoria_nome` varbinary(30) DEFAULT NULL, > and every string longer than 15 chars was corrupted. > ... > .. > . > sorry for the disturb, and please don't be too rude > :-( Nobody's perfect ;-) JFTR: Cite: "Because AES is a block-level algorithm, padding is used to encode uneven length strings and so the result string length may be calculated using this formula: 16 * (trunc(string_length / 16) + 1) If AES_DECRYPT() detects invalid data or incorrect padding, it returns NULL. However, it is possible for AES_DECRYPT() to return a non-NULL value (possibly garbage) if the input data or the key is invalid." -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de