From 7f436d738603be1ecf816d28dd297224f7002b80 Mon Sep 17 00:00:00 2001 From: Wiktor Kwapisiewicz Date: Wed, 16 Oct 2024 09:38:31 +0200 Subject: [PATCH] Check for encryption and decryption in KDF mode too Closes: https://github.com/wiktor-k/age-plugin-openpgp-card/issues/3 Signed-off-by: Wiktor Kwapisiewicz --- scripts/encrypt-decrypt.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/encrypt-decrypt.sh b/scripts/encrypt-decrypt.sh index 7301629..7b438c3 100755 --- a/scripts/encrypt-decrypt.sh +++ b/scripts/encrypt-decrypt.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -euxo pipefail +set -Eeuxo pipefail /etc/init.d/pcscd start @@ -13,7 +13,16 @@ echo 12345678 > admin-pin echo 123456 > user-pin oct admin --card 0000:00000000 --admin-pin admin-pin generate --user-pin user-pin --output /tmp/no-need-for-this --userid 'No need for that' curve25519 -age-plugin-openpgp-card | tee identity.txt -grep -oh "age1.*" identity.txt > recipients.txt -echo I like strawberries | rage -R recipients.txt -a | tee encrypted.age -rage -d -i identity.txt < encrypted.age +function roundtrip { + age-plugin-openpgp-card | tee identity.txt + grep -oh "age1.*" identity.txt > recipients.txt + echo I like strawberries | rage -R recipients.txt -a | tee encrypted.age + rage -d -i identity.txt < encrypted.age +} + +# test encryption/decryption without KDF +roundtrip + +# test encryption/decryption with KDF +oct system kdf-setup --card 0000:00000000 +roundtrip