utils

package
v1.1.15 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package cipher is a package for common encrypt/decrypt of symmetric key messages.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidBlockSize indicates hash blocksize <= 0.
	ErrInvalidBlockSize = errors.New("invalid blocksize")

	// ErrInvalidPKCS7Data indicates bad input to PKCS7 pad or unpad.
	ErrInvalidPKCS7Data = errors.New("invalid PKCS7 data (empty or not padded)")

	// ErrInvalidPKCS7Padding indicates PKCS7 unpad fails to bad input.
	ErrInvalidPKCS7Padding = errors.New("invalid padding on input")
)

PKCS7 errors.

Functions

func Decrypt

func Decrypt(iv, key, ciphertext []byte) ([]byte, error)

Decrypt will use the given key, iv, and ciphertext and return the plaintext bytes.

func Encrypt

func Encrypt(iv, key, plaintext []byte) ([]byte, error)

Encrypt will use the given iv, key, and plaintext bytes and return ciphertext bytes.

func Random added in v0.1.16

func Random() [64]byte

func Read

func Read(path, name string) ([]byte, error)

func ReadPath

func ReadPath(path string) ([]byte, error)

func Slice2Array32 added in v0.1.16

func Slice2Array32(src []byte) [32]byte

func Slice2Array64 added in v0.1.16

func Slice2Array64(src []byte) [64]byte

func Write

func Write(path, name string, data []byte) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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