mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Change the on-disk format of SCRAM verifiers to conform to RFC 5803.
It doesn't make any immediate difference to PostgreSQL, but might as well follow the standard, since one exists. (I looked at RFC 5803 earlier, but didn't fully understand it back then.) The new format uses Base64 instead of hex to encode StoredKey and ServerKey, which makes the verifiers slightly smaller. Using the same encoding for the salt and the keys also means that you only need one encoder/decoder instead of two. Although we have code in the backend to do both, we are talking about teaching libpq how to create SCRAM verifiers for PQencodePassword(), and libpq doesn't currently have any code for hex encoding. Bump catversion, because this renders any existing SCRAM verifiers in pg_authid invalid. Discussion: https://www.postgresql.org/message-id/351ba574-85ea-d9b8-9689-8c928dd0955d@iki.fi
This commit is contained in:
@ -1376,14 +1376,22 @@
|
||||
32-character hexadecimal MD5 hash. The MD5 hash will be of the user's
|
||||
password concatenated to their user name. For example, if user
|
||||
<literal>joe</> has password <literal>xyzzy</>, <productname>PostgreSQL</>
|
||||
will store the md5 hash of <literal>xyzzyjoe</>. If the password is
|
||||
encrypted with SCRAM-SHA-256, it consists of 5 fields separated by colons.
|
||||
The first field is the constant <literal>scram-sha-256</literal>, to
|
||||
identify the password as a SCRAM-SHA-256 verifier. The second field is a
|
||||
salt, Base64-encoded, and the third field is the number of iterations used
|
||||
to generate the password. The fourth field and fifth field are the stored
|
||||
key and server key, respectively, in hexadecimal format. A password that
|
||||
does not follow either of those formats is assumed to be unencrypted.
|
||||
will store the md5 hash of <literal>xyzzyjoe</>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If the password is encrypted with SCRAM-SHA-256, it has the format:
|
||||
<synopsis>
|
||||
SCRAM-SHA-256$<replaceable><iteration count></>:<replaceable><salt></>$<replaceable><StoredKey></>:<replaceable><ServerKey></>
|
||||
</synopsis>
|
||||
where <replaceable>salt</>, <replaceable>StoredKey</> and
|
||||
<replaceable>ServerKey</> are in Base64 encoded format. This format is
|
||||
the same as that specified by RFC 5803.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A password that does not follow either of those formats is assumed to be
|
||||
unencrypted.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
|
Reference in New Issue
Block a user