cryptostack

package module
v0.0.0-...-03c876f Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2016 License: MIT Imports: 8 Imported by: 4

README

Cryptostack - cryptographic library based on Curve25519, Ed25519, blake2b, Poly1305, XSalsa20 primitives. Includes persistent keys generation, tool to sign files and verify signatures, peer to peer encryption protocol, Ed25519 based Json Web Token implementation.

This library can be easily implemented on C with libsodium.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pkey

type Pkey struct {
	Alg   string `json:"alg"`
	ID    []byte `json:"id"`
	Curve struct {
		Pkey []byte `json:"pkey"`
	} `json:"curve"`
	Ed struct {
		Pkey []byte `json:"pkey"`
	} `json:"ed"`
	// contains filtered or unexported fields
}

func NewPkey

func NewPkey(curvePkey *[32]byte, edPkey *[32]byte) *Pkey

func (Pkey) GetCurveKey

func (pkey Pkey) GetCurveKey() *[32]byte

func (Pkey) GetEdKey

func (pkey Pkey) GetEdKey() *[32]byte

func (*Pkey) Verify

func (pkey *Pkey) Verify(message []byte, sig []byte) error

type Signature

type Signature struct {
	Alg  string `json:"alg"`
	Pkey *Pkey  `json:"pkey"`
	Hash []byte `json:"hash"`
	Sig  []byte `json:"sig"`
}

func NewSignature

func NewSignature(pkey *Pkey) *Signature

func (*Signature) Sign

func (sig *Signature) Sign(skey *Skey, r io.Reader) error

func (*Signature) Verify

func (sig *Signature) Verify(r io.Reader) error

type Skey

type Skey struct {
	Alg string `json:"alg"`
	ID  []byte `json:"id"`
	Kdf struct {
		Alg    string `json:"alg"`
		Salt   []byte `json:"salt"`
		Rounds int    `json:"rounds"`
	} `json:"kdf"`
	Curve struct {
		Pkey []byte `json:"pkey"`
		Skey []byte `json:"skey"`
	} `json:"curve"`
	Ed struct {
		Pkey []byte `json:"pkey"`
		Skey []byte `json:"skey"`
	} `json:"ed"`
	Checksum []byte `json:"checksum"`
	// contains filtered or unexported fields
}

func GenerateKey

func GenerateKey() (*Skey, error)

func (*Skey) Decrypt

func (skey *Skey) Decrypt(password []byte) error

func (*Skey) Encrypt

func (skey *Skey) Encrypt(password []byte)

func (Skey) GetCurveKey

func (skey Skey) GetCurveKey() *[32]byte

func (Skey) GetEdKey

func (skey Skey) GetEdKey() *[64]byte

func (Skey) GetPkey

func (skey Skey) GetPkey() *Pkey

func (*Skey) Sign

func (skey *Skey) Sign(message []byte) []byte

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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