Documentation ¶
Overview ¶
*
@author: 1043193460@qq.com @date: 2022/12/13 14:32 @note:
*
*
@author: 1043193460@qq.com @date: 2022/12/13 14:32 @note:
*
*
@author: 1043193460@qq.com @date: 2022/12/13 14:32 @note:
*
*
@author: 1043193460@qq.com @date: 2022/12/13 14:32 @note:
*
*
@author: 1043193460@qq.com @date: 2022/12/13 15:24 @note:
*
Index ¶
- type Encryption
- func (e *Encryption) AesDecrypt(crated string, salt ...string) (string, error)
- func (e *Encryption) AesEncrypt(original string, key ...string) (string, error)
- func (*Encryption) DesDecrypt(decrypted string, key ...string) (string, error)
- func (*Encryption) DesEncrypt(text string, key ...string) (string, error)
- func (r *Encryption) GenerateRSAKey(bits int, params ...string)
- func (e *Encryption) Md5Check(content, encrypted string) bool
- func (e *Encryption) Md5Encode(data string) string
- func (r *Encryption) RSA_Decrypt(cipherText string, path string) string
- func (r *Encryption) RSA_Encrypt(plainText []byte, path string) string
- func (r *Encryption) RsaSignWithSha1Hex(data string, prvKey string) (string, error)
- func (r *Encryption) RsaVerySignWithSha1Base64(originalData, signData, pubKey string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encryption ¶
type Encryption struct { }
Encryption and decryption overall structure
func (*Encryption) AesDecrypt ¶
func (e *Encryption) AesDecrypt(crated string, salt ...string) (string, error)
AesDecrypt function original The original password, salt is an optional variable. If the salt exists, the passed variable is used. If it does not exist, the system default salt value is used.
func (*Encryption) AesEncrypt ¶
func (e *Encryption) AesEncrypt(original string, key ...string) (string, error)
AesEncrypt function original The original password, salt is an optional variable. If the salt exists, the passed variable is used. If it does not exist, the system default salt value is used.
func (*Encryption) DesDecrypt ¶
func (*Encryption) DesDecrypt(decrypted string, key ...string) (string, error)
DesDecrypt des encrypted function salt The parameter is the salt value of encryption and decryption, and the maximum length is 8. If the length is exceeded, the corresponding exception will be thrown
func (*Encryption) DesEncrypt ¶
func (*Encryption) DesEncrypt(text string, key ...string) (string, error)
DesEncrypt des encrypted function salt The parameter is the salt value of encryption and decryption, and the maximum length is 8. If the length is exceeded, the corresponding exception will be thrown
func (*Encryption) GenerateRSAKey ¶
func (r *Encryption) GenerateRSAKey(bits int, params ...string)
生成RSA私钥和公钥,保存到文件中
func (*Encryption) Md5Check ¶
func (e *Encryption) Md5Check(content, encrypted string) bool
Md5Check md5 Check method
func (*Encryption) Md5Encode ¶
func (e *Encryption) Md5Encode(data string) string
Md5Encode md5 Signature function
func (*Encryption) RSA_Decrypt ¶
func (r *Encryption) RSA_Decrypt(cipherText string, path string) string
RSA解密
func (*Encryption) RSA_Encrypt ¶
func (r *Encryption) RSA_Encrypt(plainText []byte, path string) string
RSA加密
func (*Encryption) RsaSignWithSha1Hex ¶
func (r *Encryption) RsaSignWithSha1Hex(data string, prvKey string) (string, error)
签名:采用sha1算法进行签名并输出为hex格式(私钥PKCS8格式)
func (*Encryption) RsaVerySignWithSha1Base64 ¶
func (r *Encryption) RsaVerySignWithSha1Base64(originalData, signData, pubKey string) error
验签:对采用sha1算法进行签名后转base64格式的数据进行验签