crypto

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package crypto is a generated protocol buffer package.

It is generated from these files:

crypto/models.proto

It has these top-level messages:

PublicKey
PrivateKey
Signature

Index

Constants

View Source
const ExtensionName = "sigs"

ExtensionName is used for the Conditions we get from signatures

Variables

View Source
var (
	ErrInvalidLengthModels = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowModels   = fmt.Errorf("proto: integer overflow")
)

Functions

This section is empty.

Types

type PrivateKey

type PrivateKey struct {
	// Types that are valid to be assigned to Priv:
	//	*PrivateKey_Ed25519
	Priv isPrivateKey_Priv `protobuf_oneof:"priv"`
}

func GenPrivKeyEd25519

func GenPrivKeyEd25519() *PrivateKey

GenPrivKeyEd25519 returns a random new private key (TODO: look at sources of randomness, other than default crypto/rand)

func (*PrivateKey) Descriptor

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

func (*PrivateKey) GetEd25519

func (m *PrivateKey) GetEd25519() []byte

func (*PrivateKey) GetPriv

func (m *PrivateKey) GetPriv() isPrivateKey_Priv

func (*PrivateKey) Marshal

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

func (*PrivateKey) MarshalTo

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

func (*PrivateKey) ProtoMessage

func (*PrivateKey) ProtoMessage()

func (*PrivateKey) PublicKey

func (p *PrivateKey) PublicKey() *PublicKey

PublicKey returns the corresponding PublicKey

func (*PrivateKey) Reset

func (m *PrivateKey) Reset()

func (*PrivateKey) Sign

func (p *PrivateKey) Sign(message []byte) (*Signature, error)

Sign returns a matching signature for this private key

func (*PrivateKey) Size

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

func (*PrivateKey) String

func (m *PrivateKey) String() string

func (*PrivateKey) Unmarshal

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

func (*PrivateKey) XXX_OneofFuncs

func (*PrivateKey) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type PrivateKey_Ed25519

type PrivateKey_Ed25519 struct {
	Ed25519 []byte `protobuf:"bytes,1,opt,name=ed25519,proto3,oneof"`
}

func (*PrivateKey_Ed25519) MarshalTo

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

func (*PrivateKey_Ed25519) PublicKey

func (p *PrivateKey_Ed25519) PublicKey() *PublicKey

PublicKey returns the corresponding PublicKey

func (*PrivateKey_Ed25519) Sign

func (p *PrivateKey_Ed25519) Sign(message []byte) (*Signature, error)

Sign returns a matching signature for this private key

func (*PrivateKey_Ed25519) Size

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

type PubKey

type PubKey interface {
	Verify(message []byte, sig *Signature) bool
	Condition() weave.Condition
}

Pubkey represents a crypto public key we use

type PublicKey

type PublicKey struct {
	// Types that are valid to be assigned to Pub:
	//	*PublicKey_Ed25519
	Pub isPublicKey_Pub `protobuf_oneof:"pub"`
}

func (*PublicKey) Address

func (p *PublicKey) Address() weave.Address

Address is a convenience method to get the Condition then take Address

func (*PublicKey) Condition added in v0.4.0

func (p *PublicKey) Condition() weave.Condition

Condition generates a Condition object to represent a valid signature.

func (*PublicKey) Descriptor

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

func (*PublicKey) GetEd25519

func (m *PublicKey) GetEd25519() []byte

func (*PublicKey) GetPub

func (m *PublicKey) GetPub() isPublicKey_Pub

func (*PublicKey) Marshal

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

func (*PublicKey) MarshalTo

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

func (*PublicKey) ProtoMessage

func (*PublicKey) ProtoMessage()

func (*PublicKey) Reset

func (m *PublicKey) Reset()

func (*PublicKey) Size

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

func (*PublicKey) String

func (m *PublicKey) String() string

func (*PublicKey) Unmarshal

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

func (*PublicKey) Verify

func (p *PublicKey) Verify(message []byte, sig *Signature) bool

Verify verifies the signature was created with this message and public key

func (*PublicKey) XXX_OneofFuncs

func (*PublicKey) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type PublicKey_Ed25519

type PublicKey_Ed25519 struct {
	Ed25519 []byte `protobuf:"bytes,1,opt,name=ed25519,proto3,oneof"`
}

func (*PublicKey_Ed25519) Condition added in v0.4.0

func (p *PublicKey_Ed25519) Condition() weave.Condition

Condition encodes the public key into a weave permission

func (*PublicKey_Ed25519) MarshalTo

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

func (*PublicKey_Ed25519) Size

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

func (*PublicKey_Ed25519) Verify

func (p *PublicKey_Ed25519) Verify(message []byte, sig *Signature) bool

Verify verifies the signature was created with this message and public key

type Signature

type Signature struct {
	// Types that are valid to be assigned to Sig:
	//	*Signature_Ed25519
	Sig isSignature_Sig `protobuf_oneof:"sig"`
}

func (*Signature) Descriptor

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

func (*Signature) GetEd25519

func (m *Signature) GetEd25519() []byte

func (*Signature) GetSig

func (m *Signature) GetSig() isSignature_Sig

func (*Signature) Marshal

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

func (*Signature) MarshalTo

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

func (*Signature) ProtoMessage

func (*Signature) ProtoMessage()

func (*Signature) Reset

func (m *Signature) Reset()

func (*Signature) Size

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

func (*Signature) String

func (m *Signature) String() string

func (*Signature) Unmarshal

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

func (*Signature) XXX_OneofFuncs

func (*Signature) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type Signature_Ed25519

type Signature_Ed25519 struct {
	Ed25519 []byte `protobuf:"bytes,1,opt,name=ed25519,proto3,oneof"`
}

func (*Signature_Ed25519) MarshalTo

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

func (*Signature_Ed25519) Size

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

type Signer

type Signer interface {
	Sign(message []byte) (*Signature, error)
	PublicKey() *PublicKey
}

Signer is the functionality we use from a private key No serializing to support hardware devices as well.

Jump to

Keyboard shortcuts

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