diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs b/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs index 2fa748a23ace0a..ae8d49719643ea 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs @@ -587,7 +587,7 @@ private static void CheckBoolReturn(int returnValue) { if (returnValue != 1) { - throw new CryptographicException(); + throw new CryptographicException(); } } @@ -810,6 +810,11 @@ public override bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan sign int ret = Interop.AndroidCrypto.RsaVerificationPrimitive(signature, unwrapped, rsa); CheckReturn(ret); + if (ret == 0) + { + // Return value of 0 from RsaVerificationPrimitive indicates the signature could not be decrypted. + return false; + } Debug.Assert( ret == requiredBytes,