Facing badmatch keyfile error while fetching APNS Socket

671 views Asked by At

Since i was facing unrecognised algorithm crash, I did the patching as mentioned here: http://erlang.org/pipermail/erlang-questions/2015-June/084870.html

The CRASH no longer appears but i do not get any APNS push notofications even after that. I have the sandbox environment at my end.

when i run on the ejabberd shell:

    mod_mymodule:get_socket().

I get:

{error,{keyfile,{badmatch,{error,{asn1,{invalid_length,6}}}}}}

My certificate and private RSA key file worked fine for several months until this popped up.

The get_socket() method definition is:

get_socket()->
 %%Options
  Options = [{certfile, ?Cert}, {keyfile, ?Key}, {mode, binary}],
  %%ssl connection
   ssl:connect(?Address, ?Port, Options, infinity) .

FYI, I have macros declared like:

-define(Cert,"/opt/ejabberd-14.07/bin/MantuPush/cert.pem").
-define(Key,"/opt/ejabberd-14.07/bin/MantuPush/finalkey.pem").

Note: I havent used the CSR here, since examples do not state it mandatory(Guessing!).

What could be wrong? What is the correct Certificate and Private key contents used with APNS?

Kindly help. Thanks

1

There are 1 answers

1
Mickaël Rémond On

This is an Erlang bug. Check out our Erlang pull request for quick hack and the discussion on Github: https://github.com/erlang/otp/pull/767

Here is the blog post explaining the issue: https://blog.process-one.net/apple-increasing-security-of-push-service-ahead-of-wwdc/