MarkLogic 9 Product Documentation
pki:create-authority

pki:create-authority(
   $name as xs:string,
   $description as xs:string,
   $subject as element(x509:subject),
   $notBefore as xs:dateTime,
   $notAfter as xs:dateTime,
   $permissions as element(sec:permission)*
) as xs:unsignedLong

Summary

This function creates a new self-signed certificate authority, inserts it into the Security database as a trusted authority, and returns the ID of the newly created secure credential.

The certificate authority can be deleted by the pki:delete-authority function.

Parameters
name The secure credential name.
description The secure credential description.
subject The certificate authority's subject name.
notBefore The time at which the authority becomes valid.
notAfter The time after which the authority is no longer valid.
permissions The permissions controlling access to the secure credential.

Example


xquery version "1.0-ml"; 
 
import module namespace pki = "http://marklogic.com/xdmp/pki" 
      at "/MarkLogic/pki.xqy";

declare namespace x509 = "http://marklogic.com/xdmp/x509";

pki:create-authority(
  "acme-ca", "Acme Certificate Authority",
  element x509:subject {
    element x509:countryName            {"US"},
    element x509:stateOrProvinceName    {"California"},
    element x509:localityName           {"San Carlos"},
    element x509:organizationName       {"Acme Inc."},
    element x509:organizationalUnitName {"Engineering"},
    element x509:commonName             {"Acme CA"},
    element x509:emailAddress           {"ca@acme.com"}
  },
  fn:current-dateTime(),
  fn:current-dateTime() + xs:dayTimeDuration("P365D"),
  (xdmp:permission("admin","read")))
 
    
Powered by MarkLogic Server | Terms of Use | Privacy Policy