Tag not monitored by Microsoft.
The error System.Security.Cryptography.CryptographicException: Key not valid for use in specified state with on-premises data gateways is associated with problems generating or accessing the asymmetric key material the gateway uses. A known cause is antivirus or security software corrupting or deleting the RSA key files that the gateway relies on during setup or runtime.
For on-premises data gateways, the documented remediation for asymmetric key issues is:
- Temporarily disable or reconfigure antivirus
- Antivirus products such as McAfee Endpoint Defender can interfere with the gateway’s cryptographic files and processes.
- Configure the antivirus to ignore the gateway process, or temporarily disable it while fixing the issue and testing.
- Remove the corrupted RSA key container for the gateway service account
- Delete the
RSAfolder under the profile of the gateway service account, for example:-
C:\Users<GW Service Account User>\AppData\Roaming\Microsoft\Crypto\RSA
-
- Note: Depending on whether the gateway is running under a user profile or a service profile, the root path can differ; ensure the correct profile for the gateway service account is used.
- Delete the
- Restart the machine and complete gateway setup/sign-in
- After deleting the RSA folder and adjusting antivirus, restart the gateway machine.
- Re-run the gateway setup/sign-in so new, valid keys are generated.
- Ensure all gateways are on a supported, current version
- Install the latest on-premises data gateway build on all affected machines. Only the last six releases are actively supported, and many reliability issues are resolved in monthly updates.
- If using gateway clusters, keep all members on the same version to avoid intermittent failures.
- Check for general gateway connectivity issues
- If 502 errors persist after fixing the cryptographic issue, verify that each gateway can reach required Azure endpoints and ports by running the network ports test and reviewing firewall/proxy configuration.
If, after these steps, the intermittent 502 and cryptographic errors continue across multiple gateways, open a support ticket for the cloud service using the gateway so logs and environment details can be reviewed.
References: