From 7e337d802aea1f26778d82cd6a542f84d8a51e85 Mon Sep 17 00:00:00 2001 From: Michele Balistreri Date: Wed, 3 Aug 2022 11:51:23 +0200 Subject: [PATCH] ecdh secret must be 32 bytes --- crypto/crypto.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/crypto.go b/crypto/crypto.go index 5d03567..7352a18 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -21,7 +21,7 @@ var ErrInvalidCardCryptogram = errors.New("invalid card cryptogram") func GenerateECDHSharedSecret(priv *ecdsa.PrivateKey, pub *ecdsa.PublicKey) []byte { x, _ := crypto.S256().ScalarMult(pub.X, pub.Y, priv.D.Bytes()) - return x.Bytes() + return x.FillBytes(make([]byte, 32)) } func VerifyCryptogram(challenge []byte, pairingPass string, cardCryptogram []byte) ([]byte, error) {