Hi,
I’m using qemu-img to create a luks encrypted image, and the secret object is
defined to use base64 format.
I was expecting the secret content should be arbitrary bytes when using base64
format as per the qemu document. I also copied in the below.
##
# @QCryptoSecretFormat:
#
# The data format that the secret is provided in
#
# @raw: raw bytes. When encoded in JSON only valid UTF-8 sequences can be used
# @base64: arbitrary base64 encoded binary data
# Since: 2.6
##
{ 'enum': 'QCryptoSecretFormat',
'prefix': 'QCRYPTO_SECRET_FORMAT',
'data': ['raw', 'base64']}
However qemu complains not valid UTF-8 and reports an error.
root@host:~# qemu-img create --object
secret,id=vol-zk0brve6.secret,format=base64,data=ZUYLBsxOrKHhx4rdQdfX35B1PMfC806oX4nCBplrjyw=
-o
encrypt.format=luks,encrypt.key-secret=vol-zk0brve6.secret,encrypt.cipher-alg=aes-256
-f qcow2 1.img 10G
Formatting '1.img', fmt=qcow2 size=10737418240 encrypt.format=luks
encrypt.key-secret=vol-zk0brve6.secret encrypt.cipher-alg=aes-256
cluster_size=65536 lazy_refcounts=off refcount_bits=16
qemu-img: 1.img: Data from secret vol-zk0brve6.secret is not valid UTF-8
root@host:~#
root@host:~# qemu-img --version
qemu-img version 4.0.0.3
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
Am I using qemu-img in a wrong way?
Thanks,
Peter Luo