diff options
author | rsiddharth <s@ricketyspace.net> | 2020-12-09 20:35:31 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-12-09 20:35:31 -0500 |
commit | c2571480c1a35338e7b1b7d4b5ffeab018ef179e (patch) | |
tree | add7a53457f2cad772d763968f122f182b8d4698 /lib/aes.go | |
parent | cba2c0023d0e21128193ed222fd2f9f9e2ec075a (diff) |
lib/aes: update AESEncryptCBC
Add padding
Diffstat (limited to 'lib/aes.go')
-rw-r--r-- | lib/aes.go | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 } |