length and version are signed/hmaced. encrypt the flag field as well
put the flag in the front.