cyphr decrypting error- Error: OpenSSL error in EVP_DecryptFinal_ex: bad decrypt

Hi,

I'm working with another user on a project that uses encrypted data. My colleague used the cyphr package to encrypt a .Rds file. They have shared their public and private RSA keys with me and I'm now trying to decrypt the file as below:

filename <- "datafile.Rds"
keypath <- Sys.getenv("KEY_LOC")
key <- cyphr::keypair_openssl(pub=keypath, key=keypath)
d <- cyphr::decrypt(readRDS(filename), key)

However, when I run key <- cyphr::keypair_openssl(pub=keypath, key=keypath) I get the error Error: OpenSSL error in EVP_DecryptFinal_ex: bad decrypt. R is able to locate the key files when I try list.files(keypath) so I'm not sure why this error is happening. When the person who encrypted the files runs this code, they have no issues so I'm wondering if we need to encrypt it using two separate keys for two users - I'm not too familiar with encryption on R. Can someone help debug?

Thanks!

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.