Endurance

Certificate signing requests

Updated

Certificate signing requests

Get All Certificate Signing Requests

GET /certificates/csrs

curl
curl -X GET "https://appliance.example.com/api/v1/certificates/csrs" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/certificates/csrs", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: List the certificate signing requests
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/certificates/csrs
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "uid": "df9-b60-96e-3c8",
  "message": "Certificate Signing Requests",
  "data": {
    "aae-45a-08e-958": {
      "name": "Management",
      "certInfo": {
        "commonName": "loadbalancer.localdomain",
        "organisation": "loadbalancer.org",
        "country": "US",
        "subjectAlt": []
      },
      "keyLength": 4069,
      "signatureAlgorithm": "sha256",
      "days": 730,
      "linkCertId": "e15-36c-3ce-8c5"
    }
  }
}

Add a Certificate Signing Request

POST /certificates/csrs

This change is staged. Send PUT /services/apply to apply it.

Body parameters
name string Required
certInfo array Required
keyLength integer Required
signatureAlgorithm Required default: "sha256" sha256 | sha384 | sha512

The digest the request is signed with, one of GET /certificates/signature-algorithm.

curl
curl -X POST "https://appliance.example.com/api/v1/certificates/csrs" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "<name>",
  "certInfo": [
    "<certInfo>"
  ],
  "keyLength": 0,
  "signatureAlgorithm": "sha256"
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'name' => '<name>',
    'certInfo' => [
        '<certInfo>',
    ],
    'keyLength' => 0,
    'signatureAlgorithm' => 'sha256',
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "name": "<name>",
    "certInfo": [
        "<certInfo>"
    ],
    "keyLength": 0,
    "signatureAlgorithm": "sha256"
}

response = requests.post("https://appliance.example.com/api/v1/certificates/csrs", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "name": "<name>",
  "certInfo": [
    "<certInfo>"
  ],
  "keyLength": 0,
  "signatureAlgorithm": "sha256"
}),
});

const data = await response.json();
Bruno
meta {
  name: Create a certificate signing request
  type: http
  seq: 1
}

post {
  url: https://{{node-0}}:{{port}}/api/v1/certificates/csrs
  body: json
  auth: bearer
}

headers {
  Content-Type: application/json
}

auth:bearer {
  token: {{token}}
}

body:json {
  {
    "name": "<name>",
    "certInfo": [
      "<certInfo>"
    ],
    "keyLength": 0,
    "signatureAlgorithm": "sha256"
  }
}
Response
{
  "status": "success",
  "message": "New Certificate Signing Request: {name} successfully added",
  "data": {
    "id": "4e8-2c3-b53-1f7"
  }
}

By ID

Get Certificate Signing Request by ID

GET /certificates/csrs/{id}

Path parameters
id string Required
curl
curl -X GET "https://appliance.example.com/api/v1/certificates/csrs/{id}" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/certificates/csrs/{id}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Get a certificate signing request
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/certificates/csrs/{id}
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "uid": "c0b-7e6-583-1c1",
  "message": "Certificate Signing Request",
  "data": {
    "id": "4e8-2c3-b53-1f7",
    "name": "Generate CSR",
    "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIIDDjCCAfYCBFRlc3QxETI8W/WJYA4IB\nAQBmbMCCXRyZkBD8IK5M.......TEakhwTJ+wtAdBCL8m7ckN6on5kxnyyLQ8PgYNybRaYe\n8qVkXGlS89INYMOPvycHxAB\n-----END CERTIFICATE REQUEST-----\n",
    "privateKey": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwvtd4Z99htbLYwHi5g477.......uFXxB1rEBJ8MVwcmpFG89UrEtcFvua1oQgACgiE8\nARf4qXSTPDd+DclQgde88OU=\n-----END PRIVATE KEY-----\n",
    "certInfo": {
      "commonName": "test.com",
      "organisation": "Test",
      "organisationalUnit": "Test",
      "locality": "Test",
      "state": "Test",
      "country": "GB",
      "email": "test@test.com",
      "subjectAlt": [
        "www.test.com"
      ]
    },
    "keyLength": 2048,
    "signatureAlgorithm": "sha256",
    "selfSigned": true,
    "days": 365,
    "linkCertId": ""
  }
}

Edit a Certificate Signing Request

PUT /certificates/csrs/{id}

This change is staged. Send PUT /services/apply to apply it.

Path parameters
id string Required

The id of the csr.

Body parameters
name string Required
selfSigned boolean Required
certInfo array Required
keyLength integer Required
signatureAlgorithm string Required

The digest the request is signed with, one of GET /certificates/signature-algorithm. A request stored with an algorithm no longer offered keeps it, but is refused if the edit signs it again.

