set default kus/ekus, use validity_months name

This commit is contained in:
Hong Ooi 2019-05-02 10:29:49 +10:00
Родитель 46f17c72ac
Коммит 6cdb448f29
6 изменённых файлов: 15 добавлений и 12 удалений

Просмотреть файл

@ -77,7 +77,7 @@
#'
#' # specifying a validity period of 2 years (24 months)
#' vault$certificates$create("mynewcert", "CN=mydomain.com",
#' x509=cert_x509_properties(valid=24))
#' x509=cert_x509_properties(validity_months=24))
#'
#' # setting management tags
#' vault$certificates$create("mynewcert", "CN=mydomain.com", tag1="a value", othertag="another value")

Просмотреть файл

@ -9,7 +9,7 @@
#' @param dns_names,emails,upns For `cert_x509_properties`, the possible subject alternative names (SANs) for a certificate. These should be character vectors.
#' @param key_usages For `cert_x509_properties`, a character vector of key usages.
#' @param enhanced_key_usages For `cert_x509_properties`, a character vector of enhanced key usages (EKUs).
#' @param valid For `cert_x509_properties`, the number of months the certificate should be valid for.
#' @param validity_months For `cert_x509_properties`, the number of months the certificate should be valid for.
#' @param issuer For `cert_issuer_properties`, the name of the issuer. Defaults to "self" for a self-signed certificate.
#' @param cert_type For `cert_issuer_properties`, the type of certificate to issue, eg "OV-SSL", "DV-SSL" or "EV-SSL".
#' @param transparent For `cert_issuer_properties`, whether the certificate should be transparent.
@ -43,10 +43,12 @@ cert_key_properties <- function(type=c("RSA", "EC"), hardware=FALSE, ec_curve=NU
#' @rdname helpers
#' @export
cert_x509_properties=function(dns_names=character(), emails=character(), upns=character(),
key_usages=character(), enhanced_key_usages=character(), valid=NULL)
key_usages=c("digitalSignature", "keyEncipherment"),
enhanced_key_usages=c("1.3.6.1.5.5.7.3.1", "1.3.6.1.5.5.7.3.2"),
validity_months=NULL)
{
sans <- list(dns_names=I(dns_names), emails=I(emails), upns=I(upns))
props <- list(sans=sans, key_usage=I(key_usages), ekus=I(enhanced_key_usages), validity_months=valid)
props <- list(sans=sans, key_usage=I(key_usages), ekus=I(enhanced_key_usages), validity_months=validity_months)
compact(props)
}

Просмотреть файл

@ -74,14 +74,14 @@
#' cert$export("mynewcert.pem")
#'
#' # new version of an existing certificate
#' vault$certificates$create("mynewcert", x509=cert_x509_properties(valid=24))
#' vault$certificates$create("mynewcert", x509=cert_x509_properties(validity_months=24))
#'
#' cert <- vault$certificates$get("mynewcert")
#' vers <- cert$list_versions()
#' cert$set_version(vers[2])
#'
#' # updating an existing cert version
#' cert$set_policy(x509=cert_x509_properties(valid=12))
#' cert$set_policy(x509=cert_x509_properties(validity_months=12))
#'
#'
#' ## signing a JSON web token (JWT) for authenticating with Azure Active Directory

Просмотреть файл

@ -85,14 +85,14 @@ cert$cer
cert$export("mynewcert.pem")
# new version of an existing certificate
vault$certificates$create("mynewcert", x509=cert_x509_properties(valid=24))
vault$certificates$create("mynewcert", x509=cert_x509_properties(validity_months=24))
cert <- vault$certificates$get("mynewcert")
vers <- cert$list_versions()
cert$set_version(vers[2])
# updating an existing cert version
cert$set_policy(x509=cert_x509_properties(valid=12))
cert$set_policy(x509=cert_x509_properties(validity_months=12))
## signing a JSON web token (JWT) for authenticating with Azure Active Directory

Просмотреть файл

@ -82,7 +82,7 @@ vault$certificates$create("mynewcert", "CN=mydomain.com",
# specifying a validity period of 2 years (24 months)
vault$certificates$create("mynewcert", "CN=mydomain.com",
x509=cert_x509_properties(valid=24))
x509=cert_x509_properties(validity_months=24))
# setting management tags
vault$certificates$create("mynewcert", "CN=mydomain.com", tag1="a value", othertag="another value")

Просмотреть файл

@ -13,8 +13,9 @@ cert_key_properties(type = c("RSA", "EC"), hardware = FALSE,
reuse_key = FALSE)
cert_x509_properties(dns_names = character(), emails = character(),
upns = character(), key_usages = character(),
enhanced_key_usages = character(), valid = NULL)
upns = character(), key_usages = c("digitalSignature",
"keyEncipherment"), enhanced_key_usages = c("1.3.6.1.5.5.7.3.1",
"1.3.6.1.5.5.7.3.2"), validity_months = NULL)
cert_issuer_properties(issuer = "self", cert_type = NULL,
transparent = NULL)
@ -43,7 +44,7 @@ vault_object_attrs(enabled = TRUE, expiry_date = NULL,
\item{enhanced_key_usages}{For \code{cert_x509_properties}, a character vector of enhanced key usages (EKUs).}
\item{valid}{For \code{cert_x509_properties}, the number of months the certificate should be valid for.}
\item{validity_months}{For \code{cert_x509_properties}, the number of months the certificate should be valid for.}
\item{issuer}{For \code{cert_issuer_properties}, the name of the issuer. Defaults to "self" for a self-signed certificate.}