# Generate 2048-bit RSA private key (suppress output)
openssl genpkey -algorithm RSA -out rsa-private.pem -pkeyopt rsa_keygen_bits:2048 *> $null

# Extract the public key from the private key (suppress output)
openssl rsa -in rsa-private.pem -pubout -out rsa-public.pem *> $null

Write-Host ""

# Base64 encode private key (DER format, for JWT_PRIVATE_KEY)
Write-Host -NoNewline 'JWT_PRIVATE_KEY="'
openssl pkcs8 -topk8 -nocrypt -in rsa-private.pem -outform DER 2>$null | openssl base64 -A
Write-Host '"'

# Base64 encode public key (DER format, for JWT_PUBLIC_KEY)
Write-Host -NoNewline 'JWT_PUBLIC_KEY="'
openssl rsa -in rsa-private.pem -pubout -outform DER 2>$null | openssl base64 -A
Write-Host '"'