Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9708

Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT)

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT)
Date 2013-05-30 07:46 +0000
Organization A noiseless patient Spider
Message-ID <ko703t$62g$1@dont-email.me> (permalink)
References <da27d0df-6b91-4adc-9658-dea365e1ba02@dl10g2000vbb.googlegroups.com>

Show all headers | View raw


On Wed, 29 May 2013 23:28:32 -0700, ViVi wrote:


> I've not been able to track down WHEN it fails, but some strings
> everytime fail, other strings are OK.

How long are the strings that fail - I seem to recall that aes works on 
128 bit chunks - so multiples of 16 bytes.

One padding scheme I have seen uses n digits of hex character n as 
padding, with 16 wrapping to 0, so for example if the data is a multiple 
of 16 bytes, the last 16 bytes are 0, but then if the length of the data 
mod 16 is:

1 - 15 * f
2 - 14 * e
...........
15 - 1 * 1
0 - 16 * 0

Then after you decrypt, remove the padding chars, given that the last 
char tells you how much padding there is.

> OK are .... almost all the following string doppio " apice FAILS
> everytime.
> I've tried defining the DB field (catName) VARCHAR or BINARY to no
> avail.

Also, there's a suggestion elsewhere that I googled that the sql data 
field should be varbinary or blob. Is it possible that your encrypted 
data is longer than your fixed width field, or in some cases not 
compatible with varchar?

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

problem encrypting data (AES_ENCRYPT/AES_DECRYPT) ViVi <vincenzo.viboni@gmail.com> - 2013-05-29 23:28 -0700
  Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-30 07:46 +0000
    Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) The Natural Philosopher <tnp@invalid.invalid> - 2013-05-30 09:21 +0100
      Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) ViVi <vincenzo.viboni@gmail.com> - 2013-05-30 01:58 -0700
        Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-05-30 10:53 +0000
          Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) ViVi <vincenzo.viboni@gmail.com> - 2013-05-30 04:53 -0700
            Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) The Natural Philosopher <tnp@invalid.invalid> - 2013-05-30 13:52 +0100
  Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) Jerry Stuckle <jstucklex@attglobal.net> - 2013-05-30 08:09 -0400
    Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) ViVi <vincenzo.viboni@gmail.com> - 2013-05-30 07:05 -0700
      Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) The Natural Philosopher <tnp@invalid.invalid> - 2013-05-30 15:34 +0100
        Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) ViVi <vincenzo.viboni@gmail.com> - 2013-05-30 07:38 -0700
          Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT) The Natural Philosopher <tnp@invalid.invalid> - 2013-05-30 15:57 +0100
          OT: MySQL AES_ENCRYPT/AES_DECRYPT (was: Re: problem encrypting data (AES_ENCRYPT/AES_DECRYPT)) Arno Welzel <usenet@arnowelzel.de> - 2013-06-05 14:51 +0200

csiph-web