How to use SSL Pinning with cordova-plugin-advanced-http


#1

Would anyone have an example of how to enable the SSL Pinning with this plugin function? How do I put a certificate and set they? There are no examples of this function in the documentation.


#2

Check out https://github.com/silkimen/cordova-plugin-advanced-http#enablesslpinning

enableSSLPinning

Enable or disable SSL pinning. This defaults to false.

To use SSL pinning you must include at least one .cer SSL certificate in your app project. You can pin to your server certificate or to one of the issuing CA certificates. For ios include your certificate in the root level of your bundle (just add the .cer file to your project/target at the root level). For android include your certificate in your project’s platforms/android/assets folder. In both cases all .cer files found will be loaded automatically. If you only have a .pem certificate see this stackoverflow answer. You want to convert it to a DER encoded certificate with a .cer extension.

As an alternative, you can store your .cer files in the www/certificates folder.

cordova.plugin.http.enableSSLPinning(true, function() {
  console.log('success!');
}, function() {
  console.log('error :(');
});

#3

I put this on the app.componet.ts or in each page that i want to use?


#4

Did you get the solution? Currently, I am using HTTPClient. PLease help me out, i want to implement this part


#5

Did you manage to do it? Anyway I suspect you won’t be able to use HTTPClient by Angular anymore. You have to use https://github.com/silkimen/cordova-plugin-advanced-http


#6

Beginner level developers have no idea about How to generate .cer file for SSL Pinning
I found this helpful for people like me.


#7

SSL Pinning example :sunglasses:

This is a simplest example


#8

Can u please tell me where the root level of project/target is for iOS ??