Skip to content

Commit

Permalink
Add RSA max key length test (#2205)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Oct 23, 2023
1 parent d3287dd commit 020e802
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Binary file added staking/large_rsa_key.cert
Binary file not shown.
Binary file added staking/large_rsa_key.sig
Binary file not shown.
30 changes: 30 additions & 0 deletions staking/verify_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package staking

import (
"testing"

_ "embed"

"github.com/stretchr/testify/require"
)

var (
//go:embed large_rsa_key.cert
largeRSAKeyCert []byte
//go:embed large_rsa_key.sig
largeRSAKeySig []byte
)

func TestCheckSignatureLargePublicKey(t *testing.T) {
require := require.New(t)

cert, err := ParseCertificate(largeRSAKeyCert)
require.NoError(err)

msg := []byte("TODO: put something clever")
err = CheckSignature(cert, msg, largeRSAKeySig)
require.ErrorIs(err, ErrInvalidRSAPublicKey)
}

0 comments on commit 020e802

Please sign in to comment.