diff --git a/utils/utils.go b/utils/utils.go index 8a5c391..61dd3ee 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -175,3 +175,9 @@ func paddingZero(s []byte, l int) []byte { return s } } + +func PKCS5UnPadding(src []byte) []byte { + length := len(src) + unpadding := int(src[length-1]) + return src[:(length - unpadding)] +} \ No newline at end of file diff --git a/utils/utils_darwin.go b/utils/utils_darwin.go index 7db7a5b..9755e97 100644 --- a/utils/utils_darwin.go +++ b/utils/utils_darwin.go @@ -110,14 +110,5 @@ func aes128CBCDecrypt(encryptPass []byte) (string, error) { return string(dst), nil } -func PKCS5UnPadding(src []byte) []byte { - length := len(src) - unpadding := int(src[length-1]) - return src[:(length - unpadding)] -} -func PKCS7UnPadding(origData []byte)[]byte{ - length := len(origData) - unpadding := int(origData[length-1]) - return origData[:length-unpadding] -} +