Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: wrong cert format makes app crash during request #84

Open
silkimen opened this issue Mar 2, 2018 · 2 comments
Open

iOS: wrong cert format makes app crash during request #84

silkimen opened this issue Mar 2, 2018 · 2 comments
Labels

Comments

@silkimen
Copy link
Owner

silkimen commented Mar 2, 2018

Enabling SSL pinning does not fail when certificates in wrong format (e.g. PEM encoded one) are used on iOS. But later on the app crashes when you try to send a request.

@silkimen silkimen added the bug label Mar 2, 2018
@kevto
Copy link

kevto commented Apr 30, 2018

We're experiencing the same issue. The app throws an "uncaught exception": *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

@kevto
Copy link

kevto commented Apr 30, 2018

For anyone who runs into this issue, according to the plugin's documentation it is indeed required to have the .cer files encoded with DER.

To make validate if the .cer file is encoded with DER:
openssl x509 -in <your_file.cer> -inform der -text -noout
If it throws an error like:

unable to load certificate
13978:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1306:
13978:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:380:Type=X509

Then you know your .cer file is not encoded with DER. To transform the PEM encoded file to DER, use:
openssl x509 -in <input.cer> -outform der -out <output.cer>

Source: https://info.ssl.com/article.aspx?id=12149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants