Skip to content

Commit affa587

Browse files
author
“sahmad154”
committed
Fix PKCS#11 token slot and object label issues
- Use --free for token initialization (SoftHSM assigns slots dynamically) - Fix object labels to match test expectations: - rdkclient (cert) and rdkclient-key (key) at ID 0x01 - rdkclient-p12-key (key) at ID 0x2c for P12 patch testing - Import script already handles dynamic slot lookup correctly - Aligns with ssa-cpc and rdkfwupdater test configurations
1 parent f2f52bc commit affa587

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

native-platform/scripts/import-certs-to-pkcs11.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pkcs11-tool --module "$PKCS11_MODULE" \
5757
--write-object "$CLIENT_CERT" \
5858
--type cert \
5959
--id 01 \
60-
--label "RDK_CLIENT_CERT" || echo "Certificate import warning (may already exist)"
60+
--label "rdkclient" || echo "Certificate import warning (may already exist)"
6161

6262
# Import private key to PKCS#11 at slot 0x01
6363
pkcs11-tool --module "$PKCS11_MODULE" \
@@ -66,7 +66,7 @@ pkcs11-tool --module "$PKCS11_MODULE" \
6666
--write-object "$CLIENT_KEY" \
6767
--type privkey \
6868
--id 01 \
69-
--label "RDK_CLIENT_KEY" || echo "Key import warning (may already exist)"
69+
--label "rdkclient-key" || echo "Key import warning (may already exist)"
7070

7171
echo "[import-certs-to-pkcs11] ✓ client certificate imported to slot 0x01"
7272

@@ -84,7 +84,7 @@ if [ -f "$CERT_DIR/reference.p12" ]; then
8484
--write-object "$CLIENT_KEY" \
8585
--type privkey \
8686
--id 2c \
87-
--label "RDK_REFERENCE_KEY" || echo "Reference key import warning (may already exist)"
87+
--label "rdkclient-p12-key" || echo "Reference key import warning (may already exist)"
8888

8989
echo "[import-certs-to-pkcs11] ✓ Real private key imported to slot 0x2c (for reference.p12 with sentinel key)"
9090
fi

native-platform/scripts/init-pkcs11-tokens.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ if softhsm2-util --show-slots 2>/dev/null | grep -q "$TOKEN_LABEL"; then
2424
exit 0
2525
fi
2626

27-
# Initialize token at slot 0x01
28-
echo "[init-pkcs11-tokens] Creating token '$TOKEN_LABEL' at slot 0x01..."
27+
# Initialize token at slot 0 (fixed slot for consistent PKCS#11 URIs)
28+
echo "[init-pkcs11-tokens] Creating token '$TOKEN_LABEL' at slot 0..."
2929
softhsm2-util --init-token \
30-
--slot 0x01 \
30+
--slot 0 \
3131
--label "$TOKEN_LABEL" \
3232
--so-pin "$SO_PIN" \
3333
--pin "$USER_PIN"

0 commit comments

Comments
 (0)