Skip to content

Commit f8e383f

Browse files
committed
MB-55841 Set CRYPTOGRAPHY_OPENSSL_NO_LEGACY
Currently, the "import pem" step fails due to a dependency in the cryptography library, which seems to fail on Macs if the above environment variable is not set. This change automatically sets CRYPTOGRAPHY_OPENSSL_NO_LEGACY, allowing the import step to work and couchbase-cli Change-Id: I4880163528c571f21710cb1d2900f60194741394 Reviewed-on: https://review.couchbase.org/c/couchbase-cli/+/187911 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: James Lee <james.lee@couchbase.com>
1 parent 22771cf commit f8e383f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

x509_adapter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@
1515
# limitations under the License.
1616

1717
import base64
18+
import os # noqa
1819
import ssl
1920
from pathlib import Path
2021
from typing import Optional, Tuple
2122

2223
import Crypto.IO.PKCS8 as pkcs8
24+
25+
"""This environment variable is needed to prevent the "import pem" step is failing on MacOS.
26+
pem imports OpenSSL, which imports cryptography, which seems to fail as the MacOS version of OpenSSL doesn't seem to
27+
have the legacy algorithms required. Since we don't use any of these algorithms in this file, setting this environment
28+
variable solves the issue without problem.
29+
"""
30+
os.environ["CRYPTOGRAPHY_OPENSSL_NO_LEGACY"] = "true" # noqa
2331
import pem
2432
from cryptography import x509
2533
from cryptography.exceptions import UnsupportedAlgorithm

0 commit comments

Comments
 (0)