Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RSA max key length test #2205

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}