-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import ./make-test-python.nix ( | ||
{ pkgs, ... }: | ||
{ | ||
name = "age-plugin-tpm-decrypt"; | ||
meta = with pkgs.lib.maintainers; { | ||
maintainers = [ | ||
sgo | ||
josh | ||
]; | ||
}; | ||
|
||
nodes.machine = | ||
{ pkgs, ... }: | ||
{ | ||
virtualisation.tpm.enable = true; | ||
environment.systemPackages = with pkgs; [ | ||
age | ||
age-plugin-tpm | ||
]; | ||
}; | ||
|
||
testScript = '' | ||
machine.start() | ||
machine.succeed("age-plugin-tpm --generate --output identity.txt") | ||
machine.succeed("age-plugin-tpm --convert identity.txt --output recipient.txt") | ||
machine.succeed("echo -n 'Hello World' >data.txt") | ||
machine.succeed("age --encrypt --recipients-file recipient.txt --output data.age data.txt") | ||
data = machine.succeed("age --decrypt --identity identity.txt data.age") | ||
assert data == "Hello World" | ||
''; | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
runCommand, | ||
age, | ||
age-plugin-tpm, | ||
}: | ||
runCommand "age-plugin-tpm-encrypt" | ||
{ | ||
nativeBuildInputs = [ | ||
age | ||
age-plugin-tpm | ||
]; | ||
# example pubkey from Foxboron/age-plugin-tpm README | ||
env.AGE_RECIPIENT = "age1tpm1qg86fn5esp30u9h6jy6zvu9gcsvnac09vn8jzjxt8s3qtlcv5h2x287wm36"; | ||
} | ||
'' | ||
echo "Hello World" | age --encrypt --armor --recipient "$AGE_RECIPIENT" | ||
touch $out | ||
'' |