Farbschema: Riviera
Sie befinden sich hier: start » en » Documentation » Post-Quantum Cryptography » WKL.System.Security.Cryptography overview » Troubleshooting » OpenSSL doesn't load

OpenSSL doesn't load

PostQuantumConfig.EnablePostQuantum or the first operation with a PQ part throws a CryptographicException with one of these messages:

PostQuantumConfig.OpenSslPath 'C:\OpenSSL\bin' does not exist.
'libcrypto-3-x64.dll' not found in PostQuantumConfig.OpenSslPath 'C:\OpenSSL\bin'.
'libcrypto.so.3' not found in the default library search path. Install OpenSSL 3.5 or later, or set PostQuantumConfig.OpenSslPath.
OpenSSL 3.0.0 or higher required. Found version 1.1.1 in 'C:\OpenSSL\bin\libcrypto-3-x64.dll'.
Cannot load 'C:\OpenSSL\bin\libcrypto-3.dll': Win32 error 193 (a 32-bit process needs the x86 build of OpenSSL).
PostQuantumConfig.OpenSslPath was changed to 'D:\other' after libcrypto had been loaded from 'C:\OpenSSL\bin\libcrypto-3-x64.dll'. Set OpenSslPath before the first cryptographic operation.

Environment

All targets that use the OpenSSL provider: .NET Framework, .NET Core 3.1, and .NET 8 on Windows, Linux, and macOS. Blazor WebAssembly isn't affected, because it brings OpenSSL along as a WebAssembly module.

Cause

The library loads libcrypto once per process, either from PostQuantumConfig.OpenSslPath or, if that isn't set, through the operating system's library search. It then checks that the file has the OpenSSL 3 API, that is, version 3.0 or later. The message tells you which step failed:

MessageCause
does not existThe folder in OpenSslPath doesn't exist.
not found in PostQuantumConfig.OpenSslPathThe folder doesn't contain a file with the name that the operating system and the process architecture require.
not found in the default library search pathWithout OpenSslPath, the operating system's search didn't find libcrypto.
or higher required. Found versionThe file has the name of an OpenSSL 3 library but is older than 3.0, for example a renamed copy.
Win32 error 193The file doesn't match the process architecture, for example a 64-bit DLL in a 32-bit process.
was changed to … after libcrypto had been loadedOpenSslPath changed after the first load. The library doesn't switch installations within a process.

Resolution

  1. Install OpenSSL 3.5 or later for the process architecture: 64-bit, 32-bit, or Arm. Starting with 3.5, the default provider offers ML-DSA and ML-KEM.
  2. When your app starts, set PostQuantumConfig.OpenSslPath to the folder that contains libcrypto, before the first cryptographic operation runs. On Windows, that's the installation's bin folder.
  3. Check the file name: libcrypto-3-x64.dll (64-bit Windows), libcrypto-3.dll (32-bit Windows), libcrypto-3-arm64.dll (Windows on Arm), libcrypto.so.3 (Linux), libcrypto.3.dylib (macOS).
  4. Don't change OpenSslPath after startup. To use a different installation, restart the process.

After a failed EnablePostQuantum, PostQuantumConfig.InitializationError contains the message, and DefaultMode keeps its previous value. For how to set up OpenSSL, see Configure OpenSSL. If OpenSSL loads but doesn't provide ML-DSA or ML-KEM, see OpenSSL doesn't provide ML-DSA or ML-KEM.

en/wiki/pqcrypt/lib/troubleshooting/openssl-not-loaded.txt · Zuletzt geändert: von Wolfgang van der Stille