Klaus.Espenlaub at Sun.COM
Wed Aug 13 09:09:00 PDT 2008
James Lucas wrote:
> Can someone from VirtualBox/Sun respond? This issue is incredibly
> annoying when developing an external authentication plugin.
Sorry that it took so long to get back to you. Had to ask some people
who knew how UUIDs are handled in VirtualBox. Required digging quite a
bit though the history. And simple things like your question easily
become a difficult
> I've used two different libraries in two different languages and they
> decode the VirtualBox binary string to the same UUID, however this
> string differs from the VirtualBox decoded string value.
> Tests were:
> 1) Decode client side using libuuid (as explained previously)
> 2) Base64 encode value and send to the xmlrpc server. Decoded UUID using
> Java java.util.UUID
I bet libuuid implements "big endian" UUIDs, as defined in RFC4122. Note
that this spec is really really recent, and the older ones don't say
anything about byte ordering.
> It appears that the binary representation has the most-significant bits
> (first 64 bits) in a different byte order than the other two libraries
> are expecting. A work around on server side was easy to implement. To me
> this is a bug if the binary storage of the UUID differs from the specs
> (which have a section on byte ordering)
I've looked at the older specs, and it's really the case that VBox is
not doing what other people have read into the UUID spec (looked at the
DCE spec myself to verify - it leaves the issue of byte ordering
completely open). The main problem there is that VirtualBox UUID
handling needs to be 100% consistent on Windows, Linux, OSX, Solaris and
all other platforms, since the UUID is stored in text form in the xml
files, and in binary form e.g. in VDI files. Guess which platform sets
the rules for all others.
So I fear all we can do is to document that you need to byte swap the
first 3 uuid parts (one 32bit and after that two 16bit values) to make
the VirtualBox UUIDs "big endian" UUIDs as expected by most other
libraries. Byte swapping the entire 64bit is not the correct thing to do.
Any suggestion for an easy to find place in the VirtualBox API
More information about the vbox-dev