Skip to content

Commit

Permalink
updated to support current op keys incapsulation
Browse files Browse the repository at this point in the history
  • Loading branch information
AKorpusenko committed Apr 1, 2024
1 parent f9794d9 commit 888a7f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions message/validation/rsa_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ func BenchmarkVerifyRSASignature(b *testing.B) {
hash := sha256.Sum256(encodedMsg)
privateKey, err := rsa.GenerateKey(crand.Reader, 2048)
require.NoError(b, err)
pubkey := privateKey.Public().(*rsa.PublicKey)

pubKey, err := rsaencryption.ExtractPublicKey(privateKey)
pubKey, err := rsaencryption.ExtractPublicKey(pubkey)
require.NoError(b, err)

od := &registrystorage.OperatorData{
Expand Down Expand Up @@ -113,7 +114,7 @@ func BenchmarkVerifyRSASignature(b *testing.B) {

b.ResetTimer()
for i := 0; i < b.N; i++ {
err := mv.verifyRSASignature(messageData, operatorIDX, signature)
err := mv.verifySignature(messageData, operatorIDX, signature)
require.NoError(b, err)
}
}
2 changes: 1 addition & 1 deletion utils/rsaencryption/rsa_encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func PrivateKeyToByte(sk *rsa.PrivateKey) []byte {
)
}

// ExtractPublicKey get public key from private key and return base64 encoded public key
// ExtractPublicKey gets public key and returns base64 encoded public key
func ExtractPublicKey(pk *rsa.PublicKey) (string, error) {
pkBytes, err := x509.MarshalPKIXPublicKey(pk)
if err != nil {
Expand Down

0 comments on commit 888a7f8

Please sign in to comment.