Open dmercer-google opened 1 year ago
As described in issue #60, the expectation is that the values are already constructed with the required class/multibyte indicators. it makes for a terrible general purpose TLV encoder but does the job for PIV, which has very simple requirements for its responses. The point is taken here that it is worth at least documenting the implementation decisions and constraints. I'll do that.
TLVWriter
doesn't offer good support for multibyte tags. It should also have awriteTag(byte[] tag)
method.I also noticed that
writeTag(short tag)
doesn't set a multibyte indicator byte nor does it set the continuation bit on the high byte.Regarding how the multibyte indicator is added and continuation bit(s) are set or not set, this should be clearly documented in the API comments.
Regardless of your choice of supporting
writeTag(byte[] tag)
you should clearly document how the variouswriteTag
methods work with respect to setting the multibyte indicator byte and if the user is expected to set the continuation bit.