-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from sergio-correia/trim-input
fix: trim base64 input before attempting decryption
- Loading branch information
Showing
3 changed files
with
21 additions
and
1 deletion.
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
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,15 @@ | ||
#!/bin/sh | ||
|
||
die() { | ||
echo "ERROR: ${1}" >&2 | ||
exit 1 | ||
} | ||
|
||
PLAINTEXT=foobar | ||
jwe="$(echo "${PLAINTEXT}" | ./target/debug/clevis-pin-tpm2 encrypt {})" | ||
|
||
dec="$(echo "$jwe" | ./target/debug/clevis-pin-tpm2 decrypt)" \ | ||
|| die "Unable to decrypt JWE passed with newline added" | ||
|
||
[ "${dec}" = "${PLAINTEXT}" ] \ | ||
|| die "Decrypted JWE (${dec}) does not match PLAINTEXT (${PLAINTEXT})" |