react-native-ssl-pinning icon indicating copy to clipboard operation
react-native-ssl-pinning copied to clipboard

The certificate for this server is invalid.

Open deepakverma4 opened this issue 2 years ago • 11 comments

I am getting The certificate for this server is invalid. error when creating request on iOS It is working fine for android but not working in iOS

my body is just like docs

fetch("https://publicobject.com", {
      method: "GET" ,
      timeoutInterval: 10000, // milliseconds
      // your certificates array (needed only in android) ios will pick it automatically
      pkPinning: true,
      sslPinning: {
        certs: ["sha256//r8udi/Mxd6pLO7y7hZyUMWq8YnFnIWXCqeHsTDRqy8=",
        "sha256/YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg="
      ]
      },
      headers: {
        Accept: "application/json; charset=utf-8", "Access-Control-Allow-Origin": "*", "e_platform": "mobile",
      }
	})

if we are using public key pinning then too we need to add the .cer file to xcode? Please help me solve this issue.

deepakverma4 avatar Mar 25 '22 05:03 deepakverma4

I'd try this: sslPinning: { certs: ['mycerfile'] // don't put an extension here. } Then drag and drop the .cer file into XCode.

joshwinter avatar Mar 25 '22 16:03 joshwinter

Getting the same issue as mentioned above in iOS. Is there any extra configuration required for iOS?

glrahulborah avatar Mar 29 '22 11:03 glrahulborah

No extra configuration is required for iOS. Be sure your project is checked in the popup after you drag it in your project. Remember it's not enough to have it exist in the file system, it needs to be specifically dragged in. Also, be sure eliminate the .cer extension in: certs: ['mycertfile']

joshwinter avatar Mar 29 '22 17:03 joshwinter

Wouldn't generating the certs and dragging them in the project will be equivalent to certificate pinning. I want to use the public key pinning specification similar to android as it will allow having backup public keys for the server also. Is there any workaround for this?

glrahulborah avatar Mar 30 '22 05:03 glrahulborah

Getting the same error. do I need to make sure that my project is checked in the popup after I drag the cert?

jalanya avatar Sep 20 '22 00:09 jalanya

if we are going with the public key pinning approach, doesn't make sense drop the certificate inside the project, the public key hash should be enough, what i'm missing here? ios version doesn't seens to be a valid implementation for PkPinning

rgomesrn avatar Jan 05 '23 02:01 rgomesrn

there's a solution for this problem? i'm getting the same issue

mariaeduardaes avatar Jan 09 '23 20:01 mariaeduardaes

Getting the same issue as mentioned above in iOS. there's a solution for this problem?

RAHUL-KALLAZHI avatar Mar 07 '23 10:03 RAHUL-KALLAZHI

i getting the same issue !!!

Moustafa-mahmaed avatar Mar 20 '23 20:03 Moustafa-mahmaed

Public Key pinning doesn't seem to be supported on iOS.

adamalexander avatar Apr 02 '23 06:04 adamalexander

Same issue here.....public key pinning is not working for ios.

sdevansh96 avatar Jul 03 '23 09:07 sdevansh96