Skip to content

Commit

Permalink
recognize ed25519 key type and return PKCS8 format (#13257)
Browse files Browse the repository at this point in the history
* return pkcs8 format for ed25519 curve

convertRespToPKCS8 does not recognize the ed25519 key. Changes
to recognize ed25519 key and return its PKCS8 format
  • Loading branch information
navaneethrameshan authored and stevendpclark committed Nov 24, 2021
1 parent 79019d0 commit d776122
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builtin/logical/pki/cert_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,12 @@ func convertRespToPKCS8(resp *logical.Response) error {
signer, err = x509.ParsePKCS1PrivateKey(keyData)
case certutil.ECPrivateKey:
signer, err = x509.ParseECPrivateKey(keyData)
case certutil.Ed25519PrivateKey:
k, err := x509.ParsePKCS8PrivateKey(keyData)
if err != nil {
return fmt.Errorf("error converting response to pkcs8: error parsing previous key: %w", err)
}
signer = k.(crypto.Signer)
default:
return fmt.Errorf("unknown private key type %q", privKeyType)
}
Expand Down
3 changes: 3 additions & 0 deletions changelog/13257.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
secrets/pki: Recognize ed25519 when requesting a response in PKCS8 format
```

0 comments on commit d776122

Please sign in to comment.