# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1695919159 -7200
# Node ID 91da73c3df6195c24e559e9a80d47bf517a71980
# Parent  832c257d5618c53d6aa86c78bca1dc549253d118
Addapt to Py3.11.5 in Stunnel.py
b2a_hqx is now deprecated, base64 should bring comparable results

diff -r 832c257d5618 -r 91da73c3df61 runtime/Stunnel.py
--- a/runtime/Stunnel.py	Thu Sep 28 18:28:07 2023 +0200
+++ b/runtime/Stunnel.py	Thu Sep 28 18:39:19 2023 +0200
@@ -1,7 +1,7 @@
 
 
 import os
-from binascii import b2a_hqx
+from binascii import b2a_base64
 try:
     from runtime.spawn_subprocess import call
 except ImportError:
@@ -25,9 +25,10 @@
 
 def PSKgen(ID, PSKpath):
 
-    # b2a_hqx output len is 4/3 input len
+    # secret string length is 256
+    # b2a_base64 output len is 4/3 input len
     secret = os.urandom(192)  # int(256/1.3333)
-    secretstring = b2a_hqx(secret)
+    secretstring = b2a_base64(secret)
 
     PSKstring = ID+":"+secretstring
     with open(PSKpath, 'w') as f: