Version: v0.0.0-...-c12dc61 Latest Latest

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

Go to latest
Published: Jun 1, 2020 License: MIT Imports: 9 Imported by: 0




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


This section is empty.


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"


This section is empty.

Source Files

Jump to

Keyboard shortcuts

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