pbe

package
v0.0.0-...-4873089 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 17 Imported by: 5

Documentation

Index

Constants

View Source
const PbePwd = "pbepwd"

PbePwd defines the keyword for client flag.

Variables

This section is empty.

Functions

func Alphanumeric

func Alphanumeric(u uint8) bool

Alphanumeric tells u is letter or digit char.

func DealPflag

func DealPflag() bool

DealPflag deals the request by the pflags.

func DeclarePflags

func DeclarePflags()

DeclarePflags declares the pbe required pflags.

func Decrypt

func Decrypt(cipherText, password string, iterations int) (string, error)

Decrypt PrintDecrypt the cipherText(result of Encrypt) based on password and iterations.

func DecryptSalt

func DecryptSalt(cipherText, password, fixedSalt string, iterations int) (string, error)

DecryptSalt PrintDecrypt the cipherText(result of EncryptSalt) based on password and iterations.

func Ebp

func Ebp(p string) (string, error)

Ebp decrypts p by PBEWithMD5AndDES with 19 iterations.

func Encrypt

func Encrypt(plainText, password string, iterations int) (string, error)

Encrypt PrintEncrypt the plainText based on password and iterations with random salt. The result contains the first 8 bytes salt before BASE64.

func EncryptSalt

func EncryptSalt(plainText, password, fixedSalt string, iterations int) (string, error)

EncryptSalt PrintEncrypt the plainText based on password and iterations with fixed salt.

func GetPbePwd

func GetPbePwd() string

GetPbePwd read pbe password from viper, or from stdin.

func Pbe

func Pbe(p string) (string, error)

Pbe encrypts p by PBEWithMD5AndDES with 19 iterations. it will prompt password if viper get none.

func PrintDecrypt

func PrintDecrypt(passStr string, cipherText ...string)

PrintDecrypt prints the PBE decryption.

func PrintEncrypt

func PrintEncrypt(passStr string, plains ...string)

PrintEncrypt prints the PBE encryption.

Types

type Config

type Config struct {
	Passphrase string
}

Config configs the passphrase.

func (Config) ChangePbe

func (c Config) ChangePbe(s, newPassphrase string) (string, error)

ChangePbe changes the {PBE}xxx to {PBE} yyy with a new passphase

func (Config) Ebp

func (c Config) Ebp(p string) (string, error)

Ebp decrypts p by PBEWithMD5AndDES with 19 iterations.

func (Config) EbpText

func (c Config) EbpText(s string) (string, error)

EbpText free the {PBE}xxx to yyy with a passphrase

func (Config) Pbe

func (c Config) Pbe(p string) (string, error)

Pbe encrypts p by PBEWithMD5AndDES with 19 iterations. it will prompt password if viper get none.

func (Config) PbeText

func (c Config) PbeText(s string) (string, error)

PbeText will PBE encrypt the passwords in the text passwords should be as any of following format and its converted pattern 1. {PWD:clear} -> {PBE:cyphered} 2. [PWD:clear] -> {PBE:cyphered} 3. (PWD:clear) -> {PBE:cyphered} 4. "PWD:clear" -> "{PBE:cyphered}" 5. PWD:clear -> {PBE:cyphered}

Jump to

Keyboard shortcuts

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