Chatta subito con l'assistenza
Chat con il supporto

One Identity Safeguard for Privileged Sessions 6.9.5 - REST API Reference Guide

Introduction Using the SPS REST API Basic settings User management and access control Managing SPS General connection settings HTTP connections Citrix ICA connections MSSQL connections RDP connections SSH connections Telnet connections VNC connections Search, download, and index sessions Reporting Health and maintenance Advanced authentication and authorization Completing the Welcome Wizard using REST Enable and configure analytics using REST

Passwords stored on SPS

To create a new password, you have to POST the password or its hash as a JSON object to the https://<IP-address-of-SPS>/api/passwords endpoint. For details, see Create a new object. The body of the POST request must contain a JSON object with the parameters listed in Password parameters. The response to a successful POST message is a JSON object that includes the reference ID of the created password in its key attribute. You can reference this ID in other parts of the configuration, for example, to set the password of a user account. Note that you can use a password object for only one purpose, that is, you cannot reference a password object twice.

URL
POST https://<IP-address-of-SPS>/api/configuration/passwords
  • Note that the GET method is not permitted on this endpoint, you cannot list the existing passwords. However, if you know the reference ID of a password, you can display its properties:

    GET https://<IP-address-of-SPS>/api/configuration/passwords/<reference-ID-of-the-password;>
  • You cannot directly delete or modify a password, the DELETE and PUT methods are not permitted on password objects. To update a password, create a new one, then update the object that uses the old password to reference the new password.

Table 3: Headers
Header name Description Required Values
Content-Type Specifies the type of the data sent. SPS uses the JSON format Required application/json
session_id Contains the authentication token of the user Required The value of the session ID cookie received from the REST server in the authentication response, for example, a1f71d030e657634730b9e887cb59a5e56162860. For details on authentication, see Authenticate to the SPS REST API.
Sample request

The following command creates a new password object.

curl -X POST -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/configuration/passwords --data '{"plain": "newpassword"}'

If you do not want to include the actual password in the request, the SHA-256 hash of the password is enough:

curl -X POST -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/configuration/passwords --data '{"hash": "$6$rounds=5000$If20/EFyQ4dW3dg/$xrECLfXgZlC2Xr1s257E2aZen42fM7R.sOGG9pkPy1x5ORTx6j03oPWexVlB3f5wnaZOQCBF.NjlDgyg2WEe./"}'
Table 4: Password parameters
Element Type Description
hash string Must contain the SHA-256 hash of the password to be created, for example, "hash": "ddec437eeb1da25a146a24c432d1165bc646daa7fecc6aa14c636265c83caa14". The request must contain at least the hash or the plain attribute.
nthash string Optional. Contains the NT-HASH of the password to be created, for example, "nthash": "2c01a73ad9e597f6eab0d072ed74616c"
plain string Contains the password in plain-text format, for example, "plain": "mypassword". The request must contain at least the hash or the plain attribute.
Response

The response to a successful POST message is a JSON object that includes the reference ID of the created password in its key attribute.

For details of the meta object, see Message format.

{
    "key": "faa96916-c85e-46ff-8697-f4cc5e596e7f",
    "meta": {
        "href": "/api/configuration/passwords/faa96916-c85e-46ff-8697-f4cc5e596e7f",
        "parent": "/api/configuration/passwords",
        "transaction": "/api/transaction"
    }
}
Status and error codes

The following table lists the typical status and error codes for this request. For a complete list of error codes, see Application level error codes.

Code Description Notes
201 Created The new resource was successfully created.
400 InvalidQuery The requested filter or its value is invalid.
401 Unauthenticated The requested resource cannot be retrieved because the client is not authenticated and the resource requires authorization to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
403 Unauthorized The requested resource cannot be retrieved because the client is not authorized to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
404 NotFound The requested object does not exist.
405 MethodNotAllowed The method <method> is not allowed for this node.
Modify or delete password

You cannot directly delete or modify a password, the DELETE and PUT methods are not permitted on password objects. To update a password, create a new one, then update the object that uses the old password to reference the new password. After you commit the transaction, SPS will automatically delete the old password. For details, see Change the admin password.

Change the admin password

To change the password of the admin user, complete the following steps.

  1. Open a transaction.

    For more information, see Open a transaction.

  2. Create a new password object

    POST a JSON object containing the password or the hash of the password to the https://<IP-address-of-SPS>/api/passwords endpoint. For details, see Password parameters. For example:

    curl -X POST -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/configuration/passwords --data '{"plain": "mypassword"}'

    If the operation is successful, the response includes a reference key to the new password object.

  3. Reference the key of the password in the user configuration.

    Modify the JSON object of the user to reference the key of the new password object, and PUT the modified JSON object to the https://<IP-address-of-SPS>/api/configuration/aaa/local_database/users/<key-of-the-user> endpoint. For example:

    curl -X PUT -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/configuration/aaa/local_database/users/14322374245a7de542bbb04 --data '{"name": "admin", "password": "<key-of-the-new-password>"}'
  4. Commit your changes.

    For more information, see Commit a transaction.

Change the root password

To change the password of the root user, complete the following steps.

  1. Open a transaction.

    For more information, see Open a transaction.

  2. Create a new password object

    POST a JSON object containing the password or the hash of the password to the https://<IP-address-of-SPS>/api/passwords endpoint. For details, see Password parameters. For example:

    curl -X POST -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/configuration/passwords --data '{"plain": "mypassword"}'

    If the operation is successful, the response includes a reference key to the new password object.

  3. Configure SPS to use this password for the root user configuration.

    PUT the reference key of the new password object to the https://<IP-address-of-SPS>/api/configuration/management/root_password endpoint. For example:

    curl -X PUT -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/configuration/management/root_password --data '"<key-of-the-new-password>"'

    Note that you must PUT the reference key as a JSON string, enclosed in double-quotes.

  4. Alternatively, instead of performing the previous two steps, you can replace an existing password in a single step, PUT the following JSON object to the https://<IP-address-of-SPS>/api/configuration/management/root_password endpoint:

    {
        "plain": "new_password"
    }
  5. Commit your changes.

    For more information, see Commit a transaction.

Change the user password

Logged in users can change their own passwords by completing the following steps.

  1. Open a transaction.

    For more information, see Open a transaction.

  2. Create a new password object

    POST a JSON object containing the password or the hash of the password to the https://<IP-address-of-SPS>/api/passwords endpoint. For details, see Password parameters. For example:

    curl -X POST -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/configuration/passwords --data '{"plain": "mypassword"}'

    If the operation is successful, the response includes a reference key to the new password object.

  3. Change the password of the user.

    PUT a JSON object that includes the current password in plain text and the key of the new password object to the https://<IP-address-of-SPS>/api/user/password endpoint. For example:

    curl -X PUT -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/user/password --data '{"current_password_in_plaintext": "<old-password>", "new_password_reference": "<key-of-the-new-password>"}'
  4. Alternatively, instead of performing the previous two steps, you can replace an existing password in a single step, PUT the following JSON object to the https://<IP-address-of-SPS>/api/configuration/management/root_password endpoint:

    {
        "current_password_in_plaintext": "<current_password_in_plaintext>",
        "new_password_reference": {
            "plain": "newpassword"
        }
    }
  5. Commit your changes.

    For more information, see Commit a transaction.

Private keys stored on SPS

To create a new private key, you have to POST the private key as a JSON object to the https://<IP-address-of-SPS>/api/private_keys endpoint. For details, see Create a new object. The body of the POST request must contain a JSON object with the parameters listed in Element . The response to a successful POST message is a JSON object that includes the reference ID of the created private key in its key attribute. You can reference this ID in other parts of the configuration. Note that you can use a private-key object for only one purpose, that is, you cannot reference one object twice.

URL
POST https://<IP-address-of-SPS>/api/configuration/private_keys
  • Note that the GET method is not permitted on this endpoint, you cannot list the existing private keys. However, if you know the reference ID of a private key, you can display its properties:

    GET https://<IP-address-of-SPS>/api/configuration/private_keys/<reference-ID-of-the-private-key;>
  • You cannot directly delete or modify a private key, the DELETE and PUT methods are not permitted on private key objects. To update a private key, create a new one, then update the object that uses the old private key to reference the new private key.

Table 5: Headers
Header name Description Required Values
Content-Type Specifies the type of the data sent. SPS uses the JSON format Required application/json
session_id Contains the authentication token of the user Required The value of the session ID cookie received from the REST server in the authentication response, for example, a1f71d030e657634730b9e887cb59a5e56162860. For details on authentication, see Authenticate to the SPS REST API.
Sample request

The following command creates a new private key object. Note the following requirements:

  • The key must be in PKCS-1 or PKCS-8 PEM format.

  • Encrypted private keys are not supported.

  • The body of the POST message must be the private key as a single line, enclosed in double-quotes.

  • Replace line-breaks in the PEM file with \n

curl -X POST -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/configuration/private_keys --data "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAu3QMMhqeg9ZMLNfdvQoNN1deVRE2SR0VKY+ALnzPZF4fUoJy\n.....\nI2SchDibk/Xj/ZvuEQ23LvzayWOVVuVHtH3JZX3SU4Sa0vpaeC+3oddVTwQOWRq0\n ......... Qbn5W3xKz4vXDDQHEbEsvDQ9A7+uCEuHpO4s33IK9KEa0Zdp745AU0DSGXN4HFzc\n-----END RSA PRIVATE KEY-----\n"

Querying a specific key returns the following information about the key:

curl --cookie cookies https://<IP-address-of-SPS>/api/configuration/private_keys/<reference-ID-of-the-private-key;>
Element Type Description
public-key-fingerprint string The fingerprint of the public key that matches the private key.
digest string The fingerprint of the key, for example 2048 SHA256:JPKdfkT6wU9c11bbqX53hovDo7KbIB8OREfumUWDh9f no comment (RSA)
hash_algorithm string The hash algorithm used to create the fingerprint, for example, sha256.
type string The type of the private key. Must be rsa
Response

The response to a successful POST message is a JSON object that includes the reference ID of the created public key in its key attribute.

For details of the meta object, see Message format.

{
    "key": "faa96916-c85e-46ff-8697-f4cc5e596e7f",
    "meta": {
        "href": "/api/configuration/private_keys/faa96916-c85e-46ff-8697-f4cc5e596e7f",
        "parent": "/api/configuration/private_keys",
        "transaction": "/api/transaction"
    }
}

The response to querying a specific key is a JSON object that includes the parameters of the key, for example:

