From 56f6609907f7f4269ae1766bc664f406866ca54f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=A0imon=20Rozs=C3=ADval?= Date: Mon, 30 Jan 2023 11:02:08 +0100 Subject: [PATCH] [Android] Fix SslStream IsMutuallyAuthenticated on Android API 21-27 --- .../System.Security.Cryptography.Native.Android/pal_sslstream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/native/libs/System.Security.Cryptography.Native.Android/pal_sslstream.c b/src/native/libs/System.Security.Cryptography.Native.Android/pal_sslstream.c index 090bf1e..37be72d 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Android/pal_sslstream.c +++ b/src/native/libs/System.Security.Cryptography.Native.Android/pal_sslstream.c @@ -1147,10 +1147,13 @@ bool AndroidCryptoNative_SSLStreamIsLocalCertificateUsed(SSLStream* sslStream) JNIEnv* env = GetJNIEnv(); bool ret = false; - INIT_LOCALS(loc, localCertificates); + INIT_LOCALS(loc, sslSession, localCertificates); // X509Certificate[] localCertificates = sslSession.getLocalCertificates(); - loc[localCertificates] = (*env)->CallObjectMethod(env, sslStream->sslSession, g_SSLSessionGetLocalCertificates); + loc[sslSession] = GetCurrentSslSession(env, sslStream); + ON_EXCEPTION_PRINT_AND_GOTO(cleanup); + + loc[localCertificates] = (*env)->CallObjectMethod(env, loc[sslSession], g_SSLSessionGetLocalCertificates); ON_EXCEPTION_PRINT_AND_GOTO(cleanup); ret = loc[localCertificates] != NULL; -- 2.7.4