seclib2

package
v2.3.20181123+incompat... Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIGITS  = "23456789"
	LETTERS = "abcdefghjkmnpqrstuvwxyz"
	UPPERS  = "ABCDEFGHJKMNPRSTUVWXYZ"
	PUNC    = "()~@#$%^&*-+={}[]:;<>,.?/"

	ALL_DIGITS  = "0123456789"
	ALL_LETTERS = "abcdefghijklmnopqrstuvwxyz"
	ALL_UPPERS  = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	ALL_PUNC    = "~`!@#$%^&*()-_=+[]{}|:';\",./<>?"
)

Variables

View Source
var CERT_SEP = []byte("-END CERTIFICATE-")
View Source
var CHARS = fmt.Sprintf("%s%s%s%s", DIGITS, LETTERS, UPPERS, PUNC)

Functions

func Decrypt

func Decrypt(privateKey, secret []byte) ([]byte, error)

func DecryptBase64

func DecryptBase64(privateKey string, secret string) (string, error)

func Encrypt

func Encrypt(publicKey, origData []byte) ([]byte, error)

func EncryptBase64

func EncryptBase64(publicKey string, message string) (string, error)

func GenerateDSASSHKeypair

func GenerateDSASSHKeypair() (string, string, error)

func GeneratePassword

func GeneratePassword(passwd string) (string, error)

func GenerateRSASSHKeypair

func GenerateRSASSHKeypair() (string, string, error)

func GetPublicKeyScheme

func GetPublicKeyScheme(pubkey ssh.PublicKey) string

func InitTLSConfig

func InitTLSConfig(certFile, keyFile string) (*tls.Config, error)

func MeetComplxity

func MeetComplxity(passwd string) bool

func RandomPassword2

func RandomPassword2(width int) string

func VerifyPassword

func VerifyPassword(passwd string, hash string) error

Types

type PasswordStrength

type PasswordStrength struct {
	Digits     int
	Lowercases int
	Uppercases int
	Punctuats  int
}

func AnalyzePasswordStrenth

func AnalyzePasswordStrenth(passwd string) PasswordStrength

func (PasswordStrength) Len

func (ps PasswordStrength) Len() int

func (PasswordStrength) MeetComplexity

func (ps PasswordStrength) MeetComplexity() bool

Jump to

Keyboard shortcuts

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