Bugs fixed: - Use randomly generated flags as the spec required. - During envelope opening check the first bit only for signature.