Skip to content

Commit

Permalink
fixup! pk11_uri: pem encoder and decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Wernli committed Jan 23, 2024
1 parent f72f7b7 commit 3d8e113
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/tpem_encoder
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ make-pkey-pem() {
URI=$1
OUT=$2

TMP_FILE=$(mktemp -p "${TMPPDIR}" -t pem-encoder-XXXXXX.cnf)
RANDOM_HEX=$(od -A n -N 15 -t x1 /dev/random)
TMP_FILE="${TMPPDIR}/pem-encoder-${RANDOM_HEX}.cnf"
cat > "${TMP_FILE}" << EOF
asn1=SEQUENCE:pk11-uri
[pk11-uri]
Expand All @@ -32,7 +33,9 @@ sign-verify() {
PRIV_KEY=$1
PUB_KEY=$2
FILE=$3
TMP_FILE=$(mktemp -p "${TMPPDIR}" -t sign-verify-pem-encoder-XXXXXX.bin)

RANDOM_HEX=$(od -A n -N 15 -t x1 /dev/random)
TMP_FILE="${TMPPDIR}/sign-verify-pem-encoder-${RANDOM_HEX}.bin"

$CHECKER openssl pkeyutl -sign -rawin -digest sha256 \
-inkey "${PRIV_KEY}" \
Expand All @@ -54,7 +57,7 @@ make-pkey-pem "${PRIURI}" "${TMPPDIR}/priuri-pkey.pem"
sign-verify "${TMPPDIR}/priuri-pkey.pem" "${PUBURI}" "${TMPPDIR}/64krandom.bin"

RANDOM_HEX=$(od -A n -N 15 -t x1 /dev/random)
export LABEL_SUFFIX_URI=${RANDOM_HEX// /%}
export LABEL_SUFFIX_URI=${RANDOM_HEX// /}

export ALGORITHM=rsa
export ALGORITHM_OPT=rsa_keygen_bits:2048
Expand Down

0 comments on commit 3d8e113

Please sign in to comment.