R/axDecode.R

Defines functions axDecode

Documented in axDecode

#' Decrypt the code generated for the subject hour confirmations
#'
#' The function decrypts the code generated by the \link{genSubjHconf} function.
#' It can be used to verify the code on the subject hour confirmations against
#' manipulation.
#'
#' @param code Code on the subject hour confirmations generated by the
#' \link{genSubjHconf} function. The code must be entered \strong{without}
#' line breaks.
#' @param key Private key object which has to be used to decypt the code.
#' @return Returns a decrypted string.
#'
#' @author Axel Zinkernagel \email{zinkernagel@uni-landau.de}
#'
#' @examples
#' \dontrun{
#' # Decode the code printed on the pdf (code must be in one line!)
#' load("/my/working/directory/key_323032312d30312d31352031363a34303a3232.rda")
#' # or load(paste0("/my/working/directory/",whichKey("2021−01−15 16:40:22")))
#' axDecode("oHtDit5N34y/s+uhOviVKWq/7QGRyQ/M4dP+txAnxpWRcoS...",key)
#' }
#'
#' @export
axDecode <- function(code, key){
  return(rawToChar(openssl::rsa_decrypt(openssl::base64_decode(code), key)))
}
axzinker/axBoost documentation built on July 4, 2024, 9:14 p.m.