{
    "body": {
        "public-key-fingerprint": {
            "digest": "2048 SHA256:JPKdfkT6wU9c11bbqX53hovDo7KbIB8OREfumUWDh9f no comment (RSA)",
            "hash_algorithm": "sha256"
        },
        "type": "rsa"
    },
    "key": "6c4d1116-d79d-475b-bb37-9f844f085c14",
    "meta": {
        "first": "/api/configuration/private_keys/e5d13d18-07c5-43fa-89f4-c3d2ece17c71",
        "href": "/api/configuration/private_keys/6c4d1116-d79d-475b-bb37-9f844f085c14",
        "last": "/api/configuration/private_keys/6c4d1116-d79d-475b-bb37-9f844f085c14",
        "next": null,
        "parent": "/api/configuration/private_keys",
        "previous": "/api/configuration/private_keys/e5d13d18-07c5-43fa-89f4-c3d2ece17c71",
        "transaction": "/api/transaction"
    }
Status and error codes

The following table lists the typical status and error codes for this request. For a complete list of error codes, see Application level error codes.

Code Description Notes
201 Created The new resource was successfully created.
400 SyntacticError Syntax error: Could not load PEM key: Unsupported private key format, only PKCS-1 and PKCS-8 is supported. Encrypted private keys are not supported.
401 Unauthenticated The requested resource cannot be retrieved because the client is not authenticated and the resource requires authorization to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
403 Unauthorized The requested resource cannot be retrieved because the client is not authorized to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
404 NotFound The requested object does not exist.
405 MethodNotAllowed The method <method> is not allowed for this node.
Modify or delete private key

You cannot directly delete or modify a private key, the DELETE and PUT methods are not permitted on private key objects. To update a private key, create a new one, then update the object that uses the old private key to reference the new private key. After you commit the transaction, SPS will automatically delete the old private key.

Private keys generated on SPS

In some security contexts it might be a requirement to generate private keys on the appliance so that you can avoid any kind of eavesdropping during the transfer of the unencrypted key. Safeguard for Privileged Sessions supports generating Elliptic Curve (secp256r1) private keys on its REST API. You must use the REST API to use the generated key in the configuration. SPS supports the on-box generated private keys to be used for the following purposes:

Overview of the steps required to use on-box generated private keys in the configuration:

  1. Generate a private key and a certificate signing request (CSR).

  2. Obtain the CSR and send it to a certificate authority (CA). The required steps for performing the validation are mandated by the CA.

  3. Once the CA signs the certificate, upload it to SPS.

  4. Change the relevant REST configuration element to refer to the freshly generated 'X.509 identifier' (which is a reference to a private key and the associated certificate chain).

  5. (Optional): You might want to delete the private key if you want to prevent the key to be used for a different purpose on the SPS.

    NOTE: In this case, whenever the certificate expires, you must generate a fresh private key and CSR.

Perequisites: A certificate authority must be configured in Trust stores.

URL
https://<IP-address-of-SPS>/api/pki/certificate
Table 6: Headers
Header name Description Required Values
Content-Type Specifies the type of the data sent. SPS uses the JSON format Required application/json
session_id Contains the authentication token of the user Required The value of the session ID cookie received from the REST server in the authentication response, for example, a1f71d030e657634730b9e887cb59a5e56162860. For details on authentication, see Authenticate to the SPS REST API.
Operations

Operations with the /api/pki/certificate endpoint include:

Operation HTTP method URL

Notes

Generating a new CSR

POST /api/pki/certificate/requests

 

Adding an X.509 certificate chain to a CSR to create a X.509 identifier

PUT /api/pki/certificate/requests/<ID-of-the-CSR>

 

Setting or replacing a certificate chain for a CSR without knowing the CSR identifier

POST /api/pki/certificate

X.509 identifier that have been referenced in the configuration will not be updated automatically, when you replace a certificate chain for a CSR. If you want to use the newly created X.509 identifier, you must set or update the reference to it in the configuration.

Querying existing CSRs

GET /api/pki/certificate/requests

Querying a single CSR

 

GET

/api/pki/certificate/requests/<ID-of-the-CSR>

 

Deleting a CSR

 

DELETE

/api/pki/certificate/requests/<ID-of-the-CSR>

Deleting a CSR does not remove the corresponding X.509 identifier from the configuration, that is, the existing private key and certificate chain pair remains in use until you update the reference. Unreferenced X.509 identifier are removed automatically.

Example: Generating a new CSR

The following command creates a new CSR.

curl --cookie cookies https://<IP-address-of-SPS>/api/pki/certificate/requests
{
     "subject": [
       {"name": "countryName", "value": "US"},
       {"name": "stateOrProvinceName", "value": "CA"},
       {"name": "streetAddress", "value": "Example Street"},
       {"name": "organizationName", "value": "Example Organization"},
       {"name": "commonName", "value": "first.example.com"},
       {"name": "emailAddress", "value": "info@example.com"}
     ],
     "extensions": [
       {"name": "basicConstraints", "value": "CA:FALSE", "critical": true},
       {"name": "keyUsage", "value": "digitalSignature,keyAgreement", "critical": true},
       {"name": "extendedKeyUsage", "value": "clientAuth", "critical": false},
       {"name": "subjectAltName", "value": "IP:123.123.123.123,DNS:example2.organization.com", "critical": false}
      ]
   }
			

Elements of the request message body include:

Element Type Description Notes
subject      
subject.name

string

The subject name must be an object identifier (OID), or a name that can be translated to an OID.

Example values are:

  • countryName
  • stateOrProvinceName
  • streetAddress
  • organizationName
  • commonName
  • emailAddress
subject.value

string

   
extensions

object

The list of extensions.

If you do not want to specify any extensions in the request, use an empty list.

extensions.name

enum

The name of the extension.

Possible values are:

  • basicConstraints
  • keyUsage
  • extendedKeyUsage
  • subjectAltName
  • subjectInfoAccess

extensions.value

string

The value of the extension.

 

extensions.critical

boolean

Indicates whether the extension should be marked as critical in the request.

 

Response

The following is a sample response received when a new CSR is created.

For details of the meta object, see Message format.

{
     "key": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
     "meta": {
       "href": "/api/pki/certificate/requests/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
       "parent": "/api/pki/certificate/requests"
     }
   }
Setting or updating a certificate chain for a CSR

There are two ways to set or update a certificate chain for a CSR:

  • Use a PUT request, if you know the CSR identifier.

  • Use a POST request, if you do not know the CSR identifier. In this case the REST API automatically selects the CSR based on the information in the first certificate in the chain.

Example with PUT request: Replacing a web server certificate

To replace a web server certificate, you have to

  1. Generate a new CSR. You can find a detailed description of the available parameters listed in the request message body table of Example: Generating a new CSR. The result will be the identifier of the new CSR.

  2. Send a GET request to the https://<IP-address-of-SPS>/api/pki/certificate/requests/<ID-of-the-CSR> endpoint. Obtain the PEM value of the CSR.

  3. Send the CSR to the trusted certificate authority (CA).

    The CA validates your request for using the stored certificate. If the validation is successful, it will respond with a signed X.509 certificate chain. The first element of this certificate chain must be the certificate to be used by SPS. The chain might contain CA certificates in the hierarchy.

  4. Open a transaction.

    For more information, see Open a transaction.

  5. Send a PUT request to the https://<IP-address-of-SPS>/api/pki/certificate/requests/<ID-of-the-CSR> endpoint. The request must include:

    • the X.509 certificate chain

    • the identifier of the trust store that is used to validate the certificate chain, or null, if you want to disable validation

      {
           "certificate_chain": "-----BEGIN CERTIFICATE-----\nMIID+zCCAeOgAwIBAgIBTDANBgkqhkiG9w0BAQsFADAXMRUwEwYDVQQDDAxFeGFt\ncGxlIENBIDIwHhcNMjAwODMxMTIyMDU2WhcNMzAxMDE4MTIyMDU2WjCBsjELMAkG\nA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRcwFQYDVQQHDA5FeGFtcGxlIENpdHkgMjEf\nMB0GA1UECgwWRXhhbXBsZSBPcmdhbml6YXRpb24gMjEVMBMGA1UECwwMRXhhbXBs\nZSBVbml0MRowGAYDVQQDDBF0aGlyZC5leGFtcGxlLmNvbTEOMAwGA1UEEQwFMTIz\nNDUxGTAXBgNVBAkMEEV4YW1wbGUgU3R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G3l32hG6QZMBcxFTATBgNVBAMMDEV4YW1wbGUgQ0EgMoIBAjANBgkq\nhkiG9w0BAQ0FAAOCAgEAkf2J2M4eHDnRTGQsZTcs91SdV/2fH0W+NLTRdGO9V0NL\nKMRXrlJ8Gy3A/4U/Hx5Lo4dQQckePTdXzFQARX5m/7VIf2+YlUDlNre/fMt5aeWG\n67vlUnUYLqgHqV2G5QmqZ26DUwcMTXK3oy8rqel1xtQAk1Cpfdvfi7gn2cEFRD7U\nexg3AemJMBV26spcGnaf/smfcHeVWo9lwqzyWzwvGYTEeb1MajCgINnh39DZBHlO\nPE77yRyuANtDzWMo0ZNnlU+FpHTexhooQnYRKtEagHDTTF2ZuSkcJnczlTFAP4cM\ntvEro4ePMdxLuMf4lVrBt+OudsVnoij+U9OHJst7Czk5MXyZzGHgkmXOg+JUW49D\nOfjDq0HiW64QeWYu+lsEFS+2sHES82R/JBmXWbqHy68JhDUubzAi7nRXEHkKP9N3\nXF6jD3Fyn47kN4uYeHas9eCvMFmxfv6TGzCPgfS9PH0ZaZLM/Cp6u9l4DhyvFV9n\nuazsa9pkwlQftE8L1Xo/hGmKBdLGJDRDQo1r4eYYZlzS94tj5p0thztTmUWZFOl2\ndOTyux8EvhpsefDYwtlJ1wxqvFdDm5WGCxeZd6YAsV/KukVQLakX1LS/i7FEFsuL\nZ89WjWdHC2A3liKOa/y0/vy9gOY7GScvRnyUSthQ2Y0DYO89KDzY6Q6ILbpsVr8=\n-----END CERTIFICATE-----",
           "trust_store": "2222"
         }
      							

      Elements of the request message body include:

      Element Type Description Notes
      certificate_chain

      string or list

      The certificate chain can be specified as a string of individual certificates separated by a newline, or as a list of strings containing the certificates. The certificates must be specified in PEM format.

       
      trust_store

      string

      The identifier of the trust store that is used to validate the certificate chain, or null, if you want to disable validation.

       

      The result will be the X.509 identifier referring to the private key + certificate chain pair.

      NOTE: The X.509 identifier can only be used in REST configuration.

  6. Use the X.509 identifier to replace your web server certificate. For more information, see Internal certificates.

  7. Commit your changes.

    For more information, see Commit a transaction.

Example with POST request: Replacing a web server certificate

To replace a web server certificate without knowing the CSR identifier, you have to

  1. Generate a new CSR. You can find a detailed description of the available parameters listed in the request message body table of Example: Generating a new CSR. The result will be the identifier of the new CSR.

  2. Send a GET request to the https://<IP-address-of-SPS>/api/pki/certificate/requests/<ID-of-the-CSR> endpoint. Obtain the PEM value of the CSR.

  3. Send the CSR to the trusted certificate authority (CA).

    The CA validates your request for using the stored certificate. If the validation is successful, it will respond with a signed X.509 certificate chain. The first element of this certificate chain must be the certificate to be used by SPS. The chain might contain CA certificates in the hierarchy.

  4. Open a transaction.

    For more information, see Open a transaction.

  5. Send a POST request to the https://<IP-address-of-SPS>/api/pki/certificate endpoint. The request must include:

    • the X.509 certificate chain

    • the identifier of the trust store that is used to validate the certificate chain, or null, if you want to disable validation

      {
           "certificate_chain": "-----BEGIN CERTIFICATE-----\nMIID+zCCAeOgAwIBAgIBTDANBgkqhkiG9w0BAQsFADAXMRUwEwYDVQQDDAxFeGFt\ncGxlIENBIDIwHhcNMjAwODMxMTIyMDU2WhcNMzAxMDE4MTIyMDU2WjCBsjELMAkG\nA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRcwFQYDVQQHDA5FeGFtcGxlIENpdHkgMjEf\nMB0GA1UECgwWRXhhbXBsZSBPcmdhbml6YXRpb24gMjEVMBMGA1UECwwMRXhhbXBs\nZSBVbml0MRowGAYDVQQDDBF0aGlyZC5leGFtcGxlLmNvbTEOMAwGA1UEEQwFMTIz\nNDUxGTAXBgNVBAkMEEV4YW1wbGUgU3RyZWV0IDIwWTATBgcqhkjOPQIBBggqhkjO\nPQMBBwNCAASYBjc7KadwuOFlI4YAPxtBUxc1fUj9DIguud5Bl+06jTdPnTqVo00w\n23LO0ILzuJ+JXMc8gvv+BtRhzrNM1IYao4GAMH4wCQYDVR0TBAIwADALBgNVHQ8E\nBAMCA4gwEwYDVR0lBAwwCgYIKwYBBQUHAwIwEQYJYIZIAYb4QgEBBAQDAgeAMB0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qel1xtQAk1Cpfdvfi7gn2cEFRD7U\nexg3AemJMBV26spcGnaf/smfcHeVWo9lwqzyWzwvGYTEeb1MajCgINnh39DZBHlO\nPE77yRyuANtDzWMo0ZNnlU+FpHTexhooQnYRKtEagHDTTF2ZuSkcJnczlTFAP4cM\ntvEro4ePMdxLuMf4lVrBt+OudsVnoij+U9OHJst7Czk5MXyZzGHgkmXOg+JUW49D\nOfjDq0HiW64QeWYu+lsEFS+2sHES82R/JBmXWbqHy68JhDUubzAi7nRXEHkKP9N3\nXF6jD3Fyn47kN4uYeHas9eCvMFmxfv6TGzCPgfS9PH0ZaZLM/Cp6u9l4DhyvFV9n\nuazsa9pkwlQftE8L1Xo/hGmKBdLGJDRDQo1r4eYYZlzS94tj5p0thztTmUWZFOl2\ndOTyux8EvhpsefDYwtlJ1wxqvFdDm5WGCxeZd6YAsV/KukVQLakX1LS/i7FEFsuL\nZ89WjWdHC2A3liKOa/y0/vy9gOY7GScvRnyUSthQ2Y0DYO89KDzY6Q6ILbpsVr8=\n-----END CERTIFICATE-----",
           "trust_store": "2222"
         }
      							

      Elements of the request message body include:

      Element Type Description Notes
      certificate_chain

      string or list

      The certificate chain can be specified as a string of individual certificates separated by a newline, or as a list of strings containing the certificates. The certificates must be specified in PEM format.

       
      trust_store

      string

      The identifier of the trust store that is used to validate the certificate chain, or null, if you want to disable validation.

       

      The result will be the X.509 identifier referring to the private key + certificate chain pair.

      NOTE: The X.509 identifier can only be used in REST configuration.

  6. Use the X.509 identifier to replace your web server certificate. For more information, see Internal certificates.

  7. Commit your changes.

    For more information, see Commit a transaction.

Example: Querying existing CSRs

The following is a sample response received when existing CSRs are queried.

For details of the meta object, see Message format.

{
     "meta": {
       "href": "/api/pki/certificate/requests",
       "parent": "/api/pki/certificate"
     },
     "items": [
       {
         "meta": {"href": "/api/pki/certificate/requests/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"},
         "key": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
         "body": {
           "certificate_chain": null,
           "fingerprint": {
             "digest": "eb:46:b6:bf:dc:4e:c6:cb:81:9b:ee:fd:a1:8d:7d:72:86:3d:48:87:ba:94:e0:0c:79:8e:73:77:fd:5b:97:3b",
             "hash_algorithm": "sha256"
},
           "subject": [
             {"name": "countryName", "value": "US"},
             {"name": "stateOrProvinceName", "value": "CA"},
             {"name": "streetAddress", "value": "Example Street"},
             {"name": "organizationName", "value": "Example Organization"},
             {"name": "commonName", "value": "first.example.com"},
             {"name": "emailAddress", "value": "info@example.com"}
            ],
           "extensions": [
             {"name": "basicConstraints", "value": "CA:FALSE", "critical": true},
             {"name": "keyUsage", "value": "digitalSignature,keyAgreement", "critical": true},
             {"name": "extendedKeyUsage", "value": "clientAuth","critical": false},
             {"name": "subjectAltName", "value": "IP:123.123.123.123,DNS:second.example.com", "critical": false}
],
           "pem": "-----BEGIN CERTIFICATE REQUEST-----\nMIICPzCCAeQCAQAwgegxCzAJBgNVBAYTAlVTMQ4wDAYDVQQRDAUxMjM0NTELMAkG\nA1UECAwCQ0ExFTATBgNVBAcMDEV4YW1wbGUgQ2l0eTEXMBUGA1UECQwORXhhbXBs\nZSBTdHJlZXQxHTAbBgNVBAoMFEV4YW1wbGUgT3JnYW5pemF0aW9uMRcwFQYDVQQL\nDA5FeGFtcGxlIFVuaXQgMTEXMBUGA1UECwwORXhhbXBsZSBVbml0IDIxGjAYBgNV\nBAMMEWZpcnN0LmV4YW1wbGUuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQGV4YW1w\nbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEC/MAO3IIhG6zInpQxOJ9\nfFnOQlW11IoeMXHfhrhRC9OI9W77MjxRNX7gXS1WVcEQPxgXtE9sHdc6Z8jgupIi\ncKCBmDCBlQYJKoZIhvcNAQkOMYGHMIGEMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgOI\nMBMGA1UdJQQMMAoGCCsGAQUFBwMCMBEGCWCGSAGG+EIBAQQEAwIGQDAdBgNVHQ4E\nFgQUDr0ZP/F5s++a46mW+yIgs1CNWwYwIwYDVR0RBBwwGocEe3t7e4ISc2Vjb25k\nLmV4YW1wbGUuY29tMAoGCCqGSM49BAMEA0kAMEYCIQCrRLitgHeDJ34VSksqwbZy\nUA0Klz6l2EzrRHGR0UOPbAIhAKA7u8xplNauUutkQPd4KHT5eyBMs0GUYJm1gr3r\ntZFr\n-----END CERTIFICATE REQUEST-----\n",
           "public_key": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEC/MAO3IIhG6zInpQxOJ9fFnOQlW1\n1IoeMXHfhrhRC9OI9W77MjxRNX7gXS1WVcEQPxgXtE9sHdc6Z8jgupIicA==\n-----END PUBLIC KEY-----\n"
        }
      },
      {
         "meta": {"href": "/api/pki/certificate/requests/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXY"},
         "key": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXY",
         "body": {
           "certificate_chain": [
				"-----BEGIN CERTIFICATE-----\nMIID+zCCAeOgAwIBAgIBSzANBgkqhkiG9w0BAQsFADAXMRUwEwYDVQQDDAxFeGFt\ncGxlIENBIDIwHhcNMjAwNzE0MTUxMzAwWhcNMzAwODMxMTUxMzAwWjCBsjELMAkG\nA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRcwFQYDVQQHDA5FeGFtcGxlIENpdHkgMjEf\nMB0GA1UECgwWRXhhbXBsZSBPcmdhbml6YXRpb24gMjEVMBMGA1UECwwMRXhhbXBs\nZSBVbml0MRowGAYDVQQDDBF0aGlyZC5leGFtcGxlLmNvbTEOMAwGA1UEEQwFMTIz\nNDUxGTAXBgNVBAkMEEV4YW1wbGUgU3RyZWV0IDIwWTATBgcqhkjOPQIBBggqhkjO\nPQMBBwNCAASYBjc7KadwuOFlI4YAPxtBUxc1fUj9DIguud5Bl+06jTdPnTqVo00w\n23LO0ILzuJ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/2fH0W+NLTRdGO9V0NL\nKMRXrlJ8Gy3A/4U/Hx5Lo4dQQckePTdXzFQARX5m/7VIf2+YlUDlNre/fMt5aeWG\n67vlUnUYLqgHqV2G5QmqZ26DUwcMTXK3oy8rqel1xtQAk1Cpfdvfi7gn2cEFRD7U\nexg3AemJMBV26spcGnaf/smfcHeVWo9lwqzyWzwvGYTEeb1MajCgINnh39DZBHlO\nPE77yRyuANtDzWMo0ZNnlU+FpHTexhooQnYRKtEagHDTTF2ZuSkcJnczlTFAP4cM\ntvEro4ePMdxLuMf4lVrBt+OudsVnoij+U9OHJst7Czk5MXyZzGHgkmXOg+JUW49D\nOfjDq0HiW64QeWYu+lsEFS+2sHES82R/JBmXWbqHy68JhDUubzAi7nRXEHkKP9N3\nXF6jD3Fyn47kN4uYeHas9eCvMFmxfv6TGzCPgfS9PH0ZaZLM/Cp6u9l4DhyvFV9n\nuazsa9pkwlQftE8L1Xo/hGmKBdLGJDRDQo1r4eYYZlzS94tj5p0thztTmUWZFOl2\ndOTyux8EvhpsefDYwtlJ1wxqvFdDm5WGCxeZd6YAsV/KukVQLakX1LS/i7FEFsuL\nZ89WjWdHC2A3liKOa/y0/vy9gOY7GScvRnyUSthQ2Y0DYO89KDzY6Q6ILbpsVr8=\n-----END CERTIFICATE-----\n"
           ],
           "fingerprint": {
             "digest": "a3:34:5a:77:3d:14:da:a6:d7:de:7a:43:4d:e3:2c:36:35:53:74:5c:61:cf:c1:39:bb:75:50:40:29:30:dc:2e",
             "hash_algorithm": "sha256"
           },
           "subject": [
             {"name": "countryName", "value": "US"},
             {"name": "stateOrProvinceName", "value": "CA"},
             {"name": "streetAddress", "value": "Example Street 2"},
             {"name": "organizationName", "value": "Example Organization 2"},
             {"name": "commonName", "value": "third.example.com"},
             {"name": "emailAddress", "value": "info2@example.com"}
           ],
           "extensions": [
             {"name": "basicConstraints", "value": "CA:FALSE", "critical": true},
             {"name": "keyUsage", "value": "digitalSignature,keyAgreement", "critical": true},
             {"name": "extendedKeyUsage", "value": "clientAuth", "critical": false},
             {"name": "subjectAltName", "value": "DNS:fourth.example.com", "critical": false}
           ],
           "pem": "-----BEGIN CERTIFICATE REQUEST-----\nMIICIzCCAckCAQAwgdQxCzAJBgNVBAYTAlVTMQ4wDAYDVQQRDAUxMjM0NTELMAkG\nA1UECAwCQ0ExFzAVBgNVBAcMDkV4YW1wbGUgQ2l0eSAyMRkwFwYDVQQJDBBFeGFt\ncGxlIFN0cmVldCAyMR8wHQYDVQQKDBZFeGFtcGxlIE9yZ2FuaXphdGlvbiAyMRUw\nEwYDVQQLDAxFeGFtcGxlIFVuaXQxGjAYBgNVBAMMEXRoaXJkLmV4YW1wbGUuY29t\nMSAwHgYJKoZIhvcNAQkBFhFpbmZvMkBleGFtcGxlLmNvbTBZMBMGByqGSM49AgEG\nCCqGSM49AwEHA0IABJgGNzspp3C44WUjhgA/G0FTFzV9SP0MiC653kGX7TqNN0+d\nOpWjTTDbcs7QgvO4n4lcxzyC+/4G1GHOs0zUhhqggZEwgY4GCSqGSIb3DQEJDjGB\ngDB+MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgOIMBMGA1UdJQQMMAoGCCsGAQUFBwMC\nMBEGCWCGSAGG+EIBAQQEAwIHgDAdBgNVHQ4EFgQUrdDV8+P98jDwpn6M/Ibq3o9J\ngcswHQYDVR0RBBYwFIISZm91cnRoLmV4YW1wbGUuY29tMAoGCCqGSM49BAMEA0gA\nMEUCIQDn5/JLVu3TGZqBXodETmj6ndamg9wFi7bxow4krngQtQIgTaDXwBvl0L36\ncHEQP5At2ss8kKB4QIxEFeesGgMkwx8=\n-----END CERTIFICATE REQUEST-----\n",
           "public_key": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmAY3OymncLjhZSOGAD8bQVMXNX1I\n/QyILrneQZftOo03T506laNNMNtyztCC87ifiVzHPIL7/gbUYc6zTNSGGg==\n-----END PUBLIC KEY-----\n"
         }
       }
     ]
   }
			
Example: Querying a single CSR

The following is a sample response received when a single CSR is queried.

For details of the meta object, see Message format.

{
     "meta": {
       "href": "/api/pki/certificate/requests/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
       "parent": "/api/pki/certificate/requests"
     },
     "key": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
     "body": {
       "certificate_chain": null,
       "fingerprint": {
         "digest": "eb:46:b6:bf:dc:4e:c6:cb:81:9b:ee:fd:a1:8d:7d:72:86:3d:48:87:ba:94:e0:0c:79:8e:73:77:fd:5b:97:3b",
         "hash_algorithm": "sha256"
       },
       "subject": [
         {"name": "countryName", "value": "US"},
         {"name": "stateOrProvinceName", "value": "CA"},
         {"name": "streetAddress", "value": "Example Street"},
         {"name": "organizationName", "value": "Example Organization"},
         {"name": "commonName", "value": "first.example.com"},
         {"name": "emailAddress", "value": "info@example.com"}
       ],
       "extensions": [
         {"name": "basicConstraints", "value": "CA:FALSE", "critical": true},
         {"name": "keyUsage", "value": "digitalSignature,keyAgreement", "critical": true},
         {"name": "extendedKeyUsage", "value": "clientAuth", "critical": false},
         {"name": "subjectAltName", "value": "IP:123.123.123.123,DNS:second.example.com", "critical": false}
       ],
       "pem": "-----BEGIN CERTIFICATE REQUEST-----\nMIICPzCCAeQCAQAwgegxCzAJBgNVBAYTAlVTMQ4wDAYDVQQRDAUxMjM0NTELMAkG\nA1UECAwCQ0ExFTATBgNVBAcMDEV4YW1wbGUgQ2l0eTEXMBUGA1UECQwORXhhbXBs\nZSBTdHJlZXQxHTAbBgNVBAoMFEV4YW1wbGUgT3JnYW5pemF0aW9uMRcwFQYDVQQL\nDA5FeGFtcGxlIFVuaXQgMTEXMBUGA1UECwwORXhhbXBsZSBVbml0IDIxGjAYBgNV\nBAMMEWZpcnN0LmV4YW1wbGUuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQGV4YW1w\nbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEC/MAO3IIhG6zInpQxOJ9\nfFnOQlW11IoeMXHfhrhRC9OI9W77MjxRNX7gXS1WVcEQPxgXtE9sHdc6Z8jgupIi\ncKCBmDCBlQYJKoZIhvcNAQkOMYGHMIGEMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgOI\nMBMGA1UdJQQMMAoGCCsGAQUFBwMCMBEGCWCGSAGG+EIBAQQEAwIGQDAdBgNVHQ4E\nFgQUDr0ZP/F5s++a46mW+yIgs1CNWwYwIwYDVR0RBBwwGocEe3t7e4ISc2Vjb25k\nLmV4YW1wbGUuY29tMAoGCCqGSM49BAMEA0kAMEYCIQCrRLitgHeDJ34VSksqwbZy\nUA0Klz6l2EzrRHGR0UOPbAIhAKA7u8xplNauUutkQPd4KHT5eyBMs0GUYJm1gr3r\ntZFr\n-----END CERTIFICATE REQUEST-----\n",
       "public_key": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEC/MAO3IIhG6zInpQxOJ9fFnOQlW1\n1IoeMXHfhrhRC9OI9W77MjxRNX7gXS1WVcEQPxgXtE9sHdc6Z8jgupIicA==\n-----END PUBLIC KEY-----\n"
     }
   }
			

Elements of the response message body include:

Element Type Description Notes
certificate_chain

string

The certificate chain received from the trusted CA.

 
fingerprint

object

 

 

fingerprint.digest

string

The fingerprint of the certificate, for example ef:d3:8e:d0:81:4f:a2:8f:3b:8b:0c:dd:c7:8f:8c:7e.

 

fingerprint.hash_algorithm

string

The hash algorithm used to create the fingerprint, for example, sha256.

 

subject

object

The subject string of the certificate.

 

extensions

object

The list of extensions.

 

pem

string

The certificate signing request in PEM format.

 

public_key

string

The public key in PEM format.

 

Example: Deleting a CSR

The following is a sample response received when a CSR is deleted.

For details of the meta object, see Message format.

{
     "meta": {
       "href": "/api/pki/certificate/requests",
       "parent": "/api/pki/certificate"
     },
     "items": []
   }
			
HTTP response codes

HTTP response codes comprise of standard or endpoint-specific HTTP status and error codes. The following table lists the endpoint-specific HTTP response codes for this request.

HTTP response code Status/Error Description

400

SyntacticError

Syntax error: Could not load PEM certificate: Unable to load certificate; error=\"[('PEM routines', 'get_name', 'no start line')]\"

400

CertChainValidationError

You have attempted to store a certificate chain, which could not be validated with the specified Trust Store.

400

OnlyOnCentralNode

Certificate signing requests can only be created or updated on the Central management node of the cluster.

404

NoMatchingCsrFound

You have attempted to store a certificate chain which belongs to a private key for which no certificate signing requests can be found. Make sure to only send certificates which belong to a private key for which a certificate signing request exists.

For more information and a complete list of standard HTTP response codes, see Application level error codes.

Certificates stored on SPS

To create a new certificate, you have to POST the certificate and its private key as a JSON object to the https://<IP-address-of-SPS>/api/x509 endpoint. For details, see Create a new object. The body of the POST request must contain a JSON object with the parameters listed in Element . The response to a successful POST message is a JSON object that includes the reference ID of the created certificate in its key attribute. You can reference this ID in other parts of the configuration. Note that you can use a certificate object for only one purpose, that is, you cannot reference one object twice.

URL
POST https://<IP-address-of-SPS>/api/configuration/x509
  • Note that the GET method is not permitted on this endpoint, you cannot list the existing certificates. However, if you know the reference ID of a certificate, you can display its properties:

    GET https://<IP-address-of-SPS>/api/configuration/x509/<reference-ID-of-the-private-key;>
  • You cannot directly delete or modify a certificate, the DELETE and PUT methods are not permitted on certificate objects. To update a certificate, create a new one, then update the object that uses the old certificate to reference the new certificate.

Table 7: Headers
Header name Description Required Values
Content-Type Specifies the type of the data sent. SPS uses the JSON format Required application/json
session_id Contains the authentication token of the user Required The value of the session ID cookie received from the REST server in the authentication response, for example, a1f71d030e657634730b9e887cb59a5e56162860. For details on authentication, see Authenticate to the SPS REST API.
Sample request

The following command creates a new certificate object. Note the following requirements:

  • The key must be in PKCS-1 PEM format.

  • You need the certificate and the private key as well.

  • Encrypted private keys are not supported.

  • The attributes of the POST message that contain the certificate and the private key must be a single line, enclosed in double-quotes.

  • Replace line-breaks in the PEM certificate with \n

  • The certificate and the certificate chain must be valid, SPS will reject invalid certificates and invalid certificate chains.

    curl -X POST -H "Content-Type: application/json" --cookie cookies https://<IP-address-of-SPS>/api/configuration/x509 --data '{"private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAu3QMMhqeg9ZMLNfdvQoNN1deVRE2SR0VKY+ALnzPZF4fUoJy\n.....\nI2SchDibk/Xj/ZvuEQ23LvzayWOVVuVHtH3JZX3SU4Sa0vpaeC+3oddVTwQOWRq0\n ......... Qbn5W3xKz4vXDDQHEbEsvDQ9A7+uCEuHpO4s33IK9KEa0Zdp745AU0DSGXN4HFzc\n-----END RSA PRIVATE KEY-----\n"}'

    The body should be:

    {
        "certificate": "-----BEGIN CERTIFICATE-----\nMIIEpAIBAAKCAQEAu3QMMhqeg9ZMLNfdvQoNN1deVRE2SR0VKY+ALnzPZF4fUoJy\n.....\nI2SchDibk/Xj/ZvuEQ23LvzayWOVVuVHtH3JZX3SU4Sa0vpaeC+3oddVTwQOWRq0\n ......... Qbn5W3xKz4vXDDQHEbEsvDQ9A7+uCEuHpO4s33IK9KEa0Zdp745AU0DSGXN4HFzc\n-----END CERTIFICATE-----",
        "private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAu3QMMhqeg9ZMLNfdvQoNN1deVRE2SR0VKY+ALnzPZF4fUoJy\n.....\nI2SchDibk/Xj/ZvuEQ23LvzayWOVVuVHtH3JZX3SU4Sa0vpaeC+3oddVTwQOWRq0\n ......... Qbn5W3xKz4vXDDQHEbEsvDQ9A7+uCEuHpO4s33IK9KEa0Zdp745AU0DSGXN4HFzc\n-----END RSA PRIVATE KEY-----",
        "issuer_chain": []
    }
    Element Type Description

    certificate

    string

    The certificate in PKCS-1 PEM format (replace line-breaks with \n). For example:

    -----BEGIN CERTIFICATE-----\nMIIEpAIBAAKCAQEAu3QMMhqeg9ZMLNfdvQoNN1deVRE2SR0VKY+ALnzPZF4fUoJy\n.....\nI2SchDibk/Xj/ZvuEQ23LvzayWOVVuVHtH3JZX3SU4Sa0vpaeC+3oddVTwQOWRq0\n ......... Qbn5W3xKz4vXDDQHEbEsvDQ9A7+uCEuHpO4s33IK9KEa0Zdp745AU0DSGXN4HFzc\n-----END CERTIFICATE-----

    private_key

    string

    The private key of the certificate, without encryption or password protection (replace line-breaks with \n). For example:

    -----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAu3QMMhqeg9ZMLNfdvQoNN1deVRE2SR0VKY+ALnzPZF4fUoJy\n.....\nI2SchDibk/Xj/ZvuEQ23LvzayWOVVuVHtH3JZX3SU4Sa0vpaeC+3oddVTwQOWRq0\n ......... Qbn5W3xKz4vXDDQHEbEsvDQ9A7+uCEuHpO4s33IK9KEa0Zdp745AU0DSGXN4HFzc\n-----END RSA PRIVATE KEY-----

    issuer_chain

    list

    A comma-separated list of the Certificate Authority (CA) certificates that can be used to validate the uploaded certificate.

    Querying a specific key returns the following information about the key:

    curl --cookie cookies https://<IP-address-of-SPS>/api/configuration/x509/<reference-ID-of-the-private-key;>
    Element Type Description
    fingerprint string The fingerprint of the certificate.
    digest string The fingerprint of the certificate, for example ef:d3:8e:d0:81:4f:a2:8f:3b:8b:0c:dd:c7:8f:8c:7e
    hash_algorithm string The hash algorithm used to create the fingerprint, for example, sha256.
    subject string The subject string of the certificate.
    Response

    The response to a successful POST message is a JSON object that includes the reference ID of the created certificate in its key attribute.

    For details of the meta object, see Message format.

    {
        "key": "faa96916-c85e-46ff-8697-f4cc5e596e7f",
        "meta": {
            "href": "/api/configuration/x509/faa96916-c85e-46ff-8697-f4cc5e596e7f",
            "parent": "/api/configuration/x509",
            "transaction": "/api/transaction"
        }
    }

    The response to querying a specific certificate is a JSON object that includes the parameters of the certificate, for example:

    {
        "body": {
            "fingerprint": {
                "digest": "ef:d3:8e:d0:81:4f:a2:8f:3b:8b:0c:dd:c7:8f:8c:7e",
                "hash_algorithm": "md5"
            },
            "subject": "C=RO/ST=State/L=Locality/O=Organization/OU=OrganizationalUnit/CN=example.com/emailAddress=root@example.com"
        },
        "key": "6c4d1116-d79d-475b-bb37-9f844f085c14",
        "meta": {
            "first": "/api/configuration/x509/e5d13d18-07c5-43fa-89f4-c3d2ece17c71",
            "href": "/api/configuration/x509/6c4d1116-d79d-475b-bb37-9f844f085c14",
            "last": "/api/configuration/x509/6c4d1116-d79d-475b-bb37-9f844f085c14",
            "next": null,
            "parent": "/api/configuration/x509",
            "previous": "/api/configuration/x509/e5d13d18-07c5-43fa-89f4-c3d2ece17c71",
            "transaction": "/api/transaction"
        }
    Status and error codes

    The following table lists the typical status and error codes for this request. For a complete list of error codes, see Application level error codes.

    Code Description Notes
    201 Created The new resource was successfully created.
    400 SyntacticError Syntax error: Could not load PEM key: Unsupported private key format, only PKCS-1 is supported. Encrypted private keys are not supported.
    401 Unauthenticated The requested resource cannot be retrieved because the client is not authenticated and the resource requires authorization to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
    403 Unauthorized The requested resource cannot be retrieved because the client is not authorized to access it. The details section contains the path that was attempted to be accessed, but could not be retrieved.
    404 NotFound The requested object does not exist.
    405 MethodNotAllowed The method <method> is not allowed for this node.
    Modify or delete certificate

    You cannot directly delete or modify a certificate, the DELETE and PUT methods are not permitted on certificate objects. To update a certificate, create a new one, then update the object that uses the old certificate to reference the new certificate. After you commit the transaction, SPS will automatically delete the old certificate.

  • Related Documents

    The document was helpful.

    Seleziona valutazione

    I easily found the information I needed.

    Seleziona valutazione