Removed key line offset bug and changed pin from clevis to zlevis.

This commit is contained in:
Luc Bijl 2024-12-14 16:33:21 +01:00
parent 03f5c95b33
commit f573008075
2 changed files with 15 additions and 15 deletions

View file

@ -64,36 +64,36 @@ fi
echo "$jhd" > "$tmp"/jhd
# Validate the JWE pin type
if [ "$(jose fmt -j- -Og clevis -g pin -u- < "$tmp"/jhd)" != "tpm2" ]; then
if [ "$(jose fmt -j- -Og zlevis -g pin -u- < "$tmp"/jhd)" != "tpm2" ]; then
echo "JWE pin mismatch" >&2
exit 1
fi
# Extract required parameters from the JWE header
if ! hash="$(jose fmt -j- -Og clevis -g tpm2 -g hash -Su- < "$tmp"/jhd)"; then
if ! hash="$(jose fmt -j- -Og zlevis -g tpm2 -g hash -Su- < "$tmp"/jhd)"; then
echo "JWE missing required 'hash' header parameter!" >&2
exit 1
fi
if ! key="$(jose fmt -j- -Og clevis -g tpm2 -g key -Su- < "$tmp"/jhd)"; then
if ! key="$(jose fmt -j- -Og zlevis -g tpm2 -g key -Su- < "$tmp"/jhd)"; then
echo "JWE missing required 'key' header parameter!" >&2
exit 1
fi
if ! jwk_pub="$(jose fmt -j- -Og clevis -g tpm2 -g jwk_pub -Su- < "$tmp"/jhd)"; then
if ! jwk_pub="$(jose fmt -j- -Og zlevis -g tpm2 -g jwk_pub -Su- < "$tmp"/jhd)"; then
echo "JWE missing required 'jwk_pub' header parameter!" >&2
exit 1
fi
echo "$jwk_pub" > "$tmp"/jwk_pub
if ! jwk_priv="$(jose fmt -j- -Og clevis -g tpm2 -g jwk_priv -Su- < "$tmp"/jhd)"; then
if ! jwk_priv="$(jose fmt -j- -Og zlevis -g tpm2 -g jwk_priv -Su- < "$tmp"/jhd)"; then
echo "JWE missing required 'jwk_priv' header parameter!" >&2
exit 1
fi
echo "$jwk_priv" > "$tmp"/jwk_priv
# Handle optional PCR parameters
pcr_ids="$(jose fmt -j- -Og clevis -g tpm2 -g pcr_ids -Su- < "$tmp"/jhd)" || true
pcr_ids="$(jose fmt -j- -Og zlevis -g tpm2 -g pcr_ids -Su- < "$tmp"/jhd)" || true
pcr_spec=""
if [ -n "$pcr_ids" ]; then
pcr_bank="$(jose fmt -j- -Og clevis -g tpm2 -g pcr_bank -Su- < "$tmp"/jhd)"
pcr_bank="$(jose fmt -j- -Og zlevis -g tpm2 -g pcr_bank -Su- < "$tmp"/jhd)"
pcr_spec="$pcr_bank:$pcr_ids"
fi