ADR-010: SSL/TLS Certificate Assistant Architecture
Context
The SSL/TLS Certificate Assistant must parse X.509 certificates uploaded as PEM or DER, display detailed metadata (expiration, subject, signature), and convert them to PEM, DER, PKCS#7 or PKCS#12 without compromising private key material.
Decision
Execute all binary parsing and format conversions entirely on the Express backend using `node-forge`; EC certificates, which forge cannot parse, fall back to the native Node.js crypto.X509Certificate.
The LLM (a model from the curated Gemini lineup) is fed *only* derived textual metadata: Subject, Issuer, validity dates, Serial Number, Key Size, SANs and an optional deterministic grade summary. The chat request carries only these parsed fields, never the PEM, so certificate bytes and any private key never reach the AI model prompt.
Consequences
Benefits:
* Guaranteed cryptographic safety: raw private keys are processed locally on the secure server and never sent to cloud LLM APIs. A private key included in a PEM upload is returned only to its owner, in the PEM or bundle download.
* Output formats are exact: DER, PKCS#7 (.p7b) and PKCS#12 (.p12) carry the public certificate only; the PKCS#12 export has no private key and, like PKCS#7, is RSA-only.
* Bypasses LLM binary hallucination limits, ensuring 100% accurate cryptographic output.
* Provides rapid, deterministic conversions with helpful AI explanations.
Alternatives considered
1. Direct AI-generated certificate outputs: Rejected because LLMs cannot reliably produce exact binary formats like DER or PKCS12 without corrupting the cryptographic structure.
2. Pure client-side parsing: Rejected due to heavy library bundling sizes that would slow down client page hydration.