Changeset 54855 in vbox
- Timestamp:
- Mar 19, 2015 8:12:00 PM (10 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r54854 r54855 14768 14768 <param name="newPassword" type="wstring" dir="in"> 14769 14769 <desc> 14770 The new password the medium should be protected with. Use an empty string14771 to indicate that the result should not be encrypted.14770 The new password the medium should be protected with. An empty password and password ID 14771 will result in the medium being encrypted with the current password. 14772 14772 </desc> 14773 14773 </param> -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r54854 r54855 8937 8937 char *pszKeyStoreEncNew = NULL; 8938 8938 void *pvBuf = NULL; 8939 const char *pszPasswordNew = NULL; 8939 8940 try 8940 8941 { … … 8972 8973 if (task.mstrCipher.isNotEmpty()) 8973 8974 { 8974 if (task.mstrNewPassword.isEmpty()) 8975 if ( task.mstrNewPassword.isEmpty() 8976 && task.mstrNewPasswordId.isEmpty() 8977 && task.mstrCurrentPassword.isNotEmpty()) 8978 { 8979 /* An empty password and password ID will default to the current password. */ 8980 pszPasswordNew = task.mstrCurrentPassword.c_str(); 8981 } 8982 else if (task.mstrNewPassword.isEmpty()) 8975 8983 throw setError(VBOX_E_OBJECT_NOT_FOUND, 8976 8984 tr("A password must be given for the image encryption")); 8977 8978 if (task.mstrNewPasswordId.isEmpty()) 8985 else if (task.mstrNewPasswordId.isEmpty()) 8979 8986 throw setError(VBOX_E_INVALID_OBJECT_STATE, 8980 8987 tr("A valid identifier for the password must be given")); 8988 else 8989 pszPasswordNew = task.mstrNewPassword.c_str(); 8981 8990 8982 8991 i_taskEncryptSettingsSetup(&CryptoSettingsWrite, task.mstrCipher.c_str(), NULL, 8983 task.mstrNewPassword.c_str(), true /* fCreateKeyStore */);8992 pszPasswordNew, true /* fCreateKeyStore */); 8984 8993 vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_WRITE, CryptoSettingsWrite.vdFilterIfaces); 8985 8994 if (RT_FAILURE(vrc)) … … 8990 8999 else if (task.mstrNewPasswordId.isNotEmpty() || task.mstrNewPassword.isNotEmpty()) 8991 9000 throw setError(VBOX_E_INVALID_OBJECT_STATE, 8992 tr("The password and password identifier must be empty if the re is the output shuld be unencrypted"));9001 tr("The password and password identifier must be empty if the output should be unencrypted")); 8993 9002 8994 9003 /* Open all media in the chain. */ … … 9044 9053 pBase->m->mapProperties.erase(it); 9045 9054 9046 it = pBase->m->mapProperties.find("CRYPT/KeyId"); 9047 if (it != pBase->m->mapProperties.end()) 9048 pBase->m->mapProperties.erase(it); 9055 if (task.mstrNewPasswordId.isNotEmpty()) 9056 { 9057 it = pBase->m->mapProperties.find("CRYPT/KeyId"); 9058 if (it != pBase->m->mapProperties.end()) 9059 pBase->m->mapProperties.erase(it); 9060 } 9049 9061 9050 9062 if (CryptoSettingsWrite.pszKeyStore) 9051 9063 { 9052 9064 pBase->m->mapProperties["CRYPT/KeyStore"] = Utf8Str(CryptoSettingsWrite.pszKeyStore); 9053 pBase->m->mapProperties["CRYPT/KeyId"] = task.mstrNewPasswordId; 9065 if (task.mstrNewPasswordId.isNotEmpty()) 9066 pBase->m->mapProperties["CRYPT/KeyId"] = task.mstrNewPasswordId; 9054 9067 } 9055 9068 … … 9074 9087 tr("Encryption is not supported because extension pack support is not built in")); 9075 9088 # endif 9076 9077 9078 9089 } 9079 9090 catch (HRESULT aRC) { rc = aRC; }
Note:
See TracChangeset
for help on using the changeset viewer.