i can't remember what caused this...

This commit is contained in:
Anish Lakhwara
2024-03-15 23:25:49 -07:00
parent f8ec4cfa0f
commit b9fa71a9d3
44 changed files with 2448 additions and 98 deletions
Regular → Executable
+15 -3
View File
@@ -1,9 +1,21 @@
#!/usr/bin/env bash
# nix-shell https://github.com/sgillespie/nixos-yubikey-luks/archive/master.tar.gz
rbtohex() {
( od -An -vtx1 | tr -d ' \n' )
}
hextorb() {
( tr '[:lower:]' '[:upper:]' | sed -e 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI'| xargs printf )
}
key_length=512
iterations="$(head -n 2 /boot/crypted-storage/default)"
salt="$(head -n 1 /boot/crypted-storage/default)"
iterations=1000000
salt="$(head -n 1 /mnt/crypt-storage/default)"
chal="$(echo -n $salt | openssl dgst -binary -sha512 | rbtohex)"
resp="$(ykchalresp -2 -x $chal 2>/dev/null)"
user_key="$(read -s)"
user_key=
read -r user_key
luks_key="$(echo -n $user_key | pbkdf2-sha512 $(($key_length / 8)) $iterations $resp | rbtohex)"
echo -n $luks_key | hextorb | sudo cryptsetup luksOpen /dev/sda2 crypted --key-file=-