Documentation ¶
Overview ¶
Package pwlib passwords encryption functions
Index ¶
- Constants
- Variables
- func DecryptFile() (lines []string, err error)
- func DoPasswordCheck(password string, length int, upper int, lower int, numeric int, special int, ...) bool
- func EncryptFile() (err error)
- func GenPassword(length int, upper int, lower int, numeric int, special int, ...) (string, error)
- func GenRsaKey(pubfilename string, privfilename string, password string) (publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey, err error)
- func GetPassword(system string, account string) (password string, err error)
- func GetPrivateKeyFromFile(privfilename string, rsaPrivateKeyPassword string) (publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey, err error)
- func GetPublicKeyFromFile(publicKeyFile string) (publicKey *rsa.PublicKey, err error)
- func ListPasswords() (lines []string, err error)
- func PrivateDecryptFileGo(cryptedfile string, privatekeyfile string, keypass string) (content string, err error)
- func PrivateDecryptFileSSL(cryptedFile string, privateKeyFile string, keyPass string, ...) (content string, err error)
- func PrivateDecryptString(crypted string, privatekeyfile string, keypass string) (plain string, err error)
- func PubEncryptFileGo(plainFile string, targetFile string, publicKeyFile string) (err error)
- func PubEncryptFileSSL(plainFile string, targetFile string, publicKeyFile string, ...) (err error)
- func PublicEncryptString(plain string, publicKeyFile string) (crypted string, err error)
- func SetConfig(appname string, datadir string, keydir string, keypass string, method string)
- type PassConfig
- type PasswordProfile
Constants ¶
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 ¶
var SSLDigest = openssl.BytesToKeySHA256
SSLDigest variable helds common digist algor
var TechProfile = PasswordProfile{ Length: 12, Upper: 1, Lower: 1, Digits: 1, Special: 1, Firstchar: true, }
TechProfile profile settings for technical users
var TestData string
TestData directory for working files
var TestDir string
TestDir working dir for tests
var UserProfile = PasswordProfile{ Length: 10, Upper: 1, Lower: 1, Digits: 1, Special: 0, Firstchar: true, }
UserProfile profile settings for personal users
Functions ¶
func DecryptFile ¶
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 ¶
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 ¶
GetPublicKeyFromFile read public key from PEM encoded File
func ListPasswords ¶
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 ¶
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 ¶
PublicEncryptString Encrypt a string with public key
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