See encrypt_file
for details.
decrypt_file(.path, file_name = NULL, private_key_path = "id_rsa")
.path | Quoted path to file to encrypt. |
---|---|
file_name | Optional new name for unencrypted file. |
private_key_path | Quoted path to private key, created with
|
The decrypted file is saved with optional file name.
# This will run: # Create example file to encrypt # write.csv(gp, "gp.csv") # genkeys() # encrypt_file("gp.csv") # decrypt_file("gp.csv.encryptr.bin", file_name = "gp2.csv") # For CRAN and testing: temp_dir = tempdir() # temp directory for testing only genkeys(file.path(temp_dir, "id_rsa4"))#> Private key written with name '/tmp/RtmpoFe9u2/id_rsa4' #> Public key written with name '/tmp/RtmpoFe9u2/id_rsa4.pub'write.csv(gp, file.path(temp_dir, "gp.csv")) encrypt_file(file.path(temp_dir, "gp.csv"), public_key_path = file.path(temp_dir, "id_rsa4.pub"))#> Encrypted file written with name '/tmp/RtmpoFe9u2/gp.csv.encryptr.bin'decrypt_file(file.path(temp_dir, "gp.csv.encryptr.bin"), private_key_path = file.path(temp_dir, "id_rsa4"), file_name = "file.path(temp_dir, gp2.csv)")#> Error in decrypt_file(file.path(temp_dir, "gp.csv.encryptr.bin"), private_key_path = file.path(temp_dir, "id_rsa4"), file_name = "file.path(temp_dir, gp2.csv)"): Unencrtyped file with same name exists at this location. #> Move or choose new name (file_name) to avoid it being overwritten.