crypto

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: Apache-2.0 Imports: 7 Imported by: 20

Documentation

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_DiscardUnknown added in v0.12.0

func (m *PrivateKey) XXX_DiscardUnknown()

func (*PrivateKey) XXX_Marshal added in v0.12.0

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

func (*PrivateKey) XXX_Merge added in v0.12.0

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

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.

func (*PrivateKey) XXX_Size added in v0.12.0

func (m *PrivateKey) XXX_Size() int

func (*PrivateKey) XXX_Unmarshal added in v0.12.0

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

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_DiscardUnknown added in v0.12.0

func (m *PublicKey) XXX_DiscardUnknown()

func (*PublicKey) XXX_Marshal added in v0.12.0

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

func (*PublicKey) XXX_Merge added in v0.12.0

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

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.

func (*PublicKey) XXX_Size added in v0.12.0

func (m *PublicKey) XXX_Size() int

func (*PublicKey) XXX_Unmarshal added in v0.12.0

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

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_DiscardUnknown added in v0.12.0

func (m *Signature) XXX_DiscardUnknown()

func (*Signature) XXX_Marshal added in v0.12.0

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

func (*Signature) XXX_Merge added in v0.12.0

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

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.

func (*Signature) XXX_Size added in v0.12.0

func (m *Signature) XXX_Size() int

func (*Signature) XXX_Unmarshal added in v0.12.0

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

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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