
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
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.
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")))
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.