Menu

#65 Error on decrypting encrypted VMs

unassigned
open
None
5
2017-05-20
2017-05-20
tschoening
No

I tested encryption of complete VMs using phpVirtualBox 5.1-0 and Virtual Box 5.1.22 and while the encryption seems to work as expected, decryption doesn't. If I uncheck the activation checkbox in the encryption tab, the inputs for cipher and new passwords are deactivated. After pressing OK, another dialog opens and asks for a password, which most likely is the formerly set encryption password. I input the password, press OK and a decryption progress bar is shown. Very few seconds afterwards the following error is shown. Decryption fails this way, the VMs and all attached disks stay encrypted.

The password and password identifier must be empty if the output should be unencrypted

I think the problem is that you seem to provide the password ID on decrytion, which seems to be wrong according the code and docs. It's only a guess of course, but the old password is definitely needed and you dialog asking for that password is showing the password ID as well. So I guess that is the problem.

In some circumstances it might be required to decrypt previously encrypted images.
This can be done in the GUI for a complete VM or using VBoxManage with the following command:

VBoxManage encryptmedium "uuid|filename" --oldpassword "file|-"

https://www.virtualbox.org/manual/ch09.html#diskencryption-encryption

As you can see, no password ID. Additionally, the code where the error is thrown:

if (task.mstrCipher.isNotEmpty())
{
[...]
}
else if (task.mstrNewPasswordId.isNotEmpty() || task.mstrNewPassword.isNotEmpty())
throw setError(VBOX_E_INVALID_OBJECT_STATE,
tr("The password and password identifier must be empty if the output should
be unencrypted"));

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Main/src-server/MediumImpl.cpp#L10056

2 Attachments

Discussion

  • tschoening

    tschoening - 2017-05-20
    Exception Object
    (
        [message:protected] => The password and password identifier must be empty if the output should be unencrypted
        [string:Exception:private] =>
        [code:protected] => 0
        [file:protected] => /home/someHost/public_html/phpvirtualbox-5.0-5/endpoints/lib/vboxconnector.php
        [line:protected] => 2429
        [trace:Exception:private] => Array
            (
                [0] => Array
                    (
                        [file] => /home/someHost/public_html/phpvirtualbox-5.0-5/endpoints/lib/vboxconnector.php
                        [line] => 951
                        [function] => remote_progressGet
                        [class] => vboxconnector
                        [type] => ->
                        [args] => Array
                            (
                                [0] => Array
                                    (
                                        [progress] => d762efd3eeafecab-0000000000000003
                                    )
    
                            )
    
                    )
    
                [1] => Array
                    (
                        [file] => /home/someHost/public_html/phpvirtualbox-5.0-5/endpoints/api.php
                        [line] => 316
                        [function] => __call
                        [class] => vboxconnector
                        [type] => ->
                        [args] => Array
                            (
                                [0] => progressGet
                                [1] => Array
                                    (
                                        [0] => Array
                                            (
                                                [progress] => d762efd3eeafecab-0000000000000003
                                            )
    
                                        [1] => Array
                                            (
                                                [0] => Array
                                                    (
                                                        [data] => Array
                                                            (
                                                                [responseData] => Array
                                                                    (
                                                                        [progress] => d762efd3eeafecab-0000000000000003
                                                                        [info] => Array
                                                                            (
                                                                                [completed] => 1
                                                                                [canceled] =>
                                                                                [description] => Decrypting medium '/vboximages/Systemrescue/Verschlüsselungstest.vdi'
                                                                                [operationDescription] => Decrypting medium '/vboximages/Systemrescue/Verschlüsselungstest.vdi'
                                                                                [timeRemaining] => Array
                                                                                    (
                                                                                    )
    
                                                                                [timeElapsed] => Array
                                                                                    (
                                                                                        [days] => 17306
                                                                                        [hours] => 10
                                                                                        [minutes] => 6
                                                                                        [seconds] => 7
                                                                                    )
    
                                                                                [percent] => 0
                                                                            )
    
                                                                    )
    
                                                                [success] => 1
                                                                [key] => 53474945cfd7ac0bf8114767c209c2a6
                                                            )
    
                                                        [errors] => Array
                                                            (
                                                            )
    
                                                        [persist] => Array
                                                            (
                                                            )
    
                                                        [messages] => Array
                                                            (
                                                            )
    
                                                    )
    
                                            )
    
                                    )
    
                            )
    
                    )
    
                [2] => Array
                    (
                        [file] => /home/someHost/public_html/phpvirtualbox-5.0-5/endpoints/api.php
                        [line] => 316
                        [function] => progressGet
                        [class] => vboxconnector
                        [type] => ->
                        [args] => Array
                            (
                                [0] => Array
                                    (
                                        [progress] => d762efd3eeafecab-0000000000000003
                                    )
    
                                [1] => Array
                                    (
                                        [0] => Array
                                            (
                                                [data] => Array
                                                    (
                                                        [responseData] => Array
                                                            (
                                                                [progress] => d762efd3eeafecab-0000000000000003
                                                                [info] => Array
                                                                    (
                                                                        [completed] => 1
                                                                        [canceled] =>
                                                                        [description] => Decrypting medium '/vboximages/Systemrescue/Verschlüsselungstest.vdi'
                                                                        [operationDescription] => Decrypting medium '/vboximages/Systemrescue/Verschlüsselungstest.vdi'
                                                                        [timeRemaining] => Array
                                                                            (
                                                                            )
    
                                                                        [timeElapsed] => Array
                                                                            (
                                                                                [days] => 17306
                                                                                [hours] => 10
                                                                                [minutes] => 6
                                                                                [seconds] => 7
                                                                            )
    
                                                                        [percent] => 0
                                                                    )
    
                                                            )
    
                                                        [success] => 1
                                                        [key] => 53474945cfd7ac0bf8114767c209c2a6
                                                    )
    
                                                [errors] => Array
                                                    (
                                                    )
    
                                                [persist] => Array
                                                    (
                                                    )
    
                                                [messages] => Array
                                                    (
                                                    )
    
                                            )
    
                                    )
    
                            )
    
                    )
    
            )
    
        [previous:Exception:private] =>
    )
    
     

    Last edit: tschoening 2017-05-20
  • tschoening

    tschoening - 2017-05-20

    I've manually created an issiue in GitHub as wlel, not sure of there's any kind of automatic integration.

    https://github.com/phpvirtualbox/phpvirtualbox/issues/54

     

    Last edit: tschoening 2017-05-20

Log in to post a comment.