Skip to content

crypto/x509: failed to parse ECDSA256 PEM generated by Apple Developer Website #33560

Description

@QianNangong

What version of Go are you using (go version)?

1.12.7

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GOOS="darwin"
GOARCH="amd64"

What did you do?

I'm trying to build a Apple Push Notification Service server with github.com/dgrijalva/jwt-go, which can generate token to communicate with Apple's server.
I downloaded the ECDSA256 private key(.pem file) from Apple Developer Website and tried to form the token using built-in parser.
I've regenerated the private key more than two times and it always occur.

This key is already revoked so I think it's safe to attach here

-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgK4vwsbmI8Zv5L3Vi
3A6jLxpPhT1foluxAzVrF8HUz0+gCgYIKoZIzj0DAQehRANCAASiiOmidKO8QG/1
uxIzl8g8yqYDCmImljypqZxutYg1YaMJuBpgfFCJdtp+SdYhq8J8avOMwDwep8KC
lfN6cID4
-----END PRIVATE KEY-----

What did you expect to see?

No error should be presented.

What did you see instead?

It presented such error messages.

2019/08/09 14:56:14 x509: failed to parse EC private key: asn1: structure error: tags don't match (4 vs {class:0 tag:16 length:19 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false}  @5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions