Documentation ¶
Index ¶
- Variables
- func Base64Decode(encoded string) ([]byte, error)
- func CheckPwd(password, hash string) bool
- func CheckPwdHash(_pwd, _hash_pwd string) bool
- func CreatePwdHash(_pwd string) (string, error)
- func GetAesDe(ciphertext, _key string) (plaintext []byte, err error)
- func GetDeRsa(base64Text string) (decryptedMessage string, err error)
- func GetUserToken(_token string) (_token_map g.Map)
- func HashPwd(password string) (string, error)
- func ParsePrivateKey(pemKey []byte) (*rsa.PrivateKey, error)
- func RSADecrypt(base64Text string, privateKey *rsa.PrivateKey) (string, error)
- func SetUserToken(_data g.Map) (_token string)
- type JWToken
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //rsa 加密公钥 PublicKey = []byte(` -----BEGIN PUBLIC KEY----- MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJnNwrj4hi/y3CCJu868ghCG5dUj8wZK ++RNlTLcXoMmdZWEQ/u02RgD5LyLAXGjLOjbMtC+/J9qofpSGTKSx/MCAwEAAQ== -----END PUBLIC KEY----- `) //rsa 解密私钥 PrivateKey = []byte(` -----BEGIN RSA PRIVATE KEY----- MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAmc3CuPiGL/LcIIm7 zryCEIbl1SPzBkr75E2VMtxegyZ1lYRD+7TZGAPkvIsBcaMs6Nsy0L78n2qh+lIZ MpLH8wIDAQABAkEAk82Mhz0tlv6IVCyIcw/s3f0E+WLmtPFyR9/WtV3Y5aaejUkU 60JpX4m5xNR2VaqOLTZAYjW8Wy0aXr3zYIhhQQIhAMfqR9oFdYw1J9SsNc+Crhug AvKTi0+BF6VoL6psWhvbAiEAxPPNTmrkmrXwdm/pQQu3UOQmc2vCZ5tiKpW10CgJ i8kCIFGkL6utxw93Ncj4exE/gPLvKcT+1Emnoox+O9kRXss5AiAMtYLJDaLEzPrA WcZeeSgSIzbL+ecokmFKSDDcRske6QIgSMkHedwND1olF8vlKsJUGK3BcdtM8w4X q7BpSBwsloE= -----END RSA PRIVATE KEY----- `) )
在线生成rsa公钥私钥 http://tool.chacuo.net/cryptrsakeyvalid
Functions ¶
func Base64Decode ¶
func ParsePrivateKey ¶
func ParsePrivateKey(pemKey []byte) (*rsa.PrivateKey, error)
func RSADecrypt ¶
func RSADecrypt(base64Text string, privateKey *rsa.PrivateKey) (string, error)
Types ¶
type JWToken ¶
type JWToken struct {
SignString string
}
JWToken jwt token
func (*JWToken) GenJWToken ¶
GenJWToken 生成一个jwt token
Click to show internal directories.
Click to hide internal directories.