did a quick check of the the new cryptography package...seems it needs a relative recent openssl fileset but it let me install without informing me about a incompatible openssl version which leads to this...
>>> from cryptography.fernet import Fernet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/freeware/lib64/python3.9/site-packages/cryptography/fernet.py", line 14, in <module>
from cryptography.exceptions import InvalidSignature
File "/opt/freeware/lib64/python3.9/site-packages/cryptography/exceptions.py", line 9, in <module>
from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
ImportError: Symbol PEM_read_bio_DSA_PUBKEY (number 1117) is not exported from dependent
module /usr/lib/libcrypto.a(libcrypto.so.3).
Symbol PEM_read_bio_ECPrivateKey (number 1116) is not exported from dependent
module /usr/lib/libcrypto.a(libcrypto.so.3).
Symbol PEM_write_bio_ECPrivateKey (number 1115) is not exported from dependent
module /usr/lib/libcrypto.a(libcrypto.so.3).
Symbol PEM_read_bio_EC_PUBKEY (number 1114) is not exported from dependent
module /usr/lib/libcrypto.a(libcrypto.so.3).
Symbol PEM_read_bio_DHparams (number 1113) is not exported from dependent
module /usr/lib/libcrypto.a(libcrypto.so.3).
Symbol HMAC_CTX_new (number 1084) is not exported from dependent
module /usr/lib/libcrypto.a(libcrypto.so.3).
Symbol HMAC_CTX_free (number 1083) is not exported from dependent
module /usr/lib/libcrypto.a(libcrypto.so.3).
Additional errors occurred but are not reported.
Examine .loader section symbols with the 'dump -Tv' command.
openssl version was:
root@aixtest01: /root # lslpp -l | grep openssl
openssl.base 3.0.7.1000 COMMITTED Open Secure Socket Layer
openssl.license 3.0.7.1000 COMMITTED Open Secure Socket License
openssl.man.en_US 3.0.7.1000 COMMITTED Open Secure Socket Layer
openssl.base 3.0.7.1000 COMMITTED Open Secure Socket Layer
with openssl 3.0.10.1001 it worked...
Python 3.9.19 (main, Apr 5 2024, 05:08:51)
[GCC 10.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography.fernet import Fernet
>>> key = Fernet.generate_key()
>>> f = Fernet(key)
>>> token = f.encrypt(b"my deep dark secret")
>>> token
b'gAAAAABm2VEPdbwHP8oeYLYWfCdkePpU0cYNDhEKcV9lwkZqEMFa1qBePYqzZa7mry5sxPGKoPlXkIaXYB89G0r1wSlDn43RnUaN-AxW-LquMA7ASn5DpAM='
>>> f.decrypt(token)
b'my deep dark secret'
------------------------------
I regret starting this entire conversation
------------------------------