{
  "openapi": "3.1.1",
  "info": {
    "title": "RSA/ECC Key Inspector API",
    "version": "1.0.0",
    "summary": "Inspect PEM, DER, JWK or OpenSSH keys: type, size, curve, fingerprints, thumbprint and weaknesses.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://rsaecckeyinspector.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Inspect PEM, DER, JWK or OpenSSH keys: type, size, curve, fingerprints, thumbprint and weaknesses.",
        "description": "Paste an RSA, EC (P-256/P-384/P-521, secp256k1, brainpool), Ed25519/Ed448 or X25519 key as PEM, base64/hex DER, JWK or OpenSSH line. Shows key type, size or curve, public exponent, SHA-256 SPKI and OpenSSH fingerprints, the RFC 7638 JWK thumbprint, detects encrypted private keys and their KDF, rates the key against current guidance and converts the PUBLIC key between PEM, JWK and OpenSSH formats.\n\nMethodology:\n- The format is detected from the text: PEM labels (PUBLIC KEY, RSA PUBLIC KEY, PRIVATE KEY, RSA/EC PRIVATE KEY, ENCRYPTED PRIVATE KEY, OPENSSH PRIVATE KEY, CERTIFICATE, CERTIFICATE REQUEST), JSON JWK / JWK sets, OpenSSH authorized_keys lines and RFC 4716 SSH2 blocks; anything else is tried as base64 or hex DER (SPKI, PKCS#8, PKCS#1, SEC1).\n- Keys are imported with Node.js crypto (OpenSSL); the size, exponent and curve come from the key object, the algorithm identifiers from a DER parse of the SubjectPublicKeyInfo.\n- Fingerprints: SHA-256 over the DER SubjectPublicKeyInfo (hex and base64, the pin-sha256 format), OpenSSH SHA256:/MD5: over the SSH wire encoding, and the RFC 7638 JWK thumbprint (SHA-256 over the required members in lexicographic order).\n- Encrypted keys are recognised without a passphrase: PKCS#8 EncryptedPrivateKeyInfo (PBES2 with PBKDF2 or scrypt parameters), legacy Proc-Type: 4,ENCRYPTED PEM and openssh-key-v1 cipher/KDF. The OpenSSH public key is read from the unencrypted file header.\n- Ratings follow NIST SP 800-57 Part 1 Rev. 5 (RSA-2048 = 112-bit security, acceptable until 2030; ≥3072 bits = 128-bit), FIPS 186-5 (DSA no longer approved for signing) and common TLS/SSH support.\n- Conversions only ever output the PUBLIC key (SPKI PEM, JWK, OpenSSH). Private key material is never echoed back.\n\nKeys are processed on the server for this request and not stored. Do not paste production private keys into any web tool; with JavaScript enabled this page converts private keys to public keys locally before sending.",
        "tags": [
          "crypto"
        ],
        "x-mcp-tool": "rsa_ecc_key_inspector",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RsaEccKeyInspectorInput"
              },
              "examples": {
                "example1": {
                  "summary": "RSA-2048 public key (PEM)",
                  "value": {
                    "key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh3BIrCB410mLVroKIYbJ\nUPfbt6YGNqOyz/2j7yyi5kOjNVVbFPp02sqjt6i+ZEDvaH5kJIU4P+25V330U0h4\nmXfqN+0yDClu7yxsDLdbVBT7HZHWRuasFoR1ZoZCtlQDg7yP/ubHuWTIVPRHMzRm\n45s7+nUnziEXCDIUhwSxLLTu1Nbo8YfmJEFDKVW+hY8AjlrR6HmNKqjMqiVT+R0U\nVNpB0Y3+koWbPs6WWW0xNpzER2ffGS3IPT0sD++SChsbbZYXJ9gVockGuNifXk1J\n+O/wdXu1FFp9oIua/h2pMwfCYOTci7NZsY4P1dcELAF/+Q/bIz//QMgW+QyGVk9c\nEwIDAQAB\n-----END PUBLIC KEY-----"
                  }
                },
                "example2": {
                  "summary": "P-256 public JWK (RFC 7515 example key)",
                  "value": {
                    "key": "{\"kty\":\"EC\",\"crv\":\"P-256\",\"x\":\"f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU\",\"y\":\"x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0\",\"kid\":\"rfc7515-example\"}"
                  }
                },
                "example3": {
                  "summary": "OpenSSH Ed25519 public key",
                  "value": {
                    "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKFvjbb92spN+tAd+TaDJCCyEIYO+d8Lh2R2llUEcjt0 demo@example",
                    "showAsn1": false
                  }
                },
                "example4": {
                  "summary": "Weak RSA-512 key",
                  "value": {
                    "key": "-----BEGIN PUBLIC KEY-----\nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMQNesk/E6YVJmHFkvS8JJe4DuE3aZT9\nK2uFLODY5xxa8f1udg9uMFVCO5o6UizhNXQczysSbTxp1Bk5shU1ZncCAwEAAQ==\n-----END PUBLIC KEY-----"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RsaEccKeyInspectorResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RsaEccKeyInspectorInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "key": {
            "title": "Key (PEM, base64/hex DER, JWK or OpenSSH)",
            "description": "Public keys are best. Never paste production private keys into any web tool. With JavaScript on, private keys are converted to their public key in your browser before anything is sent.",
            "type": "string",
            "maxLength": 200000
          },
          "showAsn1": {
            "title": "Show the ASN.1 structure of the public key",
            "type": "boolean",
            "default": true
          }
        },
        "required": [
          "key"
        ]
      },
      "RsaEccKeyInspectorResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "inputFormat",
              "keyType",
              "isPrivate",
              "encrypted",
              "encryption",
              "sizeBits",
              "curve",
              "publicExponent",
              "comment",
              "fingerprints",
              "publicJwk",
              "publicPem",
              "opensshPublic",
              "rating",
              "findings"
            ],
            "properties": {
              "inputFormat": {
                "type": "string"
              },
              "keyType": {
                "type": "string"
              },
              "isPrivate": {
                "type": "boolean"
              },
              "encrypted": {
                "type": "boolean"
              },
              "encryption": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sizeBits": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "curve": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "publicExponent": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "comment": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "fingerprints": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "spkiSha256Hex",
                  "spkiSha256Base64",
                  "opensshSha256",
                  "opensshMd5",
                  "jwkThumbprint"
                ],
                "properties": {
                  "spkiSha256Hex": {
                    "type": "string"
                  },
                  "spkiSha256Base64": {
                    "type": "string",
                    "description": "base64 SHA-256 of the SPKI (HPKP / pin-sha256 format)"
                  },
                  "opensshSha256": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "opensshMd5": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "jwkThumbprint": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "RFC 7638, SHA-256, base64url"
                  }
                }
              },
              "publicJwk": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": {
                  "type": "string"
                }
              },
              "publicPem": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "opensshPublic": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "rating": {
                "type": "string",
                "enum": [
                  "good",
                  "ok",
                  "weak",
                  "critical",
                  "unknown"
                ]
              },
              "findings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "level",
                    "text"
                  ],
                  "properties": {
                    "level": {
                      "type": "string",
                      "enum": [
                        "good",
                        "ok",
                        "info",
                        "weak",
                        "critical"
                      ]
                    },
                    "text": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}