Precondition: Have RHEL9 running in FIPS mode and cryptography 46
Small unit test minimal example:
def test_aes_gcm_encrypt():
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
import os
key = os.urandom(16)
aesgcm = AESGCM(key)
iv = os.urandom(12)
> encrypted = aesgcm.encrypt(iv, b"I am a test", None)
E cryptography.exceptions.InternalError: Unknown OpenSSL error. This error is commonly encountered
E when another library is not cleaning up the OpenSSL error
E stack. If you are using cryptography with another library
E that uses OpenSSL try disabling it before reporting a bug.
E Otherwise please file an issue at
E https://github.com/pyca/cryptography/issues with
E information on how to reproduce this. (error:030000BE:digital envelope routines:EVP_CIPHER_CTX_copy:not able to copy ctx:crypto/evp/evp_enc.c:1792:)
This has been test with 46.0.7 but is likely a regression added by 98dfafe. The version 41.0.7 from the Red Hat package python3.12-cryptography does not exhibit this problem.
A possible workaround is to use aesgcm = Cipher(algorithms.AES(key), modes.GCM(iv)).encryptor() instead as that still works.
Precondition: Have RHEL9 running in FIPS mode and cryptography 46
Small unit test minimal example:
This has been test with
46.0.7but is likely a regression added by 98dfafe. The version 41.0.7 from the Red Hat package python3.12-cryptography does not exhibit this problem.A possible workaround is to use
aesgcm = Cipher(algorithms.AES(key), modes.GCM(iv)).encryptor()instead as that still works.