Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi, im receiving the above error when trying to read the private key from apple.

i converted the p8 file from apple using

openssl pkcs8 -nocrypt -in AuthKey_4SND569782.p8 -out AuthKeyNEW.pem

When running the code i get:

java.io.IOException: Could not find private key header/footer
        at com.eatthepath.pushy.apns.auth.ApnsSigningKey.loadFromInputStream(ApnsSigningKey.java:151)
        at org.whispersystems.textsecuregcm.push.RetryingApnsClient.<init>(RetryingApnsClient.java:52)
        at org.whispersystems.textsecuregcm.push.APNSender.<init>(APNSender.java:62)
        at org.whispersystems.textsecuregcm.WhisperServerService.run(WhisperServerService.java:315)
        at org.whispersystems.textsecuregcm.WhisperServerService.run(WhisperServerService.java:177)
        at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
        at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
        at io.dropwizard.cli.Cli.run(Cli.java:78)
        at io.dropwizard.Application.run(Application.java:94)
        at org.whispersystems.textsecuregcm.WhisperServerService.main(WhisperServerService.java:500)

any help really appreciated !
a

You must be logged in to vote

Replies: 1 comment

Comment options

Well, if we take a look at ApnsSigningKey#loadFromInputStream, we can see that this exception gets thrown if we can't find a line that contains "BEGIN PRIVATE KEY" and a lone that contains "END PRIVATE KEY":

for (String line; (line = reader.readLine()) != null; ) {
if (!haveReadHeader) {
if (line.contains("BEGIN PRIVATE KEY")) {
haveReadHeader = true;
}
} else {
if (line.contains("END PRIVATE KEY")) {
haveReadFooter = true;
break;
} else {
privateKeyBuilder.append(line);
}
}
}
if (!(haveReadHeader && haveReadFooter)) {
throw new IOException("Could not find private key header/footer");
}

If you look at your key file, do you see those lines? Also, I'm a little surprised your initial .p8 file isn't already in the expected format. Are you sure you need to use openssl to convert it to a PEM file?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.