Skip to content

Commit

Permalink
fix: correctly encode assuan readkey response for ECDSA keys
Browse files Browse the repository at this point in the history
  • Loading branch information
smlx committed Oct 17, 2021
1 parent 8fe5c41 commit 49da8a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/assuan/readkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ func readKeyData(pub crypto.PublicKey) (string, error) {
switch k.Curve {
case elliptic.P256():
q := elliptic.Marshal(k.Curve, k.X, k.Y)
qLen := len(q)
q = PercentEncodeSExp(q)
return fmt.Sprintf(
"D (10:public-key(3:ecc(5:curve10:NIST P-256)(1:q%d:%s)))\nOK\n",
len(q), q), nil
qLen, q), nil
default:
return "", fmt.Errorf("unsupported curve: %T", k.Curve)
}
Expand Down

0 comments on commit 49da8a7

Please sign in to comment.