ampproject / ampproject/amppackager

failed to parse private key file

Open
#297 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
141
Forks
46
PR merge metrics
No merged PRs in 30d

Description

I followed the instructions outlined here to create a private key to be used for `amppkg`:
> https://github.com/WICG/webpackage/tree/master/go/signedexchange

```
# Generate prime256v1 ecdsa private key.
openssl ecparam -out priv.key -name prime256v1 -genkey
```

I create a CSR, have it issued by digicert with CanSignHttpExchanges enabled (`cert-chain.pem`).

If I run locally with these amppkg.toml:
```
Port = 8080
CertFile = './pems/cert-chain.pem'
KeyFile = './pems/priv.key'
OCSPCache = '/tmp/amppkg-ocsp'

[[URLSet]]
[URLSet.Sign]
Domain = "this-is-my-domain.dev"
```
> go run amppkg/main.go

I get:
> failed to parse private key file

But I am able to sign again a CRS with that same private key again. And the file looks similar to this:
>https://github.com/Warashi/try-amppackager/blob/8352bef109ca63eac1de58491edff44f66ec7d39/certs/server.privkey

Not sure what to try now. Anyone have any idea?

Contributor guide

Open the contributing guide

Research direction

Start with amppkg/main.go and reproduce the failure using the amppkg.toml, cert-chain.pem, and priv.key details provided. Trace how KeyFile is parsed and compare the accepted format with the prime256v1 key generated by the shown OpenSSL command. Done means this configuration no longer reports “failed to parse private key file” while the existing signing workflow remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.