From: Magnus Hagander Date: Wed, 13 Aug 2025 10:20:16 +0000 (+0200) Subject: Fix incorrect message about key-length when generating cauth keys X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=4cb846d77d43fd20ea09516d670eb63b8836dd98;p=pgweb.git Fix incorrect message about key-length when generating cauth keys Reported by Jacob Champion --- diff --git a/tools/communityauth/generate_cryptkey.py b/tools/communityauth/generate_cryptkey.py index ba84399a..4c6376c0 100755 --- a/tools/communityauth/generate_cryptkey.py +++ b/tools/communityauth/generate_cryptkey.py @@ -24,12 +24,13 @@ if __name__ == "__main__": usage() version = int(sys.argv[1]) + keylen = 64 if version == 3 else 32 - print("The next row contains a 64-byte (512-bit) symmetric crypto key.") + print("The next row contains a {}-byte ({}-bit) symmetric crypto key.".format(keylen, keylen * 8)) print("This key should be used to integrate a community auth site.") print("Note that each site should have it's own key!!") print("") r = Random.new() - key = r.read(64 if version == 3 else 32) + key = r.read(keylen) print(base64.b64encode(key).decode('ascii'))