mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 09:59:13 +08:00
print out key if 'malformed'
This commit is contained in:
@ -3,6 +3,7 @@ package crypto
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
@ -105,7 +106,8 @@ func GenerateEKeyPair(curveName string) ([]byte, GenSharedKey, error) {
|
|||||||
curveSize := curve.Params().BitSize
|
curveSize := curve.Params().BitSize
|
||||||
|
|
||||||
if len(theirPub) != (curveSize / 4) {
|
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)
|
bound := (curveSize / 8)
|
||||||
|
Reference in New Issue
Block a user