Index: /trunk/src/VBox/Runtime/common/asn1/asn1-ut-core.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/asn1/asn1-ut-core.cpp	(revision 64893)
+++ /trunk/src/VBox/Runtime/common/asn1/asn1-ut-core.cpp	(revision 64894)
@@ -179,9 +179,44 @@
 
 
+/**
+ * @interface_method_impl{RTASN1COREVTABLE,pfnEncodePrep,
+ *      This is for not dropping the unparsed content of a 'core' structure when
+ *      re-encoding it. }
+ */
+static DECLCALLBACK(int) rtAsn1Core_EncodePrep(PRTASN1CORE pThisCore, uint32_t fFlags, PRTERRINFO pErrInfo)
+{
+    /* We don't update anything here. */
+    RT_NOREF(pThisCore, fFlags, pErrInfo);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * @interface_method_impl{RTASN1COREVTABLE,pfnEncodeWrite,
+ *      This is for not dropping the unparsed content of a 'core' structure when
+ *      re-encoding it. }
+ */
+static DECLCALLBACK(int) rtAsn1Core_EncodeWrite(PRTASN1CORE pThisCore, uint32_t fFlags, PFNRTASN1ENCODEWRITER pfnWriter,
+                                                void *pvUser, PRTERRINFO pErrInfo)
+{
+    int rc = RTAsn1EncodeWriteHeader(pThisCore, fFlags, pfnWriter, pvUser, pErrInfo);
+    if (RT_SUCCESS(rc) && rc != VINF_ASN1_NOT_ENCODED)
+    {
+        Assert(!RTASN1CORE_IS_DUMMY(pThisCore));
+        AssertPtrReturn(pThisCore->uData.pv,
+                        RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_DATA_POINTER,
+                                      "Invalid uData pointer %p for lone ASN.1 core with %#x bytes of content",
+                                      pThisCore->uData.pv, pThisCore->cb));
+        rc = pfnWriter(pThisCore->uData.pv, pThisCore->cb, pvUser, pErrInfo);
+    }
+    return rc;
+}
+
+
 
 /*
  * ASN.1 Core - Standard Methods.
  *
- * Note! Children of the ASN.1 Core doesn't normally call these, they are for
+ * @note Children of the ASN.1 Core doesn't normally call these, they are for
  *       when RTASN1CORE is used as a member type.
  */
@@ -199,6 +234,6 @@
     (PFNRTASN1COREVTCOMPARE)RTAsn1Core_Compare,
     (PFNRTASN1COREVTCHECKSANITY)RTAsn1Core_CheckSanity,
-    NULL,
-    NULL
+    rtAsn1Core_EncodePrep,
+    rtAsn1Core_EncodeWrite
 };
 
