pwlib

package module
v0.0.0-...-82cdbcf Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: GPL-3.0 Imports: 20 Imported by: 1

Documentation

Overview

Package pwlib passwords encryption functions

Index

Constants

View Source
const (
	// UpperChar allowed charsets upper
	UpperChar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	// LowerChar allowed charsets lower
	LowerChar = "abcdefghijkmlnopqrstuvwxyz"
	// Digits allowed charsets digits
	Digits = "0123456789"
	// SpecialChar allowed charsets special
	SpecialChar = "!?()-_="
	// AllChars allowed charsets combined
	AllChars = UpperChar + LowerChar + Digits + SpecialChar
)

Variables

View Source
var SSLDigest = openssl.BytesToKeySHA256

SSLDigest variable helds common digist algor

View Source
var TechProfile = PasswordProfile{
	Length:    12,
	Upper:     1,
	Lower:     1,
	Digits:    1,
	Special:   1,
	Firstchar: true,
}

TechProfile profile settings for technical users

View Source
var TestData string

TestData directory for working files

View Source
var TestDir string

TestDir working dir for tests

View Source
var UserProfile = PasswordProfile{
	Length:    10,
	Upper:     1,
	Lower:     1,
	Digits:    1,
	Special:   0,
	Firstchar: true,
}

UserProfile profile settings for personal users

Functions

func DecryptFile

func DecryptFile() (lines []string, err error)

DecryptFile decripts an rsa protected file

func DoPasswordCheck

func DoPasswordCheck(password string, length int, upper int, lower int, numeric int, special int, firstCharCheck bool, allowedChars string) bool

DoPasswordCheck Checks a password to given criteria

func EncryptFile

func EncryptFile() (err error)

EncryptFile encrypt plain text to rsa protected file

func GenPassword

func GenPassword(length int, upper int, lower int, numeric int, special int, firstCharCheck bool) (string, error)

GenPassword generates a password with the given complexity

func GenRsaKey

func GenRsaKey(pubfilename string, privfilename string, password string) (publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey, err error)

GenRsaKey generate new key pair

func GetPassword

func GetPassword(system string, account string) (password string, err error)

GetPassword ask System for data

func GetPrivateKeyFromFile

func GetPrivateKeyFromFile(privfilename string, rsaPrivateKeyPassword string) (publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey, err error)

GetPrivateKeyFromFile read private key from PEM encoded File and returns publicKey and private key objects

func GetPublicKeyFromFile

func GetPublicKeyFromFile(publicKeyFile string) (publicKey *rsa.PublicKey, err error)

GetPublicKeyFromFile read public key from PEM encoded File

func ListPasswords

func ListPasswords() (lines []string, err error)

ListPasswords printout list of pwcli

func PrivateDecryptFileGo

func PrivateDecryptFileGo(cryptedfile string, privatekeyfile string, keypass string) (content string, err error)

PrivateDecryptFileGo Decrypt a file with private key with GO API

func PrivateDecryptFileSSL

func PrivateDecryptFileSSL(cryptedFile string, privateKeyFile string, keyPass string, sessionPassFile string) (content string, err error)

PrivateDecryptFileSSL Decrypt a file with private key with openssl API

func PrivateDecryptString

func PrivateDecryptString(crypted string, privatekeyfile string, keypass string) (plain string, err error)

PrivateDecryptString Decrypt a string with private key

func PubEncryptFileGo

func PubEncryptFileGo(plainFile string, targetFile string, publicKeyFile string) (err error)

PubEncryptFileGo encrypts a file with public key with GO API

func PubEncryptFileSSL

func PubEncryptFileSSL(plainFile string, targetFile string, publicKeyFile string, sessionPassFile string) (err error)

PubEncryptFileSSL encrypts a file with public key with openssl API

func PublicEncryptString

func PublicEncryptString(plain string, publicKeyFile string) (crypted string, err error)

PublicEncryptString Encrypt a string with public key

func SetConfig

func SetConfig(appname string, datadir string, keydir string, keypass string, method string)

SetConfig set encryption configuration

Types

type PassConfig

type PassConfig struct {
	AppName         string
	DataDir         string
	KeyDir          string
	KeyPass         string
	CryptedFile     string
	PrivateKeyFile  string
	PubKeyFile      string
	PlainTextFile   string
	SessionPassFile string
	Method          string
	KeySize         int
	SSLDigest       openssl.CredsGenerator
}

PassConfig Type for encryption configuration

var PwConfig PassConfig

PwConfig Encryption configuration

type PasswordProfile

type PasswordProfile struct {
	Length    int
	Upper     int
	Lower     int
	Digits    int
	Special   int
	Firstchar bool
}

PasswordProfile struct for password profile

Jump to

Keyboard shortcuts

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