Error in `aes_any(data, key, iv, FALSE, mode)`: OpenSSL error: EC5C0100:error:1C800064:Provider routines:ossl_cipher_unpadblock:bad decrypt:providers/implementations/ciphers/ciphercommon_block.c:107:

# Helper function to simulate an RCDF file (this is just a mock)
create_mock_rcdf <- function(temp_dir, pw = NULL) {
openssl::write_pem(key, file.path(temp_dir, 'prv.pem'), password = pw)
dataset1 = data.frame(a = 1:5, b = letters[1:5]),
dataset2 = data.frame(a = 6:10, b = letters[6:10])
test_that("read_rcdf can read and decrypt RCDF files", {
# Create a temporary directory for testing
# Check if the RCDF object is returned correctly
test_that("read_rcdf can read and decrypt RCDF files with RSA password protected key", {
mock_rcdf <- create_mock_rcdf(temp_dir, pw = 'xxx')
test_that("read_rcdf throws error if decryption key is invalid", {
# Test reading with invalid key (Expect error)
"OpenSSL error in EVP_DecryptFinal_ex: bad decrypt"

"read_rcdf can read and decrypt RCDF files"
"read_rcdf can read and decrypt RCDF files with RSA password protected key"
"read_rcdf throws error if decryption key is invalid"

read_rcdf throws error if decryption key is invalid