Opened 7 years ago
#17637 new enhancement
VBoxManage encryptmedium - cipher validation and documentation
Reported by: | andy-g | Owned by: | |
---|---|---|---|
Component: | virtual disk | Version: | VirtualBox 5.2.6 |
Keywords: | encryptmedium | Cc: | |
Guest type: | all | Host type: | all |
Description
Hi, As reported in https://forums.virtualbox.org/viewtopic.php?f=6&t=87254, i had some issues encrypting a disk.
Long story short, the encryptmedium command requires a cipher parameter, but a) does not validate it is present and b) does not present clear usage instructions (in my humble opinion).
Can I suggest that a check is done in handleEncryptMedium (VBoxManageDisk.cpp, line 1756) that if a user has provided a new password and password id, but no old password, that either the method picks a cipher by default if none is provided or reports the issue to the user. At the moment the error reported is pretty misleading.
For example:
VBoxManage encryptmedium 2f6ab46f-8db4-44d9-af1e-152c35178724 --newpasswordid test --newpassword - Enter new password: 0%... Progress state: VBOX_E_INVALID_OBJECT_STATE VBoxManage.exe: error: Failed to encrypt hard disk VBoxManage.exe: error: The password and password identifier must be empty if the output should be unencrypted VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MediumWrap, interface IMedium VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleEncryptMedium(struct HandlerArg *)" at line 1890 of file VBoxManageDisk.cpp
Supplying the cipher:
VBoxManage encryptmedium 2f6ab46f-8db4-44d9-af1e-152c35178724 --newpasswordid test --newpassword - --cipher AES-XTS128-PLAIN64 Enter new password: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%