-
Notifications
You must be signed in to change notification settings - Fork 81
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
crypto: add Secp256k1 support #1175
Conversation
4f88d5e
to
0e86da1
Compare
Codecov Report
@@ Coverage Diff @@
## master #1175 +/- ##
==========================================
- Coverage 66.71% 66.70% -0.01%
==========================================
Files 198 198
Lines 16800 16829 +29
==========================================
+ Hits 11208 11226 +18
- Misses 4995 5006 +11
Partials 597 597
Continue to review full report at Codecov.
|
7e10cc1
to
9404bbc
Compare
type PrivateKey struct { | ||
b []byte | ||
ecdsa.PrivateKey |
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.
type Private ecdsa.PrivateKey
? I mean, this struct
wrapper seems to be useless now.
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.
In this case method (*keys.PrivateKey).PublicKey()
duplicates field (ecdsa.PrivateKey).PublicKey
. At the same time we cannot remove the method as we need to have access to keys.PublicKey
via keys.PrivateKey
(not to ecdsa.PublicKey
). So we can either rename (*keys.PrivateKey).PublicKey()
or let PrivateKey remain a struct. What do you prefer?
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.
OK, let it be a struct for now, we can refactor it later.
pkg/crypto/keys/private_key.go
Outdated
@@ -38,17 +48,35 @@ func NewPrivateKeyFromHex(str string) (*PrivateKey, error) { | |||
return NewPrivateKeyFromBytes(b) | |||
} | |||
|
|||
// NewPrivateKeyFromBytes returns a NEO PrivateKey from the given byte slice. | |||
// NewPrivateKeyFromBytes returns a NEO Secp256k1 PrivateKey from the given |
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.
It's r1.
pkg/crypto/keys/publickey.go
Outdated
type PublicKey struct { | ||
X *big.Int | ||
Y *big.Int | ||
ecdsa.PublicKey |
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.
type Public ecdsa.PublicKey
Now we have not only Random EC curve, but also Koblitz curve, so it will be useful to have information about the curve for each particular EC point. ecdsa.PublicKey has this information.
…ECDsaSecp256r1 Part of #918
9404bbc
to
063a7f6
Compare
closes #918