{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/x-road-global/json-schema/x-road-global-certificate-authority-schema.json",
  "title": "CertificateAuthority",
  "description": "approved certificate authority information. Only for top CAs.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/x-road-global-security-server-admin-openapi.yml#/components/schemas/CertificateAuthority",
  "type": "object",
  "required": [
    "name",
    "subject_distinguished_name",
    "issuer_distinguished_name",
    "ocsp_response",
    "not_after",
    "top_ca",
    "path",
    "authentication_only"
  ],
  "properties": {
    "name": {
      "type": "string",
      "format": "text",
      "description": "name of the CA, as defined in global conf. Used also as an identifier",
      "minLength": 1,
      "maxLength": 255
    },
    "subject_distinguished_name": {
      "type": "string",
      "format": "text",
      "description": "subject distinguished name",
      "minLength": 1,
      "maxLength": 1024
    },
    "issuer_distinguished_name": {
      "type": "string",
      "format": "text",
      "description": "issuer distinguished name",
      "minLength": 1,
      "maxLength": 1024
    },
    "ocsp_response": {
      "$ref": "#/$defs/CertificateAuthorityOcspResponse"
    },
    "not_after": {
      "type": "string",
      "format": "date-time",
      "description": "certificate authority expires at",
      "minLength": 24,
      "maxLength": 24
    },
    "top_ca": {
      "type": "boolean",
      "description": "if the certificate authority is top CA (instead of intermediate)"
    },
    "path": {
      "type": "string",
      "format": "text",
      "description": "encoded path string from this CA to top CA",
      "minLength": 1
    },
    "authentication_only": {
      "type": "boolean",
      "description": "if certificate authority is limited for authentication use only"
    },
    "certificate_profile_info": {
      "type": "string",
      "format": "text",
      "description": "Fully qualified class name that was used to create the CSR. Implements the ee.ria.xroad.common.certificateprofile.CertificateProfileInfoProvider interface.",
      "minLength": 1,
      "maxLength": 1024
    },
    "default_csr_format": {
      "$ref": "#/$defs/CsrFormat"
    },
    "acme_capable": {
      "type": "boolean",
      "description": "if certificate authority supports ACME"
    },
    "acme_server_ip_addresses": {
      "type": "array",
      "description": "ACME server IP address(es) that can be helpful in configuring the firewall rules.",
      "items": {
        "type": "string",
        "format": "text"
      }
    },
    "ocsp_responders": {
      "type": "array",
      "description": "list of ocsp responders for this CA",
      "items": {
        "$ref": "#/$defs/OcspResponder"
      }
    }
  },
  "$defs": {
    "CertificateAuthorityOcspResponse": {
      "type": "string",
      "description": "certificate authority OCSP status",
      "enum": [
        "NOT_AVAILABLE",
        "OCSP_RESPONSE_UNKNOWN",
        "OCSP_RESPONSE_GOOD",
        "OCSP_RESPONSE_SUSPENDED",
        "OCSP_RESPONSE_REVOKED"
      ]
    },
    "CostType": {
      "description": "cost type for services like TSP-s and OCSP responders",
      "enum": [
        "FREE",
        "PAID",
        "UNDEFINED"
      ],
      "type": "string"
    },
    "CsrFormat": {
      "type": "string",
      "description": "format of the certificate signing request (PEM or DER)",
      "default": "PEM",
      "enum": [
        "PEM",
        "DER"
      ]
    },
    "OcspResponder": {
      "type": "object",
      "description": "OCSP responder",
      "required": [
        "url",
        "cost_type"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "url",
          "description": "url of the OCSP responder",
          "minLength": 1,
          "maxLength": 255,
          "readOnly": true
        },
        "cost_type": {
          "$ref": "#/$defs/CostType"
        }
      }
    }
  }
}