Android SSL Pinning
With Android SDK version 3.15.0, Netmera introduced SSL Pinning support to enhance the security of client-server communications. SSL Pinning ensures that only trusted SSL certificates are used during HTTPS communication. This feature is particularly important for applications handling sensitive user data.
Configuring SSL Pinning
To implement SSL Pinning, specify the trusted SSL certificate hashes using the sslPinKeys
method in the NetmeraConfiguration.Builder. Below are examples for setting up SSL pinning with both a single certificate and multiple certificates.
Single SSL Pin
The following code demonstrates how to configure SSL Pinning with a single trusted SSL certificate hash:
Multiple SSL Pins
For environments where multiple certificates are trusted (e.g., during certificate transitions or backups), configure SSL Pinning with a list of hashes:
Error Logs
In cases where the SSL certificate used by the server does not match the configured pins, the application will log an error and terminate the connection to prevent insecure communication.
Example Error Log for Invalid SSL Pins:
When Improper SSL Pinning Is Configured:
Last updated