envelope

package
v0.0.0-...-3810720 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultVersion = 1
	DefaultCipher  = "aes-128-ctr"
	DefaultDsa     = "secp256k1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	Version byte   // current version
	Dsa     string // digital signature algorithm
	Cipher  string // symmetric-key algorithm
	Payload []byte // symmetric encryped content
	Mac     []byte // mac to verify decrypted plain content
	Key     []byte // public key encryped symmetric-key
	Iv      []byte // iv of cipher
	Sig     []byte // signature signed by sender with field above
}

func DecodeFromRLPBytes

func DecodeFromRLPBytes(raw []byte) (*Envelope, error)

DecodeFromRLPBytes unmarshal raw to an Envelope

func NewEnvelope

func NewEnvelope(content, pub []byte, dsa, cipher string) (e *Envelope, err error)

NewEnvelope create an envelope, with content and public key of receiver

func (*Envelope) Decrypt

func (e *Envelope) Decrypt(prv []byte) ([]byte, error)

Decrypt decrypt envelope with your private key

func (*Envelope) EncodeToRLPBytes

func (e *Envelope) EncodeToRLPBytes(prv *ecdsa.PrivateKey) ([]byte, error)

EncodeToRLPBytes marshal an Envelope to raw with signature

func (*Envelope) Hash

func (e *Envelope) Hash() common.Hash

Hash returns the hash of the content of Envelope

func (*Envelope) Sender

func (e *Envelope) Sender() ([]byte, error)

Sender sender of the envelope

func (*Envelope) Valid

func (e *Envelope) Valid() error

Valid verify this envelope

Jump to

Keyboard shortcuts

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