Skip to content

Commit

Permalink
chore(keys): check-gen
Browse files Browse the repository at this point in the history
  • Loading branch information
LanfordCai committed Dec 23, 2020
1 parent 3105d1a commit bc8d565
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion keys/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ func ImportPrivateKey(privKeyHex string, curve types.CurveType) (*KeyPair, error
x, y := crv.ScalarBaseMult(privKey)

// IsOnCurve will return false for the point at infinity (0, 0)
// See: https://github.com/golang/go/blob/3298300ddf45a0792b4d8ea5e05f0fbceec4c9f9/src/crypto/elliptic/elliptic.go#L24
// See:
// https://github.com/golang/go/blob/3298300ddf45a0792b4d8ea5e05f0fbceec4c9f9/src/crypto/elliptic/elliptic.go#L24
if !crv.IsOnCurve(x, y) {
return nil, ErrPubKeyNotOnCurve
}
Expand Down
6 changes: 4 additions & 2 deletions keys/signer_secp256r1.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ func (s *SignerSecp256r1) Sign(
x, y := crv.ScalarBaseMult(s.KeyPair.PrivateKey)

// IsOnCurve will return false for the point at infinity (0, 0)
// See: https://github.com/golang/go/blob/3298300ddf45a0792b4d8ea5e05f0fbceec4c9f9/src/crypto/elliptic/elliptic.go#L24
// See:
// https://github.com/golang/go/blob/3298300ddf45a0792b4d8ea5e05f0fbceec4c9f9/src/crypto/elliptic/elliptic.go#L24
if !crv.IsOnCurve(x, y) {
return nil, ErrPubKeyNotOnCurve
}
Expand Down Expand Up @@ -130,7 +131,8 @@ func (s *SignerSecp256r1) Verify(signature *types.Signature) error {
x, y := elliptic.Unmarshal(elliptic.P256(), signature.PublicKey.Bytes)

// IsOnCurve will return false for the point at infinity (0, 0)
// See: https://github.com/golang/go/blob/3298300ddf45a0792b4d8ea5e05f0fbceec4c9f9/src/crypto/elliptic/elliptic.go#L24
// See:
// https://github.com/golang/go/blob/3298300ddf45a0792b4d8ea5e05f0fbceec4c9f9/src/crypto/elliptic/elliptic.go#L24
if !crv.IsOnCurve(x, y) {
return ErrPubKeyNotOnCurve
}
Expand Down

0 comments on commit bc8d565

Please sign in to comment.