conncrypt

package
v0.0.0-...-eac103f Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultIterations = 2048

Confg defaults

View Source
const DefaultKeySize = 32 //256bits

Variables

View Source
var DefaultHashFunc = sha256.New
View Source
var DefaultSalt = []byte(`
(;QUHj.BQ?RXzYSO]ifkXp/G!kFmWyXyEV6Nt!d|@bo+N$L9+<d$|g6e26T}
Ao<:>SOd,6acYKY_ec+(x"R";\'4&fTAVu92GVA-wxBptOTM^2,iP5%)wnhW
hwk=]Snsgymt!3gbP2pe=J//}1a?lp9ej=&TB!C_V(cT2?z8wyoL_-13fd[]

`) //salt must be predefined in order to derive the same key

Functions

func New

func New(conn net.Conn, c *Config) net.Conn

New creates an AES encrypted net.Conn by generating a key using PBKDF2 with the provided configuration

func NewFromKey

func NewFromKey(conn net.Conn, key []byte) (net.Conn, error)

NewFromKey creates an AES encrypted net.Conn using the provided key

Types

type Config

type Config struct {
	Password   string
	Salt       []byte
	Iterations int
	KeySize    int
	HashFunc   func() hash.Hash
}

Config stores the PBKDF2 key generation parameters

Jump to

Keyboard shortcuts

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