encryption

package
v0.0.0-...-51d629d Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2016 License: BSD-3-Clause, BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DriverGroup = "encryption"

Variables

This section is empty.

Functions

func GeneratePassword

func GeneratePassword() string

func GetStaticSalt

func GetStaticSalt(offset int) string

Types

type CryptOptions

type CryptOptions struct {
	StaticSaltIndex int    `json:"StaticSaltIndex"`
	Cost            int    `json:"Cost"`
	Salt            string `json:"Salt"`
}

These are common parameters used by many drivers. Each driver may use structures that are specific to that driver.

func UnmarshalOptions

func UnmarshalOptions(jsonOption string) (opt *CryptOptions, err error)

Unmarshal a json string containing the common options defined in CryptOptions and return the option structure

type EncryptDriver

type EncryptDriver interface {
	EncryptPassword(password string, salt string) string
	ComparePasswords(string, string, string) bool
	Setup(string) EncryptDriver

	//  The following are wrappers for the gdriver Id call.
	Id() string
	ShortHelp() string
	LongHelp() string
}

The interface gives the set of methods that an encryption driver must implement.

func GetDefaultDriver

func GetDefaultDriver() EncryptDriver

This will panic if no drivers have been registered

func GetDriver

func GetDriver(name string) EncryptDriver

func SetDefault

func SetDefault(name string) EncryptDriver

Pick a registered driver for use in the system. Only one driver can be selected at a time. This will panic if no drivers have been registered

Directories

Path Synopsis
drivers

Jump to

Keyboard shortcuts

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