Loading TOC...


   $name as xs:string,
   $description as xs:string,
   $key-type as xs:string?,
   $key-options as element()?,
   $csr as element(x509:req)
) as element(pki:template)


This function creates a new X.509 certificate request template. Each time a new certificate request is generated, a new public/private key pair is generated. A new random ID is generated and returned as part of the element. This ID is used for identifying this template and its related key pairs and certificates. The returned element must be separately inserted into the database with pki:insert-template.

$name The name of the certificate request template.
$description A description of the certificate request template.
$key-type The type of key to use (enter "rsa").
$key-options The options for generating new keys. The valid options are key-length, which specifies the number of bits in a key (512, 1024, 2048, 4096), and pass-phrase, which specifies the pass phrase for encrypting/decrypting a private key.
$csr An XML representation of the certificate request template.


     (: execute this against the security database :)
     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";
     declare namespace ssl = "http://marklogic.com/xdmp/ssl";

     let $x509 := 
           <x509:localityName>San Carlos</x509:localityName>
           <x509:basicConstraints critical="false">CA:TRUE</x509:basicConstraints>
           <x509:keyUsage critical="false">Certificate Sign, CRL Sign</x509:keyUsage>
           <x509:nsCertType critical="false">SSL Server</x509:nsCertType>
           <x509:subjectKeyIdentifier critical="false">B2:2C:0C:F8:5E:A7:44:B7</x509:subjectKeyIdentifier>

     let $options := 
       <pki:key-options xmlns="ssl:options">

     return pki:create-template(
            "Creating a new template",

  (: Creates a new certificate template, named "testTemplate." :)

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