ecdh secret must be 32 bytes

This commit is contained in:
Michele Balistreri 2022-08-03 11:51:23 +02:00
parent c19c144fd4
commit 7e337d802a
1 changed files with 1 additions and 1 deletions

View File

@ -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) {