# function for creating a key
createPwdKey <- function(){
require(PKI)
key <- PKI.genRSAkey(2048)
return(key)
}
# function for exporting key as RDS
saveKeyRDS <- function(key, file, location){
require(PKI)
if(missing(location)){
location <- getwd()
location_file <- paste0(location, "/", file)
saveRDS(object = key, file = location_file)
return(print(paste0("Key saved as: ", location_file )))
} else {
location_file <- paste0(location, "/", file)
saveRDS(object = key, file = location_file)
return(print(paste0("Key saved as: ", location_file )))
}
}
# function for saving RSA key
saveKeyRSA <- function(key, file, location){
require(PKI)
if(missing(location)){
location <- getwd()
location_file <- paste0(location, "/", file)
PKI.save.key(key, target = file)
return(print(paste0("Key saved as: ", file)))
} else{
location_file <- paste0(location, "/", file)
PKI.save.key(key, target = location_file)
return(print(paste0("Key saved as: ", location_file)))
}
}
# function for importing key as RDS
readKeyRDS <- function(location_file){
require(PKI)
key <- readRDS(location_file)
return(key)
}
# function for importing key as RSA
#
readKeyRSA <- function(location_file){
require(PKI)
key <- PKI.load.key(file = location_file)
return(key)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.