encrypt: Encrypt a data frame or tibble column using an RSA...

Description Usage Arguments Value Examples

Description

Encrypt a data frame or tibble column using an RSA public/private key

Usage

1
2
encrypt(.data, ..., public_key_path = "id_rsa.pub", lookup = FALSE,
  lookup_name = "lookup", write_lookup = TRUE)

Arguments

.data

A data frame or tibble.

...

The unquoted names of columns to encrypt.

public_key_path

Character. A quoted path to an RSA public key created using genkeys.

lookup

Logical. Whether to substitute the encrypted columns for key-column of integers.

lookup_name

Character. A quoted name to give lookup table and file.

write_lookup

Logical. Write a lookup table as a .csv file.

Value

The original dataframe or tibble with the specified columns encrypted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# This will run:
# genkeys()
# gp_encrypt = gp %>%
#   select(-c(name, address1, address2, address3)) %>%
#   encrypt(postcode, telephone)

# For CRAN and testing:
library(dplyr)
temp_dir = tempdir()
genkeys(file.path(temp_dir, "id_rsa2")) # temp directory for testing only
gp_encrypt = gp %>%
  select(-c(name, address1, address2, address3)) %>%
  encrypt(postcode, telephone, public_key_path = file.path(temp_dir, "id_rsa2.pub"))

Example output

Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union

Private key written with name '/work/tmp/tmp/RtmppvE9kd/id_rsa2'
Public key written with name '/work/tmp/tmp/RtmppvE9kd/id_rsa2.pub'

encryptr documentation built on May 2, 2019, 4:16 a.m.