From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Documentation of pgcrypto AES key sizes |
Date: | 2018-01-26 15:56:49 |
Message-ID: | CA+TgmoahfPW3nZoGbWVk-6xVCKzM4vqozWAoubQ9u4JE4p0q8w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 25, 2018 at 8:19 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Fri, Jan 26, 2018 at 12:33:41PM +1300, Thomas Munro wrote:
>> I noticed that the documentation for encrypt()/decrypt() says "aes —
>> AES (Rijndael-128)", but in fact 192 and 256 bit keys are also
>> supported, whether you build --with-openssl or --without-openssl.
>> Should that say "AES (Rijndael-128, -192 or -256)" instead?
>
> Indeed. Instead of using the keysize as a prefix, I would personally
> find less confusing if written as "AES (Rijndael with key sizes of 128,
> 192 or 256 bytes)" instead of the phrasing you are proposing. Well, it
> is true that "Rijndael-128" and friends are wordings that can be found
> here and there..
encrypt() seems happy with a key of any length at all, although I
guess internally it must round up to the next larger size.
rhaas=# select v, min(n), max(n) from (select n, encrypt('hello
world'::bytea, ('\x' || repeat('00', n))::bytea, 'aes') v from
generate_series(1,100000) n) x group by 1;
v | min | max
------------------------------------+-----+--------
\x7489adda96bb9c30fb4932e07731571a | 1 | 16
\x20a25e2af113663852f4e7b7870835ff | 17 | 24
\x56cbe187babf7b5df62924d78a3a5099 | 25 | 100000
(3 rows)
The breakpoints are at 16 bytes = 128 bits and 24 bytes = 192 bits, so
that is consistent with Thomas's theory about what's going on under
the hood.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2018-01-26 16:07:25 | Re: Boolean partitions syntax |
Previous Message | Robert Haas | 2018-01-26 15:41:35 | Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump |