From 8539da02d37c2d7493e0603cd92f40c682678959 Mon Sep 17 00:00:00 2001 From: David Stainton <dstainton@elixxir.io> Date: Thu, 8 Sep 2022 13:02:52 -0400 Subject: [PATCH] Fix TestRSABytesFromBytes as per code review --- signature/rsa/rsa_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/signature/rsa/rsa_test.go b/signature/rsa/rsa_test.go index a7a6a39..e8eeb75 100644 --- a/signature/rsa/rsa_test.go +++ b/signature/rsa/rsa_test.go @@ -13,6 +13,8 @@ import ( "crypto/rand" "crypto/sha256" "testing" + + "golang.org/x/crypto/blake2b" ) type CountingReader struct { @@ -235,4 +237,16 @@ func TestRSABytesFromBytes(t *testing.T) { if !bytes.Equal(serverPubKeyBytes, serverPubKey2Bytes) { t.Fatal("byte slices don't match") } + + message := []byte("fluffy bunny") + hashed := blake2b.Sum256(message) + signature, err := Sign(rand.Reader, serverPrivKey, crypto.BLAKE2b_256, hashed[:], nil) + if err != nil { + t.Fatal(err) + } + + err = Verify(serverPubKey2, crypto.BLAKE2b_256, hashed[:], signature, nil) + if err != nil { + t.Fatal(err) + } } -- GitLab