sm2

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrivKeyName = "cosmos/PrivKeySm2"
	PubKeyName  = "cosmos/PubKeySm2"

	PrivKeySize   = 32
	PubKeySize    = 33
	SignatureSize = 64
)

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

This section is empty.

Types

type PrivKey

type PrivKey struct {
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
}

PrivKey defines a secp256k1 private key.

func GenPrivKey

func GenPrivKey() PrivKey

func GenPrivKeyFromSecret

func GenPrivKeyFromSecret(secret []byte) PrivKey

func (PrivKey) Bytes

func (privKey PrivKey) Bytes() []byte

func (*PrivKey) Descriptor

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

func (PrivKey) Equals

func (privKey PrivKey) Equals(other cryptotypes.LedgerPrivKey) bool

func (*PrivKey) GetKey

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

func (PrivKey) GetPrivateKey

func (privKey PrivKey) GetPrivateKey() *sm2.PrivateKey

func (*PrivKey) Marshal

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

func (PrivKey) MarshalAmino

func (privKey PrivKey) MarshalAmino() ([]byte, error)

MarshalAmino overrides Amino binary marshalling.

func (PrivKey) MarshalAminoJSON

func (privKey PrivKey) MarshalAminoJSON() ([]byte, error)

MarshalAminoJSON overrides Amino JSON marshalling.

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 (privKey PrivKey) PubKey() cryptotypes.PubKey

func (*PrivKey) Reset

func (m *PrivKey) Reset()

func (PrivKey) Sign

func (privKey PrivKey) Sign(msg []byte) ([]byte, error)

func (*PrivKey) Size

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

func (*PrivKey) String

func (m *PrivKey) String() string

func (PrivKey) Type

func (privKey PrivKey) Type() string

--------------------------------------------------------

func (*PrivKey) Unmarshal

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

func (*PrivKey) UnmarshalAmino

func (privKey *PrivKey) UnmarshalAmino(bz []byte) error

UnmarshalAmino overrides Amino binary marshalling.

func (*PrivKey) UnmarshalAminoJSON

func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error

UnmarshalAminoJSON overrides Amino JSON marshalling.

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_Size

func (m *PrivKey) XXX_Size() int

func (*PrivKey) XXX_Unmarshal

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

type PubKey

type PubKey struct {
	Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
}

PubKey defines a secp256k1 public key Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte if the y-coordinate is the lexicographically largest of the two associated with the x-coordinate. Otherwise the first byte is a 0x03. This prefix is followed with the x-coordinate.

func (PubKey) Address

func (pubKey PubKey) Address() crypto.Address

func (*PubKey) AsTmPubKey

func (pubKey *PubKey) AsTmPubKey() crypto.PubKey

AsTmPubKey converts our own PubKey into a Tendermint ED25519 pubkey.

func (PubKey) Bytes

func (pubKey PubKey) Bytes() []byte

func (*PubKey) Descriptor

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

func (PubKey) Equals

func (pubKey PubKey) Equals(other cryptotypes.PubKey) bool

func (*PubKey) GetKey

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

func (*PubKey) Marshal

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

func (PubKey) MarshalAmino

func (pubKey PubKey) MarshalAmino() ([]byte, error)

MarshalAmino overrides Amino binary marshalling.

func (PubKey) MarshalAminoJSON

func (pubKey PubKey) MarshalAminoJSON() ([]byte, error)

MarshalAminoJSON overrides Amino JSON marshalling.

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 (pubKey PubKey) String() string

func (*PubKey) Type

func (pubKey *PubKey) Type() string

func (*PubKey) Unmarshal

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

func (*PubKey) UnmarshalAmino

func (pubKey *PubKey) UnmarshalAmino(bz []byte) error

UnmarshalAmino overrides Amino binary marshalling.

func (*PubKey) UnmarshalAminoJSON

func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error

UnmarshalAminoJSON overrides Amino JSON marshalling.

func (*PubKey) VerifySignature

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

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_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