Skip to content

Commit fb509d7

Browse files
committed
Check for encryption and decryption in KDF mode too
Closes: #3 Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
1 parent 6e0a876 commit fb509d7

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

scripts/encrypt-decrypt.sh

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
set -euxo pipefail
3+
set -Eeuxo pipefail
44

55
/etc/init.d/pcscd start
66

@@ -13,7 +13,18 @@ echo 12345678 > admin-pin
1313
echo 123456 > user-pin
1414
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
1515

16-
age-plugin-openpgp-card | tee identity.txt
17-
grep -oh "age1.*" identity.txt > recipients.txt
18-
echo I like strawberries | rage -R recipients.txt -a | tee encrypted.age
19-
rage -d -i identity.txt < encrypted.age
16+
function roundtrip {
17+
age-plugin-openpgp-card | tee identity.txt
18+
grep -oh "age1.*" identity.txt > recipients.txt
19+
echo I like strawberries > message.txt
20+
< message.txt rage -R recipients.txt -a | tee encrypted.age
21+
rage -d -i identity.txt < encrypted.age > decrypted.txt
22+
cmp --silent message.txt decrypted.txt
23+
}
24+
25+
# test encryption/decryption without KDF
26+
roundtrip
27+
28+
# test encryption/decryption with KDF
29+
oct system kdf-setup --card 0000:00000000
30+
roundtrip

0 commit comments

Comments
 (0)