With Sentry Android SDK (io.sentry:sentry-android:5.0.1
) - is there any way to pass custom HostnameVerifier or SHA-256/SHA-1 of SSL cert to authorize the usage of self-signed certs?
Currently I'm getting:
javax.net.ssl.SSLPeerUnverifiedException: Hostname xxxx not verified:
certificate: sha1/xxxx
DN: CN=xxxx
subjectAltNames: []
I already passed SHA-256 for that domain in my networkSecurityConfig XML file however it seems like it doesn't take that into account.
You can set one in through the options:
SentryAndroid.init(o -> {
o.setHostnameVerifier(...);
o.setDsn(...);
// other options
});
Note that if you're going to initialize programatically as I suggest above, you shouldn't add the configuration via the AndroidManifest.xml
meta-data
anymore.
Docs about this are here: https://docs.sentry.io/platforms/android/configuration/manual-init/