Addapt to Py3.11.5 in Stunnel.py
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Thu, 28 Sep 2023 18:39:19 +0200
changeset 3848 91da73c3df61
parent 3847 832c257d5618
child 3849 c3f4e114af38
Addapt to Py3.11.5 in Stunnel.py
b2a_hqx is now deprecated, base64 should bring comparable results
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: