summaryrefslogtreecommitdiffstats
path: root/lib/aes.go
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-12-09 20:35:31 -0500
committerrsiddharth <s@ricketyspace.net>2020-12-09 20:35:31 -0500
commitc2571480c1a35338e7b1b7d4b5ffeab018ef179e (patch)
treeadd7a53457f2cad772d763968f122f182b8d4698 /lib/aes.go
parentcba2c0023d0e21128193ed222fd2f9f9e2ec075a (diff)
lib/aes: update AESEncryptCBC
Add padding
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
}