1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 01:52:26 +08:00

print out key if 'malformed'

This commit is contained in:
Juan Batiz-Benet
2014-10-05 14:50:30 -07:00
parent a13baff33d
commit 7e83982247

View File

@ -3,6 +3,7 @@ package crypto
import (
"bytes"
"errors"
"fmt"
"crypto/elliptic"
"crypto/hmac"
@ -105,7 +106,8 @@ func GenerateEKeyPair(curveName string) ([]byte, GenSharedKey, error) {
curveSize := curve.Params().BitSize
if len(theirPub) != (curveSize / 4) {
return nil, errors.New("Malformed public key.")
u.PErr("Malformed public key: %v", theirPub)
return nil, fmt.Errorf("Malformed public key: %v != %v", len(theirPub), (curveSize / 4))
}
bound := (curveSize / 8)