mirror of https://github.com/fatedier/frp.git
pcrypto: update
This commit is contained in:
parent
78c770d37d
commit
a729a4fafe
|
@ -49,7 +49,6 @@ func (pc *Pcrypto) Encrypt(src []byte) ([]byte, error) {
|
|||
defer zwr.Close()
|
||||
zwr.Write(src)
|
||||
zwr.Flush()
|
||||
fmt.Println("com,src,en", len(src), len(zbuf.Bytes()))
|
||||
|
||||
// aes
|
||||
src = pKCS7Padding(zbuf.Bytes(), aes.BlockSize)
|
||||
|
@ -57,8 +56,6 @@ func (pc *Pcrypto) Encrypt(src []byte) ([]byte, error) {
|
|||
crypted := make([]byte, len(src))
|
||||
blockMode.CryptBlocks(crypted, src)
|
||||
|
||||
fmt.Println("aes,src,en", len(src), len(crypted))
|
||||
|
||||
// base64
|
||||
return []byte(base64.StdEncoding.EncodeToString(crypted)), nil
|
||||
}
|
||||
|
@ -87,7 +84,10 @@ func (pc *Pcrypto) Decrypt(str []byte) ([]byte, error) {
|
|||
|
||||
// gunzip
|
||||
zbuf := bytes.NewBuffer(decryptText)
|
||||
zrd, _ := gzip.NewReader(zbuf)
|
||||
zrd, err := gzip.NewReader(zbuf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer zrd.Close()
|
||||
data, _ = ioutil.ReadAll(zrd)
|
||||
|
||||
|
|
Loading…
Reference in New Issue