-
Notifications
You must be signed in to change notification settings - Fork 338
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
chore: set beelocal branch to update-k3s-1.30.3 and go 1.23 upgrade #4878
Conversation
3bc2527
to
f8dee19
Compare
// TODO: check if this is the correct way to serialize the public key | ||
// Is this the only curve we support? | ||
// Should we have switch case for different curves? | ||
pubBytes := crypto.S256().Marshal(key.X, key.Y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since elliptic.Marshal
was deprecated is there a reason we are not using equivalent from crypto/ecdh
, similar with you have changed in pkg/keystore/file/key.go
? Reference: https://pkg.go.dev/crypto/elliptic#Marshal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we only have public key, and we could have something like this:
pubKey, err := key.ECDH()
if err != nil {
return nil, fmt.Errorf("generate key: %w", err)
}
b = append(b, pubKey.Bytes()...)
But unit tests will return: unsupported curve by crypto/ecdh
. Because of this I used specific curve that we are also using in NewEthereumAddress
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still relevant?
@@ -83,7 +83,11 @@ func encryptKey(k *ecdsa.PrivateKey, password string, edg keystore.EDG) ([]byte, | |||
} | |||
addr = a | |||
case elliptic.P256(): | |||
addr = elliptic.Marshal(elliptic.P256(), k.PublicKey.X, k.PublicKey.Y) | |||
privKey, err := k.ECDH() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a very simple unit test that shows that the result of elliptic.Marshal(elliptic.P256(), k.PublicKey.X, k.PublicKey.Y)
matches exactly the result of your changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is the commit with added tests... feel free to suggest any improvements
Also it seems that |
Checklist
Description
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):