| 1 |
#!/usr/bin/env bash |
| 2 |
# Generates a self-signed Ed25519 certificate for testing. |
| 3 |
set -euo pipefail |
| 4 |
|
| 5 |
DIR="$(cd "$(dirname "$0")" && pwd)" |
| 6 |
|
| 7 |
openssl genpkey -algorithm Ed25519 -out "$DIR/ed25519_key.pem" |
| 8 |
openssl req -new -x509 -key "$DIR/ed25519_key.pem" \ |
| 9 |
-out "$DIR/ed25519_cert.pem" \ |
| 10 |
-days 3650 \ |
| 11 |
-subj "/CN=localhost" |
| 12 |
|
| 13 |
# Also produce DER for direct loading in tests |
| 14 |
openssl x509 -in "$DIR/ed25519_cert.pem" -outform DER -out "$DIR/ed25519_cert.der" |
| 15 |
|
| 16 |
echo "Generated ed25519_key.pem, ed25519_cert.pem, ed25519_cert.der in $DIR" |