blob: 61da15677931f32016a5f3d6514ecd85e91fc1cb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#! /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
|