Documentation
¶
Index ¶
- func CheckToken(tokenStr string, pub *rsa.PublicKey, token interface{}) error
- func EncodeAndSignToken(token interface{}, priv *rsa.PrivateKey) (string, error)
- func GenerateKeyPairs(keyName string, bits int) (privKey *rsa.PrivateKey, err error)
- func ReadPrivKey(keyName string) (*rsa.PrivateKey, error)
- func ReadPubKey(keyName string) (*rsa.PublicKey, error)
- func Sign(data []byte, priv *rsa.PrivateKey) ([]byte, error)
- func Verify(data, sig []byte, pub *rsa.PublicKey) (bool, error)
- type Key
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckToken ¶
CheckToken 验证Token签名是否正确,如果正确则使用Json反序列化为传入结构
func EncodeAndSignToken ¶
func EncodeAndSignToken(token interface{}, priv *rsa.PrivateKey) (string, error)
EncodeAndSignToken 编码和签名Token
func GenerateKeyPairs ¶
func GenerateKeyPairs(keyName string, bits int) (privKey *rsa.PrivateKey, err error)
GenerateKeyPairs 生成指定名字的指定bit位数公私钥对
Types ¶
Click to show internal directories.
Click to hide internal directories.