#! /usr/bin/env nix-shell #! nix-shell -p rage -p openssl -p bash -i bash --impure # shellcheck shell=bash cd "$(dirname "$0")" || { echo "No basedir?!" exit 1 } key_name="$1" [ -z "$key_name" ] && { echo "Usage: $0 KEY_NAME IDENTITY" exit 2 } openssl genpkey \ -algorithm ed25519 \ -out - | tee >(openssl pkey \ -pubout \ -out - | openssl asn1parse \ -offset 12 \ -noout \ -out - | base64 --wrap 0 >"$key_name-public") | rage --encrypt \ --armor \ --recipient "age1mshh4ynzhhzhff25tqwkg4j054g3xwrfznh98ycchludj9wjj48qn2uffn" \ >"$key_name-private.age" # vim: ft=sh