crypto

package
v0.11.2770-beta Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2015 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	CHACHA_KeySize   = 32
	CHACHA_BlockSize = 64
	CHACHA_IVSize    = 8
	CHACHA12_ROUND   = 12
	CHACHA20_ROUND   = 20
)

Variables

View Source
var (
	NoSuchDHMethod  = exception.New(0, "No Such DH method")
	InvalidECCParam = exception.New(0, "Invalid ECC parameters")
)

Functions

This section is empty.

Types

type ChaCha

type ChaCha struct {
	// contains filtered or unexported fields
}

func NewChaCha

func NewChaCha(key, iv []byte, rounds uint) (*ChaCha, error)

func (*ChaCha) BlockSize

func (c *ChaCha) BlockSize() int

implement cipher.Block interface

func (*ChaCha) Decrypt

func (c *ChaCha) Decrypt(dst, src []byte)

implement cipher.Block interface

func (*ChaCha) Encrypt

func (c *ChaCha) Encrypt(dst, src []byte)

implement cipher.Block interface

func (*ChaCha) XORKeyStream

func (c *ChaCha) XORKeyStream(dst, src []byte)

implement cipher.Stream interface

type DHEKey

type DHEKey struct {
	// contains filtered or unexported fields
}

classical Diffie–Hellman–Merkle key exchange

func GenerateDHEKey

func GenerateDHEKey() (k *DHEKey, err error)

func (*DHEKey) ComputeKey

func (d *DHEKey) ComputeKey(pub []byte) ([]byte, error)

func (*DHEKey) ExportPubKey

func (d *DHEKey) ExportPubKey() []byte

type DHKE

type DHKE interface {
	ExportPubKey() []byte
	ComputeKey(bobPub []byte) ([]byte, error)
}

func NewDHKey

func NewDHKey(name string) (DHKE, error)

enum: DHE, ECDHE-P224,256,384,521

type ECKey

type ECKey struct {
	// contains filtered or unexported fields
}

func GenerateECKey

func GenerateECKey(curve elliptic.Curve) (*ECKey, error)

Q = curve.G * k Q => k is ECDLP

func (*ECKey) ComputeKey

func (k *ECKey) ComputeKey(bobPub []byte) ([]byte, error)

Q' = curve.G * k' K(x,y) = Q' * k = G * k' * k

func (*ECKey) ExportPubKey

func (k *ECKey) ExportPubKey() []byte

send Alice public key to Bob.

type KeySizeError

type KeySizeError int

func (KeySizeError) Error

func (k KeySizeError) Error() string

Jump to

Keyboard shortcuts

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