From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoCIM-00006f-KQ for qemu-devel@nongnu.org; Mon, 19 Oct 2015 11:24:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoCIL-0006Z6-Ih for qemu-devel@nongnu.org; Mon, 19 Oct 2015 11:24:18 -0400 Date: Mon, 19 Oct 2015 16:24:08 +0100 From: "Daniel P. Berrange" Message-ID: <20151019152408.GC17892@redhat.com> References: <1445267389-21846-1-git-send-email-berrange@redhat.com> <1445267389-21846-2-git-send-email-berrange@redhat.com> <562509E0.7060608@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <562509E0.7060608@redhat.com> Subject: Re: [Qemu-devel] [PATCH 01/17] crypto: add QCryptoSecret object class for password/key handling Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Josh Durgin , Ronnie Sahlberg , qemu-block@nongnu.org, qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi On Mon, Oct 19, 2015 at 05:18:56PM +0200, Paolo Bonzini wrote: > > > On 19/10/2015 17:09, Daniel P. Berrange wrote: > > + > > + switch (secret->format) { > > + case QCRYPTO_SECRET_FORMAT_UTF8: > > + if (!g_utf8_validate(input, strlen(input), NULL)) { > > + error_setg(errp, > > + "Data from secret %s is not valid UTF-8", > > + secretid); > > + goto cleanup; > > + } > > + output = input; > > + input = NULL; > > + break; > > Why validate secrets as UTF-8? In other words why have "utf8" instead > of "binary" as a possible QCryptoSecretFormat? JSON doesn't accept arbitrary 8-bit binary data, so the alternative 'base64' is effectively providing binary data facility. Having to use base64 for plain passwords is rather tedious though, so allowing utf8 is a much more developer friendly approach for people using QEMU without a mgmt tool like libvirt. NB, this dual-format utf8-or-base64 approach matches the approach used in QEMU guest agent for the guest-file-read/write commands for the same reason. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|