pwencrypter

package
v0.0.0-...-17ddb13 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//SALTBYTE salt size
	SALTBYTE = 32
	//KeysPath server and users encryption key path
	KeysPath = "./services/pwencrypter/keys"
)

Variables

This section is empty.

Functions

func CheckError

func CheckError(err error)

CheckError Checks if err is not nil then it logs the error

func Decrypt

func Decrypt(ciphertext, k []byte) string

Decrypt Func decrypt passwords of the user basing on the user key This Function takes ciphertext which is the encrypted password & key = k as inputs returns the decrypted password as a string

func Encrypt

func Encrypt(password string, k []byte) []byte

Encrypt Func encrypt passwords of the user basing on a key that the user have generated before This Function takes password as a string type & key = k as a []byte type as inputs returns encrypted password as byte array

func GenKeyP

func GenKeyP(p string) []byte

GenKeyP func generate an encryption key from user password Takes password as an input and returns byte slice

func LoadKey

func LoadKey(user string) []byte

LoadKey Func Reads the key of each user from the keys folder to use it in encryption or decryption This Function needs Username as an input & it returns slice of byte which is the key

func SaveKey

func SaveKey(k []byte, user string) bool

SaveKey Func Save user's encryption key into a file named with his username The Func takes k encryption key the user generate in the beginning and user "username of the user"

Types

This section is empty.

Jump to

Keyboard shortcuts

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