crypto

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockSize = twofish.BlockSize
	KeySize   = 32
)

Variables

This section is empty.

Functions

func DecryptBytes

func DecryptBytes(key EncryptionKey, ciphertext []byte, iv []byte, padding int) (plaintext []byte, err error)

DecryptBytes decrypts a ciphertext using a key, an iv, and a volume of padding. `ciphertext` is not overwritten. The plaintext is returned.

func EncryptBytes

func EncryptBytes(key EncryptionKey, plaintext []byte) (ciphertext []byte, iv []byte, padding int, err error)

EncryptBytes encrypts a []byte using a key. The padded ciphertext, iv, and amount of padding used are returned. `plaintext` is not overwritten.

func GenerateSignatureKeys

func GenerateSignatureKeys() (sk SecretKey, pk PublicKey, err error)

GenerateKeyPair creates a public-secret keypair that can be used to sign and verify messages.

func VerifyBytes

func VerifyBytes(data []byte, pk PublicKey, sig Signature) bool

VerifyBytes uses a public key and input data to verify a signature.

Types

type EncryptionKey

type EncryptionKey [KeySize]byte

func GenerateEncryptionKey

func GenerateEncryptionKey() (key EncryptionKey, err error)

GenerateEncryptionKey produces a key that can be used for encrypting and decrypting files.

type PublicKey

type PublicKey *[ed25519.PublicKeySize]byte

type SecretKey

type SecretKey *[ed25519.PrivateKeySize]byte

type Signature

type Signature *[ed25519.SignatureSize]byte

func SignBytes

func SignBytes(data []byte, sk SecretKey) (sig Signature, err error)

SignBytes signs a message using a secret key.

Jump to

Keyboard shortcuts

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