Index: /trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp	(revision 84163)
+++ /trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp	(revision 84164)
@@ -1930,18 +1930,7 @@
 
 /**
- * Appends the certificate in PEM format to the given VFS file.
- */
-static int doWriteCertificate(RTVFSFILE hVfsFileSignature, PCRTCRX509CERTIFICATE pCertificate)
-{
-    RT_NOREF(hVfsFileSignature, pCertificate);
-    RTPrintf("TODO: doWriteCertificate\n");
-    return VINF_SUCCESS;
-}
-
-
-/**
  * Performs the OVA signing, producing an in-memory cert-file.
  */
-static int doTheOvaSigning(PCRTCRX509CERTIFICATE pCertificate, RTCRKEY hPrivateKey,
+static int doTheOvaSigning(PRTCRX509CERTIFICATE pCertificate, RTCRKEY hPrivateKey,
                            const char *pszManifestName, RTVFSFILE hVfsFileManifest,
                            bool fPkcs7, unsigned cIntermediateCerts, const char **papszIntermediateCerts,
@@ -2017,19 +2006,27 @@
                                                  pszDigestType, pszManifestName, cbSignature, pvSignature);
                             if (RT_SUCCESS(rc))
-                                rc = doWriteCertificate(hVfsFileSignature, pCertificate);
+                            {
+                                rc = RTCrX509Certificate_WriteToVfsFile(hVfsFileSignature, pCertificate,
+                                                                        RTErrInfoInitStatic(pErrInfo));
+                                if (RT_SUCCESS(rc))
+                                {
+                                    if (fPkcs7)
+                                        rc = doAddPkcs7Signature(pCertificate, hPrivateKey, cIntermediateCerts,
+                                                                 papszIntermediateCerts, hDigest, pErrInfo, hVfsFileSignature);
+                                    if (RT_SUCCESS(rc))
+                                    {
+                                        /*
+                                         * Success.
+                                         */
+                                        *phVfsFileSignature = hVfsFileSignature;
+                                        hVfsFileSignature = NIL_RTVFSFILE;
+                                    }
+                                }
+                                else
+                                    RTMsgError("Failed to write certificate to signature file: %Rrc%#RTeim", rc, &pErrInfo->Core);
+                            }
                             else
                                 RTMsgError("Failed to produce signature file: %Rrc", rc);
-                            if (RT_SUCCESS(rc) && fPkcs7)
-                                rc = doAddPkcs7Signature(pCertificate, hPrivateKey, cIntermediateCerts, papszIntermediateCerts,
-                                                         hDigest, pErrInfo, hVfsFileSignature);
-                            if (RT_SUCCESS(rc))
-                            {
-                                /*
-                                 * Success.
-                                 */
-                                *phVfsFileSignature = hVfsFileSignature;
-                            }
-                            else
-                                RTVfsFileRelease(hVfsFileSignature);
+                            RTVfsFileRelease(hVfsFileSignature);
                         }
                         else
