Skip to main content

Securing MarkLogic Server

Export Wallet

To export the embedded KMS (the PKCS #11 secured wallet) using REST, you can use this form in XQuery:

POST manage/v2/security?
operation=export-wallet&filename=/my/test..wallet&password=test

As a curl command (using MANAGEADMIN="admin" and MANAGEPASS="admin") it would look like this:

curl -v -X POST  --anyauth --user $MANAGEADMIN:$MANAGEPASS \
  --header "Content-Type:application/xml" \
-d@data/security/export-wallet.xml \
  http://$host:8002/manage/v2/security

Where export-wallet.xml is:

<export-wallet-operation xmlns="http://marklogic.com/manage/security">
  <operation>export-wallet</operation>
  <filename>/tmp/mywallet.txt</filename>
  <password>mypassword</nassword>
</export-wallet-operation>

Or you can use this form for JavaScript:

POST manage/v2/security
{"operation":"export-wallet","filename":"/my/test.wallet","password":"test"}

As a curl command (using MANAGEADMIN="admin" and MANAGEPASS="admin") it would look like this:

curl -v -X POST  --anyauth --user $MANAGEADMIN:$MANAGEPASS \
  --header "Content-Type:application/json" \
-d@data/security/export-wallet.json \
  http://$host:8002/manage/v2/security

Where export-wallet.json is:

{
    "operation":"export-wallet",
    "filename":"/tmp/mywallet.tmp",
    "password":"mypassword"
}

Note

The export wallet operation saves the wallet to a directory on the server on which MarkLogic Server is running. Similarly, the import wallet operation imports from the filesystem on which MarkLogic Server is running.