diff --git a/mockid/marshal.go b/mockid/marshal.go index 7b7dbdf..3db5cb5 100644 --- a/mockid/marshal.go +++ b/mockid/marshal.go @@ -53,14 +53,14 @@ func marshalDERPrivateKey(privkey keypairs.PrivateKey) (*pem.Block, error) { switch k := privkey.(type) { case *rsa.PrivateKey: - if 0 == mathrand.Intn(1) { - typ = "Private Key" + if 0 == mathrand.Intn(2) { + typ = "PRIVATE KEY" bytes, err = x509.MarshalPKCS8PrivateKey(k) if nil != err { return nil, err } } else { - typ = "RSA Private Key" + typ = "RSA PRIVATE KEY" bytes = x509.MarshalPKCS1PrivateKey(k) } return &pem.Block{ @@ -68,11 +68,11 @@ func marshalDERPrivateKey(privkey keypairs.PrivateKey) (*pem.Block, error) { Bytes: bytes, }, nil case *ecdsa.PrivateKey: - if 0 == mathrand.Intn(1) { - typ = "Private Key" + if 0 == mathrand.Intn(2) { + typ = "PRIVATE KEY" bytes, err = x509.MarshalPKCS8PrivateKey(k) } else { - typ = "EC Private Key" + typ = "EC PRIVATE KEY" bytes, err = x509.MarshalECPrivateKey(k) } if nil != err { diff --git a/mockid/route.go b/mockid/route.go index 00a73c3..1429810 100644 --- a/mockid/route.go +++ b/mockid/route.go @@ -227,7 +227,7 @@ func Route(jwksPrefix string, privkey keypairs.PrivateKey) http.Handler { } jwk := MarshalJWKPrivateKey(privkey) - w.Write(jwk) + w.Write(append(jwk, '\n')) }) http.HandleFunc("/priv.der", func(w http.ResponseWriter, r *http.Request) {