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

Log error message when error is thrown in apns initialization #18

Merged
merged 1 commit into from
Apr 13, 2024

Conversation

jvergeldedios
Copy link
Contributor

TL; DR

This was swallowing errors from the a2 crate that would have been helpful to see. This PR adds logging to surface a more useful error message.

Background

I was attempting to setup fpush and got the following error on startup:

thread 'main' panicked at /home/ubuntu/fpush/fpush-push/src/lib.rs:64:91:
called `Result::unwrap()` on an `Err` value: PushErrors(PushEndpointTmp)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The error wasn't particularly descriptive, so I traced it to the fpush-apns package and added the logging in this PR.

After adding the logging this is what surfaced:

Error creating a signature: error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:../crypto/evp/evp_fetch.c:349:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()

For anyone who gets this error: I exported my push certificate from Keychain Access in macOS as a p12 file. What seems to be happening is that Keychain Access is encrypting the private key with an outdated algorithm and OpenSSL in the a2 crate is choking on it because that algorithm isn't loaded by default. I couldn't figure out a way to load the legacy provider in fpush so what I ended up doing was using the openssl cli tool to export the key to pem format using the -legacy flag, then convert it back to p12. Hope this helps someone not bash their head against a wall for 3 hours like I did.

@FriedrichAltheide FriedrichAltheide merged commit 7448e7c into monal-im:master Apr 13, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants