google/K2 — pull request #21 by darylseah (2014-07-01 22:30:21+00:00)
Title: Protobuf writing/reading support on KeyVersions.

# Changes:
* Added protocol buffer definitions.
* Removed all placeholders (don't need them any more).
* Moved KeyVersionBuilder to KeyVersion.Builder.
* Added methods on KeyVersion and Builder for sub-classes to override.
* Modified HMACKeyVersion and AESKeyVersion to override these methods and conform to the structure.

# Basic Idea:
* After you create a KeyVersion you can protobuf it by doing kv.buildData().
* You can restore the KeyVersion by doing new KV.Builder().withData(protobuf).build().
* All KeyVersion sub-classes must conform to this paradigm.
* Internally, KeyVersions generate a "core" protobuf which is part of the "data" protobuf. The "data" proto holds ALL the fields needed to persist the KV, while the "core" contains ONLY the fields that will be hashed to obtain the key version ID. The raw bytes of the core will be fixed once it is generated and persisted.