secp256r1

package
v1.0.1-0...-86249ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package secp256r1 implements Cosmos-SDK compatible ECDSA public and private key. The keys can be protobuf serialized and packed in Any.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthKeys        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowKeys          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces adds secp256r1 PubKey to pubkey registry

Types

type PrivKey

type PrivKey struct {
	// secret number serialized using big-endian encoding
	Secret *ecdsaSK `protobuf:"bytes,1,opt,name=secret,proto3,customtype=ecdsaSK" json:"secret,omitempty"`
}

PrivKey defines a secp256r1 ECDSA private key.

func GenPrivKey

func GenPrivKey() (*PrivKey, error)

GenPrivKey generates a new secp256r1 private key. It uses operating system randomness.

func (*PrivKey) Bytes

func (m *PrivKey) Bytes() []byte

Bytes serialize the private key.

func (*PrivKey) Descriptor

func (*PrivKey) Descriptor() ([]byte, []int)

func (*PrivKey) Equals

func (m *PrivKey) Equals(other cryptotypes.LedgerPrivKey) bool

Equals implements SDK PrivKey interface.

func (*PrivKey) Marshal

func (m *PrivKey) Marshal() (dAtA []byte, err error)

func (*PrivKey) MarshalTo

func (m *PrivKey) MarshalTo(dAtA []byte) (int, error)

func (*PrivKey) MarshalToSizedBuffer

func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PrivKey) ProtoMessage

func (*PrivKey) ProtoMessage()

func (*PrivKey) PubKey

func (m *PrivKey) PubKey() cryptotypes.PubKey

PubKey implements SDK PrivKey interface.

func (*PrivKey) Reset

func (m *PrivKey) Reset()

func (*PrivKey) Sign

func (m *PrivKey) Sign(msg []byte) ([]byte, error)

Sign hashes and signs the message usign ECDSA. Implements sdk.PrivKey interface.

func (*PrivKey) Size

func (m *PrivKey) Size() (n int)

func (*PrivKey) String

func (m *PrivKey) String() string

String implements SDK proto.Message interface.

func (*PrivKey) Type

func (m *PrivKey) Type() string

Type returns key type name. Implements SDK PrivKey interface.

func (*PrivKey) Unmarshal

func (m *PrivKey) Unmarshal(dAtA []byte) error

func (*PrivKey) XXX_DiscardUnknown

func (m *PrivKey) XXX_DiscardUnknown()

func (*PrivKey) XXX_Marshal

func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PrivKey) XXX_Merge

func (m *PrivKey) XXX_Merge(src proto.Message)

func (*PrivKey) XXX_MessageName

func (*PrivKey) XXX_MessageName() string

func (*PrivKey) XXX_Size

func (m *PrivKey) XXX_Size() int

func (*PrivKey) XXX_Unmarshal

func (m *PrivKey) XXX_Unmarshal(b []byte) error

type PubKey

type PubKey struct {
	// Point on secp256r1 curve in a compressed representation as specified in section
	// 4.3.6 of ANSI X9.62: https://webstore.ansi.org/standards/ascx9/ansix9621998
	Key *ecdsaPK `protobuf:"bytes,1,opt,name=key,proto3,customtype=ecdsaPK" json:"key,omitempty"`
}

PubKey defines a secp256r1 ECDSA public key.

func (*PubKey) Address

func (m *PubKey) Address() tmcrypto.Address

Address implements SDK PubKey interface.

func (*PubKey) Bytes

func (m *PubKey) Bytes() []byte

Bytes implements SDK PubKey interface.

func (*PubKey) Descriptor

func (*PubKey) Descriptor() ([]byte, []int)

func (*PubKey) Equals

func (m *PubKey) Equals(other cryptotypes.PubKey) bool

Equals implements SDK PubKey interface.

func (*PubKey) Marshal

func (m *PubKey) Marshal() (dAtA []byte, err error)

func (*PubKey) MarshalTo

func (m *PubKey) MarshalTo(dAtA []byte) (int, error)

func (*PubKey) MarshalToSizedBuffer

func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PubKey) ProtoMessage

func (*PubKey) ProtoMessage()

func (*PubKey) Reset

func (m *PubKey) Reset()

func (*PubKey) Size

func (m *PubKey) Size() (n int)

func (*PubKey) String

func (m *PubKey) String() string

String implements proto.Message interface.

func (*PubKey) Type

func (m *PubKey) Type() string

Type returns key type name. Implements SDK PubKey interface.

func (*PubKey) Unmarshal

func (m *PubKey) Unmarshal(dAtA []byte) error

func (*PubKey) VerifySignature

func (m *PubKey) VerifySignature(msg []byte, sig []byte) bool

VerifySignature implements SDK PubKey interface.

func (*PubKey) XXX_DiscardUnknown

func (m *PubKey) XXX_DiscardUnknown()

func (*PubKey) XXX_Marshal

func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PubKey) XXX_Merge

func (m *PubKey) XXX_Merge(src proto.Message)

func (*PubKey) XXX_MessageName

func (*PubKey) XXX_MessageName() string

func (*PubKey) XXX_Size

func (m *PubKey) XXX_Size() int

func (*PubKey) XXX_Unmarshal

func (m *PubKey) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL