summaryrefslogtreecommitdiffstats
path: root/lib/aes.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/aes.go')
-rw-r--r--lib/aes.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/aes.go b/lib/aes.go
index 4e835e5..396ee5c 100644
--- a/lib/aes.go
+++ b/lib/aes.go
@@ -4,6 +4,9 @@
package lib
func AESEncryptCBC(plain, key, iv []byte) []byte {
+ // Pad input
+ plain = Pkcs7Padding(plain, 16)
+
iter := len(plain) / 16
lc := iv
@@ -33,6 +36,10 @@ func AESDecryptCBC(cipher, key, iv []byte) []byte {
lc = c
}
+
+ // Undo padding
+ output = Pkcs7PaddingUndo(output)
+
return output
}