bls12_381

package
v0.52.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrivKeyName is the name of the private key as it is stored in the keystore.
	PrivKeyName = "cometbft/PrivKeyBls12_381"
	// PubKeyName is the name of the public key as it is stored in the keystore.
	PubKeyName = "cometbft/PubKeyBls12_381"
	// PubKeySize is the size, in bytes, of public keys as used in this package.
	PubKeySize = 32
	// PrivKeySize is the size, in bytes, of private keys as used in this package.
	PrivKeySize = 64
	// SignatureLength defines the byte length of a BLS signature.
	SignatureLength = 96
	// SeedSize is the size, in bytes, of private key seeds. These are the
	// private key representations used by RFC 8032.
	SeedSize = 32
	// MaxMsgLen defines the maximum length of the message bytes as passed to Sign.
	MaxMsgLen = 32
	// KeyType is the type of key this package provides.
	KeyType = "bls12381"
)

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 ed25519 private key. NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context.

func GenPrivKey

func GenPrivKey() (PrivKey, error)

GenPrivKey generates a new key.

func NewPrivateKeyFromBytes

func NewPrivateKeyFromBytes(bz []byte) (PrivKey, error)

NewPrivateKeyFromBytes build a new key from the given bytes.

func (PrivKey) Bytes

func (privKey PrivKey) Bytes() []byte

Bytes returns the byte representation of the Key.

func (*PrivKey) Descriptor

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

func (PrivKey) Equals

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

Equals returns true if two keys are equal and false otherwise.

func (*PrivKey) GetKey

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

func (*PrivKey) Marshal

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

func (PrivKey) MarshalAmino

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

MarshalAmino overrides Amino binary marshaling.

func (PrivKey) MarshalAminoJSON

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

MarshalAminoJSON overrides Amino JSON marshaling.

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

PubKey returns the private key's public key. If the privkey is not valid it returns a nil value.

func (*PrivKey) Reset

func (m *PrivKey) Reset()

func (PrivKey) Sign

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

Sign signs the given byte array. If msg is larger than MaxMsgLen, SHA256 sum will be signed instead of the raw bytes.

func (*PrivKey) Size

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

func (*PrivKey) String

func (m *PrivKey) String() string

func (PrivKey) Type

func (PrivKey) Type() string

Type returns the type.

func (*PrivKey) Unmarshal

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

func (*PrivKey) UnmarshalAmino

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

UnmarshalAmino overrides Amino binary marshaling.

func (*PrivKey) UnmarshalAminoJSON

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

UnmarshalAminoJSON overrides Amino JSON marshaling.

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 is an ed25519 public key for handling Tendermint keys in SDK. It's needed for Any serialization and SDK compatibility. It must not be used in a non Tendermint key context because it doesn't implement ADR-28. Nevertheless, you will like to use ed25519 in app user level then you must create a new proto message and follow ADR-28 for Address construction.

func (PubKey) Address

func (pubKey PubKey) Address() crypto.Address

Address returns the address of the key.

The function will panic if the public key is invalid.

func (PubKey) Bytes

func (pubKey PubKey) Bytes() []byte

Bytes returns the byte format.

func (*PubKey) Descriptor

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

func (PubKey) Equals

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

Equals returns true if the other's type is the same and their bytes are deeply equal.

func (*PubKey) GetKey

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

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

String returns Hex representation of a pubkey with it's type

func (PubKey) Type

func (PubKey) Type() string

Type returns the key's type.

func (*PubKey) Unmarshal

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

func (PubKey) VerifySignature

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

VerifySignature verifies the given signature.

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