# Migrate a personal project

For one developer and one repository: a web app, an API, a command-line tool or a small service. You will find where the project uses classical public-key cryptography, move what you sign to ML-DSA-65 in Aegis Cloud, and keep everything working while you do it. The Free plan is enough.

> **Hand it to your agent:**
>
> The [personal project prompt](https://docs.qblackbit.com/prompts/developer-project.md) gives your own coding agent this whole guide as a brief, with the safety rules built in.

## 1. Find classical cryptography

Search the code, configuration, CI files, container files and infrastructure files. A first pass with `grep`:

```bash
grep -rnEI --exclude-dir={.git,node_modules,vendor,dist,build,target} \
  'RSA|ECDSA|ECDH|Ed25519|X25519|secp256k1|prime256v1|P-256|RS256|ES256|EdDSA|PS256|generateKeyPair|KeyPairGenerator|createSign|crypto/(rsa|ecdsa|ed25519|ecdh)|cryptography\.hazmat|BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY|ssh-keygen|openssl (genrsa|genpkey|ecparam|req)' .
```

Then the key and certificate files, and what each certificate uses:

```bash
find . -path ./.git -prune -o \( -name '*.pem' -o -name '*.key' -o -name '*.crt' -o -name 'id_rsa*' -o -name 'id_ecdsa*' \) -print
openssl x509 -in cert.pem -noout -text | grep 'Public Key Algorithm'
```

Look at dependency manifests too: JWT and JOSE libraries, TLS settings in web servers and proxies, SSH deploy keys in CI, signing steps in release pipelines.

Record each hit: the file and line, the algorithm, the purpose, where the key lives, and who verifies or decrypts.

## 2. Classify

| Class | Examples | What to do |
| --- | --- | --- |
| Signatures you make | Release artefacts, webhook payloads, tokens your service issues and checks itself, licence files | Move to an ML-DSA-65 key in Aegis Cloud (step 3) |
| Data you encrypt to someone | Files or fields sealed to a recipient's public key | Move to an ML-KEM based KEM, the recipient holding the private key (step 5) |
| Protocol settings | TLS on your server or proxy, SSH, VPN | Change the software's own settings (step 6), not through Aegis |
| What you do not own | Your hosting provider's TLS, third-party APIs, libraries' internals | List it, ask the provider, and leave it |

Signatures that other parties must check (for example tokens verified by a third party) can move only when those parties support ML-DSA: sign twice until then.

## 3. Sign with ML-DSA through Aegis Cloud

Sign up and make a `developer` API key as the [cloud quickstart](https://docs.qblackbit.com/quickstart/cloud.md) shows. Then create one key per purpose:

```bash
curl -sS -X POST "$AEGIS_URL/api/v1/keys" \
  -H "Authorization: Bearer $AEGIS_API_KEY" -H "Content-Type: application/json" \
  -d '{"name": "release-signing", "algorithm": "ml-dsa-65"}'
```

Add one small module that calls the API with your language's standard HTTP client: `POST /api/v1/keys/{name}/sign` with `{"message": <base64>}` returns `{"version", "signature"}`, and `POST /api/v1/keys/{name}/verify` with `{"message", "signature", "version"}` returns `{"valid": true}` or `{"valid": false}`. The [quickstart examples](https://docs.qblackbit.com/quickstart/cloud.md#_4-sign-and-verify) in shell, Python, Node.js and Go are complete and tested; start from one of them. Read `AEGIS_URL` and `AEGIS_API_KEY` from the environment, and handle the error codes `quota`, `rate_limited` and `unavailable` explicitly.

A message can be up to 1 MiB. For larger files, sign a digest: compute SHA3-256 (or SHA-256) of the file yourself, sign the digest, and publish which hash you used so a verifier does the same.

## 4. Keep the classical signature beside it

Do not switch over in one step. Produce both signatures, publish both public keys, and let each verifier accept either until all of them check ML-DSA:

```text
release-1.2.3.tar.gz
release-1.2.3.tar.gz.sig           # the classical signature you publish today
release-1.2.3.tar.gz.mldsa65.sig   # the ML-DSA-65 signature from Aegis
release-signing.mldsa65.pub        # from GET /api/v1/keys/release-signing/public
```

Record which signature verified, so you know when the classical one can go.

## 5. Encrypting to a recipient

The cloud API encapsulates to a public key (`POST /api/v1/encapsulate`) but does not decapsulate, and exporting a cloud key is not available yet. So the recipient makes the KEM key pair where they will decapsulate (for example in [Aegis Core](https://docs.qblackbit.com/quickstart/core.md)) and gives you the public key; you encapsulate through the cloud and send the ciphertext with your data.

Derive the data key from the shared secret with HKDF-SHA-256 and seal the data with an authenticated cipher such as AES-256-GCM. Prefer `ml-kem-768` (Pro), a complete KEM on its own. On Free the only KEM is `x25519-ml-kem-768`, the TLS 1.3 hybrid group: outside TLS, put the ciphertext and the recipient's public key in the HKDF `info`, as HPKE does. Why: [KEMs are not encryption](https://docs.qblackbit.com/concepts/post-quantum.md#kems-are-not-encryption).

## 6. Protocol settings outside Aegis

- **TLS.** Hybrid key exchange (X25519MLKEM768) is supported by current browsers and by servers and proxies built on recent TLS libraries, such as OpenSSL 3.5 or later. Check your site with OpenSSL 3.5 or later: `openssl s_client -connect example.com:443 -groups X25519MLKEM768` connects only if the server offers the group. If your hosting provider terminates TLS, ask them.
- **SSH.** OpenSSH 10.0 and later prefer the hybrid key exchange `mlkem768x25519-sha256` by default; `ssh -Q kex | grep mlkem` shows whether yours has it. Host and user keys are still classical signatures; they move when post-quantum SSH keys are standardised.

## 7. Verify

- Tests: sign then verify is `valid: true`; a changed message or signature is `valid: false`; the classical path still passes.
- `GET /api/v1/keys` lists each key you made, with the algorithm you meant.
- `GET /api/v1/usage` matches what your tests used, and your code handles `quota` and `rate_limited`.
- Search the history for leaked keys before you push: `git log -p | grep -n 'agk_'` must find nothing.

## Planned, not available yet

- SDKs for TypeScript, Python, Go, Java, .NET, Rust and C: (Planned). Call the HTTPS API directly; it is small.
- Asking for a policy name such as `qbb-hybrid-1` instead of an algorithm: (Planned).
- API keys that expire on their own: (Planned). Revoke keys you no longer use.
- Finding cryptography automatically (Aegis Discover): (Planned).
