{
  "$id": "https://schemas.sand.binaryedge.io/minion/modules/ssl-simple",
  "title": "SSL Simple Module Output Body",
  "type": "object",
  "properties": {
    "cert_info": {
      "type": "object",
      "properties": {
        "certificate_chain": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/cert"
          }
        }
      },
      "required": [
        "certificate_chain"
      ],
      "additionalProperties": false
    },
    "server_info": {
      "type": "object",
      "properties": {
        "highest_ssl_version_supported": {
          "type": "string",
          "enum": [
            "DTLSv1",
            "DTLSv1.2",
            "DTLSv1.3",
            "SSLv3",
            "TLSv1.0",
            "TLSv1.1",
            "TLSv1.2",
            "TLSv1.3"
          ]
        },
        "hostname": {
          "$ref": "/minion/shared-types#/hostname"
        },
        "ip_address": {
          "$ref": "/minion/shared-types#/ip-address"
        },
        "ja3": {
          "type": "string"
        },
        "ja3_digest": {
          "type": "string"
        },
        "ja3_description": {
          "type": "string"
        },
        "openssl_cipher_string_supported": {
          "type": "string"
        },
        "port": {
          "$ref": "/minion/shared-types#/port-integer"
        }
      },
      "required": [
        "highest_ssl_version_supported",
        "ip_address",
        "openssl_cipher_string_supported",
        "port"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "cert_info",
    "server_info"
  ],
  "additionalProperties": false,
  "$defs": {
    "cert": {
      "type": "object",
      "properties": {
        "as_dict": {
          "type": "object",
          "properties": {
            "extensions": {
              "type": "object"
            },
            "issuer": {
              "$ref": "#/$defs/identifier"
            },
            "public_key_info": {
              "oneOf": [
                {
                  "$comment": "We have encountered servers where this field is blank.",
                  "type": "object",
                  "properties": {},
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "algorithm": {
                      "type": "string",
                      "enum": [
                        "dsa"
                      ]
                    },
                    "g": {
                      "$ref": "/minion/shared-types#/hex-bytes"
                    },
                    "key_size": {
                      "type": "integer"
                    },
                    "p": {
                      "$ref": "/minion/shared-types#/hex-bytes"
                    },
                    "public_key": {
                      "$ref": "/minion/shared-types#/hex-bytes"
                    },
                    "q": {
                      "$ref": "/minion/shared-types#/hex-bytes"
                    },
                    "sha256_fingerprint": {
                      "$ref": "/minion/shared-types#/hex-bytes"
                    }
                  },
                  "required": [
                    "algorithm",
                    "g",
                    "p",
                    "public_key",
                    "q",
                    "sha256_fingerprint"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "algorithm": {
                      "type": "string",
                      "enum": [
                        "ec"
                      ]
                    },
                    "curve": {
                      "type": "string"
                    },
                    "key_size": {
                      "type": "integer"
                    },
                    "public_key": {
                      "$ref": "/minion/shared-types#/hex-bytes"
                    },
                    "sha256_fingerprint": {
                      "$ref": "/minion/shared-types#/hex-bytes"
                    }
                  },
                  "required": [
                    "algorithm",
                    "curve",
                    "key_size",
                    "public_key",
                    "sha256_fingerprint"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "algorithm": {
                      "type": "string",
                      "pattern": "^ed[0-9]+$"
                    },
                    "sha256_fingerprint": {
                      "$ref": "/minion/shared-types#/hex-bytes"
                    }
                  },
                  "required": [
                    "algorithm",
                    "sha256_fingerprint"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "algorithm": {
                      "type": "string",
                      "enum": [
                        "rsa"
                      ]
                    },
                    "exponent": {
                      "type": "integer"
                    },
                    "key_size": {
                      "type": "integer"
                    },
                    "modulus": {
                      "$comment": "Parsing errors in the module caused strings such as `-0:x5:34:...` to appear in the data, preventing the use of hex_bytes",
                      "type": "string"
                    },
                    "sha256_fingerprint": {
                      "$ref": "/minion/shared-types#/hex-bytes"
                    }
                  },
                  "required": [
                    "algorithm",
                    "exponent",
                    "modulus",
                    "sha256_fingerprint"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "self_issued": {
              "type": "boolean"
            },
            "self_signed": {
              "type": "boolean"
            },
            "serial_number": {
              "type": "string"
            },
            "signature_algorithm": {
              "type": "string"
            },
            "signature_value": {
              "$ref": "/minion/shared-types#/hex-bytes"
            },
            "subject": {
              "$ref": "#/$defs/identifier"
            },
            "validity": {
              "type": "object",
              "properties": {
                "not_after": {
                  "type": "string"
                },
                "not_before": {
                  "type": "string"
                }
              },
              "required": [
                "not_after",
                "not_before"
              ],
              "additionalProperties": false
            },
            "version": {
              "oneOf": [
                {
                  "type": "integer",
                  "enum": [
                    1,
                    2,
                    3
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "v1",
                    "v2",
                    "v3"
                  ]
                }
              ]
            }
          },
          "required": [
            "serial_number",
            "signature_algorithm",
            "signature_value",
            "validity"
          ],
          "additionalProperties": false
        },
        "as_pem": {
          "type": "string"
        },
        "sha1_fingerprint": {
          "$ref": "/minion/shared-types#/hex-bytes"
        },
        "sha256_fingerprint": {
          "$ref": "/minion/shared-types#/hex-bytes"
        },
        "spki_subject_fingerprint": {
          "$ref": "/minion/shared-types#/hex-bytes"
        }
      },
      "required": [
        "as_pem"
      ],
      "additionalProperties": false
    },
    "identifier": {
      "type": "object",
      "patternProperties": {
        "^.*$": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  }
}
