crypto

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCrypto   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	// ErrInvalidKeyType is returned when the cryptographic key scheme isn't supported.
	ErrInvalidKeyType = errors.New("given key type isn't supported yet")
)
View Source
var KeyType_name = map[int32]string{
	0: "RSA",
	1: "ECDSA",
	2: "Ed25519",
	3: "Secp256k1",
}
View Source
var KeyType_value = map[string]int32{
	"RSA":       0,
	"ECDSA":     1,
	"Ed25519":   2,
	"Secp256k1": 3,
}

Functions

This section is empty.

Types

type KeyType

type KeyType int32

Types of digital keys supported.

const (
	KeyType_RSA       KeyType = 0
	KeyType_ECDSA     KeyType = 1
	KeyType_Ed25519   KeyType = 2
	KeyType_Secp256k1 KeyType = 3
)

func (KeyType) EnumDescriptor

func (KeyType) EnumDescriptor() ([]byte, []int)

func (KeyType) String

func (x KeyType) String() string

type Signature

type Signature struct {
	KeyType              KeyType  `protobuf:"varint,1,opt,name=key_type,json=keyType,proto3,enum=stratumn.node.core.crypto.KeyType" json:"key_type,omitempty"`
	PublicKey            []byte   `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	Signature            []byte   `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

A digital signature.

func Sign

func Sign(ctx context.Context, sk ic.PrivKey, payload []byte) (*Signature, error)

Sign signs the given payload with the given private key.

func (*Signature) Descriptor

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

func (*Signature) GetKeyType

func (m *Signature) GetKeyType() KeyType

func (*Signature) GetPublicKey

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

func (*Signature) GetSignature

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

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) Verify

func (s *Signature) Verify(ctx context.Context, payload []byte) (ok bool)

Verify verifies a signature.

func (*Signature) XXX_DiscardUnknown added in v0.2.0

func (m *Signature) XXX_DiscardUnknown()

func (*Signature) XXX_Marshal added in v0.2.0

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

func (*Signature) XXX_Merge added in v0.2.0

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

func (*Signature) XXX_Size added in v0.2.0

func (m *Signature) XXX_Size() int

func (*Signature) XXX_Unmarshal added in v0.2.0

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

Jump to

Keyboard shortcuts

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