Loading TOC...

pki:get-certificate-xml

pki:get-certificate-xml(
   $template-id as xs:unsignedLong,
   $hostname as xs:string
) as element(x509:cert)*

Summary

This function returns the XML representation of the certificate for the specified id and common host name combination.

Parameters
$template-id The certificate template id for the certificate to be returned.
$hostname The common host name, if any.

Example

  (: execute this against the security database :)
  xquery version "1.0-ml"; 
  import module namespace pki = "http://marklogic.com/xdmp/pki" 
      at "/MarkLogic/pki.xqy";
  import module namespace admin = "http://marklogic.com/xdmp/admin" 
      at "/MarkLogic/admin.xqy";

  let $config := admin:get-configuration()
  let $tid := pki:template-get-id(pki:get-template-by-name("test"))
  let $hostname := admin:host-get-name(
                       $config, 
                       admin:host-get-id($config, xdmp:host-name())) 

  return
     pki:get-certificate-xml($tid, $hostname)

  (: Returns the certificate in XML format for the local host. :)
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.