forked from latchset/pkcs11-provider
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move only the token specific initialization into custom setup files, and the use pkcs11-tool and a single script to set up all the keys and certificates. Signed-off-by: Simo Sorce <[email protected]>
- Loading branch information
Showing
8 changed files
with
258 additions
and
640 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,42 @@ | ||
#!/bin/bash -e | ||
# Copyright (C) 2024 Simo Sorce <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
title SECTION "Searching for Kryoptic module" | ||
|
||
find_kryoptic() { | ||
for _lib in "$@" ; do | ||
if test -f "$_lib" ; then | ||
echo "Using kryoptic path $_lib" | ||
P11LIB="$_lib" | ||
return | ||
fi | ||
done | ||
echo "skipped: Unable to find kryoptic PKCS#11 library" | ||
exit 0 | ||
} | ||
|
||
find_kryoptic \ | ||
"${KRYOPTIC}/target/debug/libkryoptic_pkcs11.so" \ | ||
"${KRYOPTIC}/target/release/libkryoptic_pkcs11.so" \ | ||
/usr/local/lib/kryoptic/libkryoptic_pkcs11so \ | ||
/usr/lib64/pkcs11/libkryoptic_pkcs11.so \ | ||
/usr/lib/pkcs11/libkryoptic_pkcs11.so \ | ||
/usr/lib/x86_64-linux-gnu/kryoptic/libkryoptic_pkcs11.so | ||
|
||
title LINE "Creating Kyroptic database" | ||
|
||
# Kryoptic configuration | ||
export KRYOPTIC_CONF="$TOKDIR/kryoptic.sql" | ||
|
||
TOKENLABEL="Kryoptic Token" | ||
TOKENLABELURI="Kryoptic%20Token" | ||
|
||
# init token | ||
pkcs11-tool --module "${P11LIB}" --init-token \ | ||
--label "${TOKENLABEL}" --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 | ||
|
||
TOKENCONFIGVARS="export KRYOPTIC_CONF=$TOKDIR/kryoptic.sql" |
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
Oops, something went wrong.