mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 09:42:22 +00:00
keys: make public key's IsInfinity() public
It's gonna be used in interops for key validity check.
This commit is contained in:
parent
c5a4cfaebe
commit
7ab58ff8cb
1 changed files with 4 additions and 4 deletions
|
@ -61,7 +61,7 @@ func NewPublicKeyFromString(s string) (*PublicKey, error) {
|
|||
|
||||
// Bytes returns the byte array representation of the public key.
|
||||
func (p *PublicKey) Bytes() []byte {
|
||||
if p.isInfinity() {
|
||||
if p.IsInfinity() {
|
||||
return []byte{0x00}
|
||||
}
|
||||
|
||||
|
@ -225,14 +225,14 @@ func (p *PublicKey) Verify(signature []byte, hash []byte) bool {
|
|||
return ecdsa.Verify(publicKey, hash, rBytes, sBytes)
|
||||
}
|
||||
|
||||
// isInfinity checks if point P is infinity on EllipticCurve ec.
|
||||
func (p *PublicKey) isInfinity() bool {
|
||||
// IsInfinity checks if the key is infinite (null, basically).
|
||||
func (p *PublicKey) IsInfinity() bool {
|
||||
return p.X == nil && p.Y == nil
|
||||
}
|
||||
|
||||
// String implements the Stringer interface.
|
||||
func (p *PublicKey) String() string {
|
||||
if p.isInfinity() {
|
||||
if p.IsInfinity() {
|
||||
return "00"
|
||||
}
|
||||
bx := hex.EncodeToString(p.X.Bytes())
|
||||
|
|
Loading…
Reference in a new issue