@cryptotaxi247 / kubo / commits / 7e8398224

print out key if 'malformed'

Juan Batiz-Benet committed Oct 5, 2014 at 14:50 UTC 7e83982247e004fa923e33ee206f6bc43a7ff1ff
1 file changed +3 -1
crypto/key.go
+3 -1
@@ -3,6 +3,7 @@ package crypto
3 import (
4 "bytes"
5 "errors"
6 + "fmt"
7
8 "crypto/elliptic"
9 "crypto/hmac"
@@ -105,7 +106,8 @@ func GenerateEKeyPair(curveName string) ([]byte, GenSharedKey, error) {
106 curveSize := curve.Params().BitSize
107
108 if len(theirPub) != (curveSize / 4) {
108 - return nil, errors.New("Malformed public key.")
109 + u.PErr("Malformed public key: %v", theirPub)
110 + return nil, fmt.Errorf("Malformed public key: %v != %v", len(theirPub), (curveSize / 4))
111 }
112
113 bound := (curveSize / 8)