Index: /trunk/src/VBox/Runtime/tools/RTSignTool.cpp
===================================================================
--- /trunk/src/VBox/Runtime/tools/RTSignTool.cpp	(revision 64915)
+++ /trunk/src/VBox/Runtime/tools/RTSignTool.cpp	(revision 64916)
@@ -346,4 +346,28 @@
 {
     PRTCRPKCS7SIGNERINFO pSignerInfo = pThis->pSignedData->SignerInfos.papItems[0];
+    int rc;
+
+    /*
+     * Deal with UnauthenticatedAttributes being absent before trying to append to the array.
+     */
+    if (pSignerInfo->UnauthenticatedAttributes.cItems == 0)
+    {
+        /* HACK ALERT! Invent ASN.1 setters/whatever for members to replace this mess. */
+
+        if (pSignerInfo->AuthenticatedAttributes.cItems == 0)
+            return RTMsgErrorExit(RTEXITCODE_FAILURE, "No authenticated or unauthenticated attributes! Sorry, no can do.");
+
+        Assert(pSignerInfo->UnauthenticatedAttributes.SetCore.Asn1Core.uTag == 0);
+        rc = RTAsn1SetCore_Init(&pSignerInfo->UnauthenticatedAttributes.SetCore,
+                                pSignerInfo->AuthenticatedAttributes.SetCore.Asn1Core.pOps);
+        if (RT_FAILURE(rc))
+            return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTAsn1SetCore_Init failed: %Rrc", rc);
+        pSignerInfo->UnauthenticatedAttributes.SetCore.Asn1Core.uTag   = 1;
+        pSignerInfo->UnauthenticatedAttributes.SetCore.Asn1Core.fClass = ASN1_TAGCLASS_CONTEXT | ASN1_TAGFLAG_CONSTRUCTED;
+        RTAsn1MemInitArrayAllocation(&pSignerInfo->UnauthenticatedAttributes.Allocation,
+                                     pSignerInfo->AuthenticatedAttributes.Allocation.pAllocator,
+                                     sizeof(**pSignerInfo->UnauthenticatedAttributes.papItems));
+    }
+
     int32_t iPos = RTCrPkcs7Attributes_Append(&pSignerInfo->UnauthenticatedAttributes);
     if (iPos >= 0)
@@ -354,5 +378,5 @@
 
         PRTCRPKCS7ATTRIBUTE pAttr = pSignerInfo->UnauthenticatedAttributes.papItems[iPos];
-        int rc = RTAsn1ObjId_InitFromString(&pAttr->Type, RTCR_PKCS9_ID_MS_NESTED_SIGNATURE, pAttr->Allocation.pAllocator);
+        rc = RTAsn1ObjId_InitFromString(&pAttr->Type, RTCR_PKCS9_ID_MS_NESTED_SIGNATURE, pAttr->Allocation.pAllocator);
         if (RT_SUCCESS(rc))
         {
