Index: /trunk/src/VBox/Main/src-server/MediumImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MediumImpl.cpp	(revision 42207)
+++ /trunk/src/VBox/Main/src-server/MediumImpl.cpp	(revision 42208)
@@ -3773,9 +3773,9 @@
         && !itPln->second.isEmpty())
     {
-        /* Encrypt the plain secret. If that does not work (i.e. no settings key specified),
-         * just use the encrypted secret (if there is any). */
+        /* Encrypt the plain secret. If that does not work (i.e. no or wrong settings key
+         * specified), just use the encrypted secret (if there is any). */
         int rc = m->pVirtualBox->encryptSetting(itPln->second, &strCiphertext);
-        NOREF(rc);
-        fHaveInitiatorSecretEncrypted = true;
+        if (RT_SUCCESS(rc))
+            fHaveInitiatorSecretEncrypted = true;
     }
     for (settings::StringsMap::const_iterator it = m->mapProperties.begin();
@@ -3793,7 +3793,7 @@
                 data.properties[name] = value;
         }
-        if (fHaveInitiatorSecretEncrypted)
-            data.properties["InitiatorSecretEncrypted"] = strCiphertext;
-    }
+    }
+    if (fHaveInitiatorSecretEncrypted)
+        data.properties["InitiatorSecretEncrypted"] = strCiphertext;
 
     /* only for base media */
Index: /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 42207)
+++ /trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp	(revision 42208)
@@ -205,5 +205,6 @@
           threadAsyncEvent(NIL_RTTHREAD),
           pAsyncEventQ(NULL),
-          pAutostartDb(NULL)
+          pAutostartDb(NULL),
+          fSettingsCipherKeySet(false)
     {
     }
@@ -2169,5 +2170,5 @@
     }
 
-    /* fill with random data to have a minimal length */
+    /* fill with random data to have a minimal length (salt) */
     if (i < aCiphertextSize)
     {
