Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29455

Android React native Expo-av certificate pinning

$
0
0

android: Q, react-native: 0.60 expo-sdk .35+

Our app uses certificate pinning with self-signed certificate.

This all works with React native nicely, because React native provides a hook to specify a custom OkHttp Client, that manages the pinned certificate. Very similar to example provided here https://medium.com/@jaedmuva/react-native-ssl-pinning-is-back-e317e6682642

Things like <Image source='https://domain.withcert.com/image.jpg' /> work well with this model, as react native, using its underlying okhttp mechanism, relies on the custom-provided OkHTTp client were we manage the certificate.

Now we are adding audio (via Expo-AV). Expo-AV uses Android Exoplayer2 audio library. That Audio library issues https request to our server, eg. https://domain.withcert.com/sound.mp3 The https handshake fails, and it shows up as

'Error: com.google.android.exomplayer2.upstream.HttpDataSource$HttpDataSourceExcception: Unable to connec to to https://domain.withcert.com/sound.mp3'

Because our server's https uses self-signed certificate.

Our Android client has pinned the public portion of that certificate -- however we cannot find way to instruct Expo-Av (and therefore, Android's Exoplayer2) to use it.

ExoPlayer2 uses same library as React-Native, OkHTTP. However, unlike react-native, Expo-AV does not instruct Android's ExoPlayer to use that overriden OkHTTP client from React-Native. (or at least I cannot see how, when examining expo-av Android source).

Is there way to overcome this limitation in some other way? For example, is there a way to override HTTPS certificate handling on Android client, globally for the whole app, rather than for a specific OkHTTP client instance or for a specific HttpsURLconnection (since our app does not have access to specific REST query construction mechanism in ExoPlayer2)


Viewing all articles
Browse latest Browse all 29455

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>