Skip to content

Commit 88d06ef

Browse files
docs: clarify supported PEM key formats and add conversion commands
Add a supported key formats table (PKCS#1 RSA, SEC1 EC supported; PKCS#8, OpenSSH not supported), explain the -traditional flag, provide conversion commands for unsupported formats, and update the FAQ with specific error messages and fixes for PKCS#8 and OpenSSH keys. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0e12bfc commit 88d06ef

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

docs/configuration/configure-aidbox-and-multibox.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,27 @@ You can also use YAML multi-line strings for passing values of the keys:
156156
157157
Keys must be provided in full PEM format, including the `BEGIN` and `END` headers.
158158

159+
**Supported key formats:**
160+
161+
| Format | PEM Header | Supported | Generation Command |
162+
|--------|------------|-----------|-------------------|
163+
| PKCS#1 RSA | `BEGIN RSA PRIVATE KEY` | Yes | `openssl genrsa -traditional -out key.pem 2048` |
164+
| SEC1 EC | `BEGIN EC PRIVATE KEY` | Yes | `openssl ecparam -name prime256v1 -genkey -noout -out key.pem` |
165+
| PKCS#8 | `BEGIN PRIVATE KEY` | No | `openssl genpkey -algorithm RSA` |
166+
| OpenSSH | `BEGIN OPENSSH PRIVATE KEY` | No | `ssh-keygen -t rsa` |
167+
168+
The `-traditional` flag in the RSA generation command ensures OpenSSL outputs PKCS#1 format (`BEGIN RSA PRIVATE KEY`) rather than PKCS#8 (`BEGIN PRIVATE KEY`). PKCS#8 is the default in newer OpenSSL versions and is not currently supported.
169+
170+
If you already have a key in an unsupported format, convert it before use:
171+
172+
```bash
173+
# Convert OpenSSH to PKCS#1:
174+
ssh-keygen -p -m PEM -f key.pem
175+
176+
# Convert PKCS#8 to PKCS#1:
177+
openssl rsa -in key.pem -traditional -out key-pkcs1.pem
178+
```
179+
159180
{% hint style="danger" %}
160181
Starting from version **2602**, Aidbox validates the keypair at startup and **will not start** if:
161182

@@ -173,7 +194,7 @@ The service will fail health and readiness checks, and will log a clear error me
173194
| Bare base64 without PEM headers | Setting the key value without `-----BEGIN ...-----` / `-----END ...-----` wrappers |
174195
| Truncated key | Key content is cut off, often due to environment variable quoting issues |
175196
| Mismatched key pair | Public key was generated from a different private key |
176-
| Unsupported key type | Using a key type other than RSA or EC (e.g. DSA) |
197+
| Unsupported key type | Using a DSA key, or a PKCS#8 or OpenSSH format key |
177198

178199
#### Generate secret
179200

docs/overview/faq.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,8 @@ Starting from version **2602**, Aidbox validates JWT signing keys at startup and
13561356
* **Base64 content must be valid.** Truncated or corrupted key content will cause a startup failure.
13571357
* **The keypair must match.** The public key must correspond to the private key. Regenerate both if unsure.
13581358
* **Watch out for quoting issues.** When passing keys via environment variables, ensure newlines are preserved (use `\n` in single-line values or YAML multi-line `|` syntax).
1359+
* **Key format must be PKCS#1 (RSA) or SEC1 (EC).** If you generated your key with `ssh-keygen`, the default OpenSSH format (`BEGIN OPENSSH PRIVATE KEY`) is not supported. Convert it with `ssh-keygen -p -m PEM -f key.pem`.
1360+
* **PKCS#8 format is not supported.** If you see `PrivateKeyInfo cannot be cast to PEMKeyPair`, your key has a `BEGIN PRIVATE KEY` header (PKCS#8). Convert it with `openssl rsa -in key.pem -traditional -out key-pkcs1.pem`.
13591361

13601362
Learn more: [Configure keys](../configuration/configure-aidbox-and-multibox.md#key-format-requirements)
13611363

0 commit comments

Comments
 (0)