Loading TOC...

MarkLogic 12 EA 1 Product Documentation
xdmp.certificateValidateKeyPair

xdmp.certificateValidateKeyPair(
   public-key as String,
   private-key as String
) as Boolean

Summary

Checks if a public key and private key match within an asymmetric encryption sequence. Returns true if the public and private keys match and false otherwise.

Parameters
public-key The public key/certificate that is being checked in this asymmetric encryption scheme.
private-key The private key that is being checked in this asymmetric encryption scheme.

Example

'use strict';

var publicKey = "-----BEGIN CERTIFICATE-----\n\
MIIEtjCCAx4CCQCbPmq6Wop60DANBgkqhkiG9w0BAQsFADCBnDELMAkGA1UEBhMC\n\
VVMxCzAJBgNVBAgMAlRYMQ4wDAYDVQQHDAVQbGFubzESMBAGA1UECgwJTWFya0xv\n\
Z2ljMRQwEgYDVQQLDAtFbmdpbmVlcmluZzEiMCAGA1UEAwwZbWFjcHJvLTM5MTIu\n\
bWFya2xvZ2ljLmNvbTEiMCAGCSqGSIb3DQEJARYTaWFtamVmZngwQGdtYWlsLmNv\n\
bTAeFw0yMjA5MjkyMDE5MDFaFw0yMzA5MjQyMDE5MDFaMIGcMQswCQYDVQQGEwJV\n\
UzELMAkGA1UECAwCVFgxDjAMBgNVBAcMBVBsYW5vMRIwEAYDVQQKDAlNYXJrTG9n\n\
aWMxFDASBgNVBAsMC0VuZ2luZWVyaW5nMSIwIAYDVQQDDBltYWNwcm8tMzkxMi5t\n\
YXJrbG9naWMuY29tMSIwIAYJKoZIhvcNAQkBFhNpYW1qZWZmeDBAZ21haWwuY29t\n\
MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA2YQkOSRx8+GlyyCD21Vm\n\
lrE44zXeuxy8TW/E+VOABNAKXWfVa+NfBLx8CoWnL1WgsNAiRyMV8HVDu4eY6Vlr\n\
gW4TSfeSJTJNl2ETtswYufK6SSYeLjfwNmkPC1Mg/Bjn86dP180/Oq3NibWzOvo8\n\
e2CxNXkbOLZjmT/Opog45i/sICpV7UYEGlNOpuA18Walg7Zcxf1B6XBVUeCIyMev\n\
0TxEY2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+JLSriKTek0ZbrOSOGOmlzngJd76\n\
3NumkGle0aWiZIq5866bZ8jaA87N8XtlSGxIRSJRGf1gk8OiUzVG+b+Wj7vNP6ZK\n\
Vy71tttdEbWyf3a6stSr4kVYKpZJWNCOBsvrnD3hqyry+lcxcgLX4UNUuNbX2H6F\n\
g1WdBG9H+Uaq2rMHW+UFSeWkyp28DLe7zcv8CarAmmIk2Yfa6IW8gA==\n\
-----END RSA PRIVATE KEY-----";

xdmp.certificateValidateKeyPair(publicKey, privateKey)

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