Skip to content

Commit

Permalink
Encode public key in PKIX format
Browse files Browse the repository at this point in the history
  • Loading branch information
erickskrauch committed Jun 20, 2024
1 parent 7355c03 commit 64602e6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/http/profilecerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,16 @@ func (s *ProfilesCertificatesApi) getPublicKeysHandler(c *gin.Context) {
return
}

encodedPublicKey, err := x509.MarshalPKIXPublicKey(publicKey)
if err != nil {
c.Error(fmt.Errorf("unable to encode public key: %w", err))
return
}

c.JSON(http.StatusOK, gin.H{
"playerCertificateKeys": []map[string][]byte{
{
"publicKey": x509.MarshalPKCS1PublicKey(publicKey),
"publicKey": encodedPublicKey,
},
},
})
Expand Down

0 comments on commit 64602e6

Please sign in to comment.