Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a single tool for setting up the token #418

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions tests/setup-kryoptic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,16 @@ if [ -d "${TOKDIR}" ]; then
fi
mkdir "${TOKDIR}"

# Kryoptic configuration
export KRYOPTIC_CONF="$TMPPDIR/tokens/kryoptic.sql"

title LINE "Creating Kyroptic database"

export GNUTLS_SO_PIN=${PINVALUE}
p11tool --provider="${P11LIB}" --initialize \
--label="Test" \
"pkcs11:manufacturer=Kryoptic%20Project" 2>&1
unset GNUTLS_SO_PIN

title LINE "Setting User PIN"
# For some reason currently p11tool requires adding extraneous %00 termination
# marks at the end of the manufacturer and token names when using the
# --initialize-pin option
export GNUTLS_PIN=${PINVALUE}
p11tool --provider="${P11LIB}" --initialize-pin \
"pkcs11:manufacturer=Kryoptic%20Project%00;token=Test%00" 2>&1

# Kryoptic configuration
export KRYOPTIC_CONF="$TMPPDIR/tokens/kryoptic.sql"
# init token
pkcs11-tool --module "${P11LIB}" --init-token \
--label "Pkcs11 Provider Tests" --so-pin "${PINVALUE}" 2>&1
# set user pin
pkcs11-tool --module "${P11LIB}" --so-pin "${PINVALUE}" \
--login --login-type so --init-pin --pin "${PINVALUE}" 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: whats the point of forwarding the stderr to stdout like this? Arent both of them captured the same way by the test driver?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not, I needed it to work out some issues.
But I already forgot how it exactly affected things, I think the main issue was just ordering, this way messages are in order otherwise you get all of stdout and then out of order all of stderr.


P11DEFARGS="--module=${P11LIB} --login --pin=${PINVALUE}"

Expand All @@ -119,6 +110,7 @@ email = "[email protected]"
signing_key
encryption_key
HEREDOC
export GNUTLS_PIN=$PINVALUE
SERIAL=1


Expand Down
Loading