Netmera Developer Guide
Netmera Docs
  • Netmera Developer Guide
  • Platforms
    • iOS
      • New iOS (Swift)
        • SDK Integration
        • Push Notifications
          • Delegate Methods
          • Widget and In-App Messages
          • Media Push
          • Carousel, Slider and Thumbnail Push
        • Deep Linking
          • Custom Deep Links
        • Sound & Vibration
        • Push Inbox
        • Events
        • Geofence & Location
        • User Attributes & Preferences
        • Advertising ID
        • Changelog
      • Former iOS (Objective-C)
        • SDK Integration
        • Push Notifications
          • Delegate Methods
          • Push Payload Receivers
          • Widget and In-App Messages
          • Customizing In-App Messages
          • Media Push
          • Carousel, Slider and Thumbnail Push
          • Custom Web View Presentation
          • Push Icon
        • Live Activities
        • Deep Linking
          • Custom Deep Links
        • Sound & Vibration
        • Push Inbox
        • Events
        • Geofence & Location
        • User Attributes & Preferences
        • Data Transfer
        • Advertising ID
        • SSL Pinning
        • Changelog
    • Android
      • SDK Integration
        • Huawei Integration
        • Huawei Message Receipt
        • Android Integration FAQs
      • Push Notifications
        • Widget and In-App Messages
        • Push Callbacks
        • Custom Web View Presentation
        • Push Icon
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
        • Background Location Permission
      • User & Attributes
      • Data Transfer
      • Advertising ID
      • App Tracking
      • SSL Pinning
      • Changelog
    • Web
      • SDK Setup
        • Self-Hosted SDK Setup
      • Mobile Web Push for iOS
      • Deep Linking
        • Custom Deep Links
      • Events
      • User & Attributes
    • React Native
      • SDK Integration
      • Push Notifications
        • Widget and In-App Messages
        • Push Callbacks
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
      • User & Attributes
      • Changelog
    • Flutter
      • SDK Integration
      • Push Notifications
        • Push Notification Permissions
        • Widget and In-App Messages
        • Flutter iOS Media Push
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
      • User & Attributes
      • SSL Pinning
      • Changelog
    • Cordova
      • SDK Integration
      • Push Notifications
      • Sound & Vibration
      • Push Inbox
      • Events
      • User & Attributes
    • Unity
      • SDK Integration
      • Sound & Vibration
      • Events
      • User & Attributes
      • Changelog
  • Integrated Modules
    • Optimove
    • Adjust
    • Mixpanel
    • IYS Integration
    • VIA Integration
      • Short URL Consent Requests
      • OTP Consent Requests
        • OTP Confirmation Completion
      • VIA Email Rejection Link Generation
      • ETK Rejection via SMS
  • API Documentation
    • REST API
      • Setup
      • Notifications
      • Events
      • User & Device Management
      • Inbox Feature
      • GDPR
      • Error Responses
  • FAQs
    • Push Notifications FAQs
Powered by GitBook
On this page
  • Configuring SSL Pinning
  • Single SSL Pin
  • Multiple SSL Pins
  • Handling SSL Pinning Errors

Was this helpful?

  1. Platforms
  2. Flutter

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 Android SDK v3.15.0 or above.

Configuring SSL Pinning

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

Single SSL Pin

Use this code to pin a single SSL certificate:

NetmeraConfiguration.Builder configBuilder = new NetmeraConfiguration.Builder();

configBuilder
    .baseUrl(baseUrl)
    .apiKey(apiKey)
    .huaweiSenderId(PropertiesUtil.huaweiSenderId)
    .firebaseSenderId(PropertiesUtil.gcmSenderId)
    .logging(true)
    // Set SSL pin keys
    .sslPinKeys(
        // Replace with the correct sha256 hash
        "sha256/T9g7qeNuY3SHc4tWSlqoHwWb+0Y8whUYn0uuAB3CzHM="
    );

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):

List<String> sslPinKeys = Arrays.asList(
    // Replace with correct sha256 hashes
    "sha256/A1C7RK0nAsHviju64ImO48VgSY5FdOMxv9GJh0uMXJQ=",
    "sha256/8Rw90Ej3Ttt8RRkrg+WYDS9n7IS03bk5bjP/UXPtaY8=",
    "sha256/Ko8tivDrEjiY90yGasP6ZpBU4jwXvHqVvQI0GS3GNdA="
);

NetmeraConfiguration.Builder configBuilder = new NetmeraConfiguration.Builder();

configBuilder
    .baseUrl(baseUrl)
    .apiKey(apiKey)
    .huaweiSenderId(PropertiesUtil.huaweiSenderId)
    .firebaseSenderId(PropertiesUtil.gcmSenderId)
    .logging(true)
    // Set SSL pin keys
    .sslPinKeys(sslPinKeys);

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

PreviousUser & AttributesNextChangelog

Last updated 2 months ago

Was this helpful?