package util import ( "encoding/base64" "errors" ) func Base64Encode(deText []byte) []byte { return []byte(base64.StdEncoding.EncodeToString(deText)) } func Base64Decode(enText []byte) ([]byte, error) { deText, err := base64.StdEncoding.DecodeString(string(enText)) if err != nil { return nil, errors.New("base decode error!") } return deText, nil }