Skip to content

Commit

Permalink
Check for encryption and decryption in KDF mode too
Browse files Browse the repository at this point in the history
Closes: #3
Signed-off-by: Wiktor Kwapisiewicz <[email protected]>
  • Loading branch information
wiktor-k committed Oct 16, 2024
1 parent 6e0a876 commit fb509d7
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions scripts/encrypt-decrypt.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -euxo pipefail
set -Eeuxo pipefail

/etc/init.d/pcscd start

Expand All @@ -13,7 +13,18 @@ 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 > message.txt
< message.txt rage -R recipients.txt -a | tee encrypted.age
rage -d -i identity.txt < encrypted.age > decrypted.txt
cmp --silent message.txt decrypted.txt
}

# test encryption/decryption without KDF
roundtrip

# test encryption/decryption with KDF
oct system kdf-setup --card 0000:00000000
roundtrip

0 comments on commit fb509d7

Please sign in to comment.