SSL Pinning

SSL Pinning ensures secure communication by allowing only trusted SSL certificates, which is critical for apps handling sensitive user data. To use this feature, integrate React Native SDK v1.8.0 or above.

iOS

To enable SSL Pinning on iOS, follow the SSL Pinning guide.

Android

Configuring SSL Pinning

Specify the trusted SSL certificate hash in RNNetmeraConfiguration.Builder using the sslPinKeys method.

Single SSL Pin

Use this code to pin a single SSL certificate:

val netmeraConfiguration = RNNetmeraConfiguration.Builder()
    .huaweiSenderId(BuildConfig.HMS_SENDER_ID)
    .firebaseSenderId(BuildConfig.GCM_SENDER_ID)
    .apiKey(apiKey)
    .baseUrl(baseUrl)
    .logging(true)
    // Set SSL pin keys
    .sslPinKeys(
        // Replace with the correct sha256 hash
        "sha256/T9g7qeNuY3SHc4tWSlqoHwWb+0Y8whUYn0uuAB3CzHM="
    ).build(this)

RNNetmera.initNetmera(netmeraConfiguration)

Multiple SSL Pins

Use this code to pin multiple SSL certificates for environments where multiple certificates are trusted (e.g., during certificate transitions or backups):

Handling SSL Pinning Errors

If the server's SSL certificate doesn't match the pinned keys, the app will log an error and terminate the connection.

Error Log for Invalid SSL Pins

If Improper SSL Pinning Is Configured

Last updated

Was this helpful?