curl
curl -X PUT "https://appliance.example.com/api/v1/certificates/csrs/{id}" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "<name>",
  "selfSigned": true,
  "certInfo": [
    "<certInfo>"
  ],
  "keyLength": 0,
  "signatureAlgorithm": "<signatureAlgorithm>"
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'name' => '<name>',
    'selfSigned' => true,
    'certInfo' => [
        '<certInfo>',
    ],
    'keyLength' => 0,
    'signatureAlgorithm' => '<signatureAlgorithm>',
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "name": "<name>",
    "selfSigned": true,
    "certInfo": [
        "<certInfo>"
    ],
    "keyLength": 0,
    "signatureAlgorithm": "<signatureAlgorithm>"
}

response = requests.put("https://appliance.example.com/api/v1/certificates/csrs/{id}", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "name": "<name>",
  "selfSigned": true,
  "certInfo": [
    "<certInfo>"
  ],
  "keyLength": 0,
  "signatureAlgorithm": "<signatureAlgorithm>"
}),
});

const data = await response.json();
Bruno
meta {
  name: Update a certificate signing request
  type: http
  seq: 1
}

put {
  url: https://{{node-0}}:{{port}}/api/v1/certificates/csrs/{id}
  body: json
  auth: bearer
}

headers {
  Content-Type: application/json
}

auth:bearer {
  token: {{token}}
}

body:json {
  {
    "name": "<name>",
    "selfSigned": true,
    "certInfo": [
      "<certInfo>"
    ],
    "keyLength": 0,
    "signatureAlgorithm": "<signatureAlgorithm>"
  }
}
Response
{
  "status": "success",
  "message": "Certificate Signing Request has been updated successfully"
}

Delete Certificate Signing Request by ID

DELETE /certificates/csrs/{id}

This change is staged. Send PUT /services/apply to apply it.

Path parameters
id string Required
curl
curl -X DELETE "https://appliance.example.com/api/v1/certificates/csrs/{id}" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.delete("https://appliance.example.com/api/v1/certificates/csrs/{id}", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Delete a certificate signing request
  type: http
  seq: 1
}

delete {
  url: https://{{node-0}}:{{port}}/api/v1/certificates/csrs/{id}
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "Certificate Signing Request has been deleted"
}

Apply a signed certificate to a signing request

Apply cart to csr.

PUT /certificates/csrs/{id}/apply

Path parameters
id string Required
curl
curl -X PUT "https://appliance.example.com/api/v1/certificates/csrs/{id}/apply" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}/apply';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.put("https://appliance.example.com/api/v1/certificates/csrs/{id}/apply", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}/apply', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Apply a signed certificate to a signing request
  type: http
  seq: 1
}

put {
  url: https://{{node-0}}:{{port}}/api/v1/certificates/csrs/{id}/apply
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "Successfully apply cert from CSR"
}

Get the text of a certificate signing request

Get the text of a Certificate Signing Request by ID, without its private key, for handing the request to a certificate authority

GET /certificates/csrs/{id}/csr

Path parameters
id string Required
curl
curl -X GET "https://appliance.example.com/api/v1/certificates/csrs/{id}/csr" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}/csr';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/certificates/csrs/{id}/csr", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}/csr', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Get the text of a certificate signing request
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/certificates/csrs/{id}/csr
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "uid": "c0b-7e6-583-1c1",
  "message": "Certificate Signing Request text",
  "data": {
    "id": "4e8-2c3-b53-1f7",
    "name": "Generate CSR",
    "csr": "-----BEGIN CERTIFICATE REQUEST-----\nMIIDDjCCAfYCBFRlc3QxETI8W/WJYA4IB\nAQBmbMCCXRyZkBD8IK5M.......TEakhwTJ+wtAdBCL8m7ckN6on5kxnyyLQ8PgYNybRaYe\n8qVkXGlS89INYMOPvycHxAB\n-----END CERTIFICATE REQUEST-----\n"
  }
}

Renew a self-signed certificate

Renew the self-signed certificate of a certificate signing request, keeping its id. If that certificate has been deleted, a new one is issued and the request’s linkCertId is updated to point at it.

PUT /certificates/csrs/{id}/renew

This change is staged. Send PUT /services/apply to apply it.

Path parameters
id string Required
curl
curl -X PUT "https://appliance.example.com/api/v1/certificates/csrs/{id}/renew" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/certificates/csrs/{id}/renew';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.put("https://appliance.example.com/api/v1/certificates/csrs/{id}/renew", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/certificates/csrs/{id}/renew', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Bruno
meta {
  name: Renew a self-signed certificate
  type: http
  seq: 1
}

put {
  url: https://{{node-0}}:{{port}}/api/v1/certificates/csrs/{id}/renew
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "Successfully renewed the self signed certificate with id {id}"
}