crypto

package
v0.0.0-...-331f973 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2015 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Overview

Package sixty/crypto consolidates crypto funcionality used by the application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEncodedCookie

func CreateEncodedCookie(rw http.ResponseWriter, name string, value string,
	expires int, httpOnly bool)

CreateEncodedCookie defines a cookie to be created by ResponseWriter The resulting cookie persists until manually deleted or until "expire" HOURS have passed. "Value" is hex encoded to comply with RFC6265

func DecodedCookieValue

func DecodedCookieValue(rw http.ResponseWriter, req *http.Request, name string) ([]byte, error)

DecodedCookieValue returns the decoded Value of named cookie if it exists and can be decoded. Returns nil, nil if named cookie doesn't exist. Returns nil, err if there is a decoding error.

func DecryptEmailAddr

func DecryptEmailAddr(encEm string) (emAddr string, err error)

DecryptEmailAddr takes an encrypted email addr as a string and returns a decrypted email address. If decryption fails, returns "" and a new error

func DeleteCookie

func DeleteCookie(rw http.ResponseWriter, name string)

DeleteCookie marks named cookie for deletion by setting "Expires" to Unix epoch plus 1 second. Also sets MaxAge to -1 for modern browsers.

func EncryptEmailAddr

func EncryptEmailAddr(em []byte) (hexEm string, err error)

EncryptEmailAddr takes an email address as a []byte and returns a hex encoded encrypted string suitable for storage in the user DB table. If encryption fails, returns "" and a new error

func EncryptPassword

func EncryptPassword(rawPwd string, salt string) string

EncryptPassword uses pbkdf2 to encrypt password

func GetRandomString

func GetRandomString(n int) string

GenerateRandomString generates a random alphanumeric string

func NewV4UUID

func NewV4UUID() string

NewV4UUID generates a RFC4122 version 4 UUID Extracted from github.com\twinj\uuid

Types

type UUIDArray

type UUIDArray [16]byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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