mcrypt

package module
v0.0.0-...-fa11463 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2014 License: ISC Imports: 10 Imported by: 4

README

mcrypt

mcrypt (Message Crypto) uses NaCl to encrypt and authenticate messages using Curve25519, XSalsa20 and Poly1305. The length of messages is not hidden. Additionally it can digitally sign messages or content using the Ed25519 signature algorithm.

See http://nacl.cr.yp.to/box.html for more information on NaCl.

Documentation

Index

Constants

View Source
const (
	NonceSize = 24
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Identifier

type Identifier struct {
	Description string // explain what the content is
	Mime        string // mime type to describe Content
	Content     []byte // picture, audio etc
}

func NewIdentifier

func NewIdentifier(description, filename string) (*Identifier, error)

type Identity

type Identity struct {
	PublicIdentity PublicIdentity
	Key            *[privKeySize]byte // private key, exported for JSON
}

func NewIdentity

func NewIdentity(name, address string) (*Identity, error)

func UnmarshalIdentity

func UnmarshalIdentity(blob []byte) (*Identity, error)

func (*Identity) Decrypt

func (i *Identity) Decrypt(peer *[pubKeySize]byte, msg *Message) ([]byte, error)

func (*Identity) Encrypt

func (i *Identity) Encrypt(peer *[pubKeySize]byte, msg []byte) (*Message, error)

func (*Identity) Marshal

func (i *Identity) Marshal() ([]byte, error)

type Message

type Message struct {
	Nonce     [NonceSize]byte      // NOT secret
	Signature *[signatureSize]byte // signature of the encrypted box
	Box       []byte               // NaCl box
}

func UnmarshalMessage

func UnmarshalMessage(blob []byte) (*Message, error)

func (*Message) Marshal

func (m *Message) Marshal() ([]byte, error)

type PublicIdentity

type PublicIdentity struct {
	Name        string
	Address     string
	Key         *[pubKeySize]byte
	Signature   *[signatureSize]byte
	Identifiers []*Identifier
}

func UnmarshalPublicIdentity

func UnmarshalPublicIdentity(blob []byte) (*PublicIdentity, error)

func (*PublicIdentity) Fingerprint

func (p *PublicIdentity) Fingerprint() string

Finger print public key

func (*PublicIdentity) Marshal

func (p *PublicIdentity) Marshal() ([]byte, error)

func (*PublicIdentity) Verify

func (p *PublicIdentity) Verify() bool

Verify authenticity of public key

Jump to

Keyboard shortcuts

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