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!