Add unit tests for configuration, cryptography, interfaces, and packet handling.

This commit is contained in:
Ivan
2025-05-07 18:24:52 -05:00
parent 3f141bf93b
commit 8114c3bda4
13 changed files with 1473 additions and 6 deletions

View File

@@ -59,5 +59,9 @@ func DecryptAESCBC(key, ciphertext []byte) ([]byte, error) {
// Remove PKCS7 padding
padding := int(plaintext[len(plaintext)-1])
if padding == 0 || padding > len(plaintext) {
return nil, errors.New("invalid PKCS7 padding")
}
// TODO: Add check to ensure all padding bytes are correct?
return plaintext[:len(plaintext)-padding], nil
}