For our application, we chose a protobuf format without delimiting. We 
thought the EOF that would occur when reading the file would suffice. (For 
those interested: It's the Bitcoin wallet format for bitcoinj-based apps)

Now I'd like to wrap it in an encryption layer. Unfortunately, the 
encryption I want to use is a padding block cipher. That means after the 
encrypt/decrypt roundtrip you'll end up with zero bytes appended to the 
serialized protobuf.

I know I could switch my serialization code to the readDelimitedFrom() and 
writeDelimitedTo() pair, but that would make the format incompatible due to 
the prepended varint length field.

*Question:* Is it possible, either programmatically or by declaring it in 
the .proto file, that a zero tag ends the deserialization just like an EOF 
would do?

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
For more options, visit

Reply via email to