Loading TOC...

MarkLogic 12 EA 1 Product Documentation
xdmp.x509CertificateExtract

xdmp.x509CertificateExtract(
   cert as String
) as Object?

Summary

Returns the XML representation of the specified X.509 certificate.

Parameters
cert The PEM encoded certificate.

Usage Notes

If a name under "issuer" or "subject" has more than one values, an array is returned.

Example

var cert = "-----BEGIN CERTIFICATE-----\n\
MIID4DCCA0mgAwIBAgIJAIp4RM8+Lkr3MA0GCSqGSIb3DQEBBQUAMIGnMQswCQYD\n\
VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTETMBEGA1UEBxMKU2FuIENhcmxv\n\
czETMBEGA1UEChMKTWFyayBMb2dpYzEUMBIGA1UECxMLRW5naW5lZXJpbmcxHjAc\n\
BgNVBAMTFUNlcnRpZmljYXRlIEF1dGhvcml0eTEjMCEGCSqGSIb3DQEJARYUd2Zl\n\
aWNrQG1hcmtsb2dpYy5jb20wHhcNMDgxMjAzMDEyNzQ5WhcNMDkxMjAzMDEyNzQ5\n\
WjCBpzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEzARBgNVBAcT\n\
ClNhbiBDYXJsb3MxEzARBgNVBAoTCk1hcmsgTG9naWMxFDASBgNVBAsTC0VuZ2lu\n\
ZWVyaW5nMR4wHAYDVQQDExVDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxIzAhBgkqhkiG\n\
9w0BCQEWFHdmZWlja0BtYXJrbG9naWMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN\n\
ADCBiQKBgQDnauIbA33nIH8IpiUyWA9sB/X3d8DU8cKbEes1dk6xX3mFfMWja56D\n\
vkPFaX9/voSbeG1E92d2Y518xvjgoR8okf2rkDI35nqA9ejcuC0wg0tXuh5OSVfr\n\
UpzVSwbCy55fweaVzkKC2TZXgOy5JeNbw+i/UohTLW2TPwQ4rpynPwIDAQABo4IB\n\
EDCCAQwwHQYDVR0OBBYEFLY2z4PX7fWY47gRhGpVJBIJpufYMIHcBgNVHSMEgdQw\n\
gdGAFLY2z4PX7fWY47gRhGpVJBIJpufYoYGtpIGqMIGnMQswCQYDVQQGEwJVUzET\n\
MBEGA1UECBMKQ2FsaWZvcm5pYTETMBEGA1UEBxMKU2FuIENhcmxvczETMBEGA1UE\n\
ChMKTWFyayBMb2dpYzEUMBIGA1UECxMLRW5naW5lZXJpbmcxHjAcBgNVBAMTFUNl\n\
cnRpZmljYXRlIEF1dGhvcml0eTEjMCEGCSqGSIb3DQEJARYUd2ZlaWNrQG1hcmts\n\
b2dpYy5jb22CCQCKeETPPi5K9zAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUA\n\
A4GBAA8/lJQK6NmHFvP85LS3Sdfnd9D9opDeehqv4LfoFWxHMiKsxSA7hrYRs6u9\n\
qQxCED54UfB1+kjs2GrM4H1uWeeHADdUKDRVHcivCVqWP4GUD2r0upKj8C3UD46V\n\
aNHLW0yW7Anf4DMBsfhvKfIopBDoP6NPbDith5RtmM98N8xn\n\
-----END CERTIFICATE-----";
xdmp.x509CertificateExtract(cert);

=>

{
  "version":"2",
  "serialNumber":"8A7844CF3E2E4AF7",
  "signatureType":"sha1WithRSAEncryption",
  "issuer":{
    "countryName":"US",
    "stateOrProvinceName":"California",
    "localityName":"San Carlos",
    "organizationName":"Mark Logic",
    "organizationalUnitName":"Engineering",
    "commonName":"Certificate Authority",
    "emailAddress":"wfeick@marklogic.com"
  },
  "validity":{
    "notBefore":"2008-12-03T01:27:49Z",
    "notAfter":"2009-12-03T01:27:49Z"
  },
  "subject":{
    "countryName":"US",
    "stateOrProvinceName":"California",
    "localityName":"San Carlos",
    "organizationName":"Mark Logic",
    "organizationalUnitName":"Engineering",
    "commonName":"Certificate Authority",
    "emailAddress":"wfeick@marklogic.com"
  },
  "publicKey":"-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDnauIbA33nIH8IpiUyWA9sB/X3
d8DU8cKbEes1dk6xX3mFfMWja56DvkPFaX9/voSbeG1E92d2Y518xvjgoR8okf2r
kDI35nqA9ejcuC0wg0tXuh5OSVfrUpzVSwbCy55fweaVzkKC2TZXgOy5JeNbw+i/
UohTLW2TPwQ4rpynPwIDAQAB
-----END PUBLIC KEY-----
",
  "v3ext":[
    {
      "critical":false,
      "subjectKeyIdentifier":"B6:36:CF:83:D7:ED:F5:98:E3:B8:11:84:6A:55:24:12:09:A6:E7:D8"
    },
    {
      "critical":false,
      "authorityKeyIdentifier":"keyid:B6:36:CF:83:D7:ED:F5:98:E3:B8:11:84:6A:55:24:12:09:A6:E7:D8
DirName:/C=US/ST=California/L=San Carlos/O=Mark Logic/OU=Engineering/CN=Certificate Authority/emailAddress=wfeick@marklogic.com
serial:8A:78:44:CF:3E:2E:4A:F7
"
    },
    {
      "critical":false,
      "basicConstraints":"CA:TRUE"
    }
  ]
}

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