forked from TrueCloudLab/frostfs-crypto
rfc6979: Add tests for short r
and s
coordinates
This commit is contained in:
parent
1461d7a248
commit
c1e43f8727
1 changed files with 21 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/nspcc-dev/neofs-crypto/test"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -83,3 +84,23 @@ func TestRFC6979(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRFC6979_ShortDecodePoints(t *testing.T) {
|
||||||
|
key := test.DecodeKey(1)
|
||||||
|
|
||||||
|
msgs := []string{
|
||||||
|
"6341922933e156ea5a53b8ea3fa4a80c", // this msg has 31 byte `s` point
|
||||||
|
"61b863d81f72e0e0d0353b1cb90d62ce", // this msg has 31 byte 'r' point
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := range msgs {
|
||||||
|
msg, err := hex.DecodeString(msgs[i])
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
signature, err := SignRFC6979(key, msg)
|
||||||
|
require.NoError(t, err, msgs[i])
|
||||||
|
|
||||||
|
err = VerifyRFC6979(&key.PublicKey, msg, signature)
|
||||||
|
require.NoError(t, err, msgs[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue