knitr::opts_chunk$set(echo = FALSE)
# Following line will delete any existing public and private keys in directory
# Do not uncomment it unless you are happy to delete these keys
# If the keys are present the code won't run as it attempts to create them (change the key names at gen_keys() to run slides if keys already exist and can't be deleted
# system(paste0("rm ", getwd(), "/id_rsa*"))
options(width=150)
options(dplyr.print_min = 6, dplyr.print_max = 6)

Data Governance {.fourlinestext}

Research and Data {.fourlinestext}

Encryptr {.fourlinestext}

Encryptr on CRAN / Github

install.packages("encryptr") # CRAN
remotes::install_github("SurgicalInformatics/encryptr")

https://github.com/surgicalinformatics


### <b>
library(encryptr)
### </b>
library(dplyr) # Used in presentation examples

# Encryptr comes with an example data set of GPs (Family Physicians)
### <b>
gp
### </b>

Public and Private Keys {.basictext}

### <b>
genkeys()
### </b>

Default values are "id_rsa" and "id_rsa.pub"

No Raw Text Password {data-background=#E1D9D7}

knitr::include_graphics("API_dialogue.png") 

### <b>
gp_encrypt = gp %>% 
  encrypt(name)
### </b>
gp_encrypt %>% 
  select(organisation_code, name, address1)

### <b>
gp_encrypt %>%
  slice(1:2) %>%
  decrypt(name) %>% 
  ### </b>
  select(organisation_code, name, address1)

Encryptr Customisation {.fourlinestext}

Encryptr Customisation Examples

# Creating a lookup table with specified name and filename
### <b>
gp %>% 
  encrypt(name, postcode, 
          lookup = TRUE, write_lookup = TRUE, 
          lookup_name = "new_lookup_name")


# Using a public key hosted at URL
gp %>% 
  encrypt(name, public_key_path = "https://<some_url>/id_rsa.pub")
### </b>

Encryptr File Encryption

gp_encrypt %>% write_csv("gp_enc.csv")

### <b>
encrypt_file("gp.csv")



# Encrypted file will have suffix: `.encryptr.bin`
decrypt_file("gp.csv.encryptr.bin", file_name = "gp2.csv")
### </b>

Encryptr Ciphertexts Not Matchable {.fourlinestext}


### <b>
encrypt_vec(c("a name", "a name", "a name"))
### </b>

Technical Aspects of Encryptr {.fourlinestext}

What Encryptr Is Useful For {.fourlinestext}

Questions



SurgicalInformatics/encryptr documentation built on Nov. 9, 2019, 6:55 p.m.