Documentation ¶
Overview ¶
Package crypto is a generated protocol buffer package.
It is generated from these files:
crypto.proto
It has these top-level messages:
PublicKey PrivateKey Signature
Index ¶
- Constants
- Variables
- func EnsureEd25519PrivateKeyCorrect(candidatePrivateKey ed25519.PrivateKey) error
- func PublicKeyLength(curveType CurveType) int
- type Address
- func AddressFromBytes(bs []byte) (address Address, err error)
- func AddressFromHexString(str string) (Address, error)
- func AddressFromWord256(addr binary.Word256) Address
- func MaybeAddressFromBytes(bs []byte) (*Address, error)
- func MustAddressFromBytes(addr []byte) Address
- func NewContractAddress(caller Address, sequence uint64) (newAddr Address)
- func (address Address) Bytes() []byte
- func (address *Address) Marshal() ([]byte, error)
- func (address Address) MarshalJSON() ([]byte, error)
- func (address Address) MarshalText() ([]byte, error)
- func (address *Address) MarshalTo(data []byte) (int, error)
- func (address *Address) Size() int
- func (address Address) String() string
- func (address *Address) Unmarshal(data []byte) error
- func (address *Address) UnmarshalJSON(data []byte) error
- func (address *Address) UnmarshalText(text []byte) error
- func (address Address) Word256() binary.Word256
- type Addressable
- type Addresses
- type CurveType
- type ErrInvalidCurve
- type PrivateKey
- func (*PrivateKey) Descriptor() ([]byte, []int)
- func (p PrivateKey) GetPublicKey() PublicKey
- func (m *PrivateKey) Marshal() (dAtA []byte, err error)
- func (m *PrivateKey) MarshalTo(dAtA []byte) (int, error)
- func (*PrivateKey) ProtoMessage()
- func (p PrivateKey) RawBytes() []byte
- func (p *PrivateKey) Reinitialise() error
- func (m *PrivateKey) Reset()
- func (p PrivateKey) Sign(msg []byte) (Signature, error)
- func (m *PrivateKey) Size() (n int)
- func (p PrivateKey) String() string
- func (m *PrivateKey) Unmarshal(dAtA []byte) error
- func (*PrivateKey) XXX_MessageName() string
- type PublicKey
- func (p PublicKey) ABCIPubKey() abci.PubKey
- func (p PublicKey) Address() Address
- func (p PublicKey) AddressHashType() string
- func (*PublicKey) Descriptor() ([]byte, []int)
- func (p PublicKey) Encode() []byte
- func (m *PublicKey) GetCurveType() CurveType
- func (p PublicKey) IsSet() bool
- func (p PublicKey) IsValid() bool
- func (m *PublicKey) Marshal() (dAtA []byte, err error)
- func (p PublicKey) MarshalJSON() ([]byte, error)
- func (p PublicKey) MarshalText() ([]byte, error)
- func (m *PublicKey) MarshalTo(dAtA []byte) (int, error)
- func (*PublicKey) ProtoMessage()
- func (m *PublicKey) Reset()
- func (m *PublicKey) Size() (n int)
- func (p PublicKey) String() string
- func (p PublicKey) TendermintPubKey() tmCrypto.PubKey
- func (m *PublicKey) Unmarshal(dAtA []byte) error
- func (p *PublicKey) UnmarshalJSON(text []byte) error
- func (p *PublicKey) UnmarshalText(text []byte) error
- func (p PublicKey) Verify(msg []byte, signature Signature) error
- func (*PublicKey) XXX_MessageName() string
- type PublicKeyJSON
- type Signable
- type Signature
- func (*Signature) Descriptor() ([]byte, []int)
- func (m *Signature) GetCurveType() CurveType
- func (m *Signature) GetSignature() []byte
- func (m *Signature) Marshal() (dAtA []byte, err error)
- func (m *Signature) MarshalTo(dAtA []byte) (int, error)
- func (*Signature) ProtoMessage()
- func (sig Signature) RawBytes() []byte
- func (m *Signature) Reset()
- func (m *Signature) Size() (n int)
- func (sig Signature) String() string
- func (sig Signature) TendermintSignature() []byte
- func (m *Signature) Unmarshal(dAtA []byte) error
- func (*Signature) XXX_MessageName() string
- type Signer
Constants ¶
const AddressHexLength = 2 * AddressLength
const AddressLength = binary.Word160Length
Variables ¶
var ( ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowCrypto = fmt.Errorf("proto: integer overflow") )
var ZeroAddress = Address{}
Functions ¶
func EnsureEd25519PrivateKeyCorrect ¶
func EnsureEd25519PrivateKeyCorrect(candidatePrivateKey ed25519.PrivateKey) error
Ensures the last 32 bytes of the ed25519 private key is the public key derived from the first 32 private bytes
func PublicKeyLength ¶
Returns the length in bytes of the public key
Types ¶
type Address ¶
func AddressFromBytes ¶
Returns an address consisting of the first 20 bytes of bs, return an error if the bs does not have length exactly 20 but will still return either: the bytes in bs padded on the right or the first 20 bytes of bs truncated in any case.
func AddressFromHexString ¶
func AddressFromWord256 ¶
func MaybeAddressFromBytes ¶
Returns a pointer to an Address that is nil iff len(bs) == 0 otherwise does the same as AddressFromBytes
func MustAddressFromBytes ¶
func NewContractAddress ¶
func (Address) MarshalJSON ¶
func (Address) MarshalText ¶
func (*Address) UnmarshalJSON ¶
func (*Address) UnmarshalText ¶
type Addressable ¶ added in v0.20.0
type Addressable interface { // Get the 20 byte EVM address of this account Address() Address // Public key from which the Address is derived PublicKey() PublicKey }
func MemoizeAddressable ¶ added in v0.20.0
func MemoizeAddressable(addressable Addressable) Addressable
func NewAddressable ¶ added in v0.20.0
func NewAddressable(publicKey PublicKey) Addressable
type CurveType ¶
type CurveType uint32
func CurveTypeFromString ¶
type ErrInvalidCurve ¶
type ErrInvalidCurve string
func (ErrInvalidCurve) Error ¶
func (err ErrInvalidCurve) Error() string
type PrivateKey ¶
type PrivateKey struct { CurveType CurveType `protobuf:"varint,1,opt,name=CurveType,proto3,casttype=CurveType" json:"CurveType,omitempty"` // Note may need initialisation PublicKey []byte `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"PublicKey,omitempty"` PrivateKey []byte `protobuf:"bytes,3,opt,name=PrivateKey,proto3" json:"PrivateKey,omitempty"` }
func GeneratePrivateKey ¶
func GeneratePrivateKey(random io.Reader, curveType CurveType) (PrivateKey, error)
func PrivateKeyFromRawBytes ¶
func PrivateKeyFromRawBytes(privKeyBytes []byte, curveType CurveType) (PrivateKey, error)
func PrivateKeyFromSecret ¶
func PrivateKeyFromSecret(secret string, curveType CurveType) PrivateKey
func (*PrivateKey) Descriptor ¶ added in v0.20.0
func (*PrivateKey) Descriptor() ([]byte, []int)
func (PrivateKey) GetPublicKey ¶
func (p PrivateKey) GetPublicKey() PublicKey
func (*PrivateKey) Marshal ¶ added in v0.20.0
func (m *PrivateKey) Marshal() (dAtA []byte, err error)
func (*PrivateKey) MarshalTo ¶ added in v0.20.0
func (m *PrivateKey) MarshalTo(dAtA []byte) (int, error)
func (*PrivateKey) ProtoMessage ¶ added in v0.20.0
func (*PrivateKey) ProtoMessage()
func (PrivateKey) RawBytes ¶
func (p PrivateKey) RawBytes() []byte
func (*PrivateKey) Reinitialise ¶ added in v0.20.0
func (p *PrivateKey) Reinitialise() error
Reinitialise after serialisation
func (*PrivateKey) Reset ¶ added in v0.20.0
func (m *PrivateKey) Reset()
func (*PrivateKey) Size ¶ added in v0.20.0
func (m *PrivateKey) Size() (n int)
func (PrivateKey) String ¶ added in v0.20.0
func (p PrivateKey) String() string
func (*PrivateKey) Unmarshal ¶ added in v0.20.0
func (m *PrivateKey) Unmarshal(dAtA []byte) error
func (*PrivateKey) XXX_MessageName ¶ added in v0.20.0
func (*PrivateKey) XXX_MessageName() string
type PublicKey ¶
type PublicKey struct { CurveType CurveType `protobuf:"varint,1,opt,name=CurveType,proto3,casttype=CurveType" json:"CurveType,omitempty"` PublicKey github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,2,opt,name=PublicKey,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"PublicKey"` }
func PublicKeyFromABCIPubKey ¶ added in v0.20.0
func PublicKeyFromBytes ¶
Currently this is a stub that reads the raw bytes returned by key_client and returns an ed25519 public key.
func PublicKeyFromTendermintPubKey ¶ added in v0.20.0
func (PublicKey) ABCIPubKey ¶
Return the ABCI PubKey. See Tendermint protobuf.go for the go-crypto conversion this is based on
func (PublicKey) AddressHashType ¶
func (*PublicKey) Descriptor ¶ added in v0.20.0
func (PublicKey) Encode ¶
Produces a binary encoding of the CurveType byte plus the public key for padded to a fixed width on the right
func (*PublicKey) GetCurveType ¶ added in v0.20.0
func (PublicKey) MarshalJSON ¶
func (PublicKey) MarshalText ¶
func (*PublicKey) ProtoMessage ¶ added in v0.20.0
func (*PublicKey) ProtoMessage()
func (PublicKey) TendermintPubKey ¶ added in v0.20.1
func (*PublicKey) UnmarshalJSON ¶
func (*PublicKey) UnmarshalText ¶
func (*PublicKey) XXX_MessageName ¶ added in v0.20.0
type PublicKeyJSON ¶
type Signable ¶
Signable is an interface for all signable things. It typically removes signatures before serializing.
type Signature ¶
type Signature struct { CurveType CurveType `protobuf:"varint,1,opt,name=CurveType,proto3,casttype=CurveType" json:"CurveType,omitempty"` Signature []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"` }
func SignatureFromBytes ¶
func (*Signature) Descriptor ¶ added in v0.20.1
func (*Signature) GetCurveType ¶ added in v0.20.1
func (*Signature) GetSignature ¶ added in v0.20.1
func (*Signature) ProtoMessage ¶ added in v0.20.1
func (*Signature) ProtoMessage()